git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/4] tests: make RUNTIME_PREFIX compatible with --valgrind

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 21, 2022, 22:22 UTC
Message-ID
<xmqqlevydqll.fsf@gitster.g>
In-Reply-To
<patch-1.4-315da7c2df0-20220421T200733Z-avarab@gmail.com>
Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:
> Subject: Re: [PATCH 1/4] tests: make RUNTIME_PREFIX compatible with --valgrind
The patch text looks more like 
	tests: --valgrind does not work with RUNTIME_PREFIX

to me. Is it true that a test that only works with RUNTIME_PREFIX does not work under --valgrind at all? I am wondering if we can do this without introducing a new prerequisite, and if it makes sense to do so if it can be done. The output from

    $ git grep 'test_expect_success .*RUNTIME_PREFIX' t/

tells me that there are two test pieces that must be run under RUNTIME_PREFIX, and this patch touches both of them.

I guess it is not RUNTIME_PREFIX build itself per-se, but it is the way we test RUNTIME_PREFIX is incompatible with how we run our tests under --valgrind, so neither the title on the Subject: header of this message or "looks more like" above is a good one. It is more like

	tests: using custom GIT_EXEC_PATH breaks --valgrind tests
I think.

And after having looked at the patch text and thought about the issues enough to come up with the above updated title, I can say that the change looks quite reasonable, both the body of the proposed log message and the solution. Nicely done.

It would have been even nicer if I didn't have to think about the issues myself, though ;-)

Thanks.
Show 45 quoted lines
> Fix a regression in b7d11a0f5d2 (tests: exercise the RUNTIME_PREFIX
> feature, 2021-07-24) where tests that want to set up and test a "git"
> wrapper in $PATH conflicted with the t/bin/valgrind wrapper(s) doing
> the same.
>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> ---
>  t/t0060-path-utils.sh | 4 ++--
>  t/test-lib.sh         | 1 +
>  2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/t/t0060-path-utils.sh b/t/t0060-path-utils.sh
> index 2fe6ae6a4e5..aa35350b6f3 100755
> --- a/t/t0060-path-utils.sh
> +++ b/t/t0060-path-utils.sh
> @@ -542,7 +542,7 @@ test_lazy_prereq CAN_EXEC_IN_PWD '
>  	./git rev-parse
>  '
>  
> -test_expect_success RUNTIME_PREFIX,CAN_EXEC_IN_PWD 'RUNTIME_PREFIX works' '
> +test_expect_success !VALGRIND,RUNTIME_PREFIX,CAN_EXEC_IN_PWD 'RUNTIME_PREFIX works' '
>  	mkdir -p pretend/bin pretend/libexec/git-core &&
>  	echo "echo HERE" | write_script pretend/libexec/git-core/git-here &&
>  	cp "$GIT_EXEC_PATH"/git$X pretend/bin/ &&
> @@ -550,7 +550,7 @@ test_expect_success RUNTIME_PREFIX,CAN_EXEC_IN_PWD 'RUNTIME_PREFIX works' '
>  	echo HERE >expect &&
>  	test_cmp expect actual'
>  
> -test_expect_success RUNTIME_PREFIX,CAN_EXEC_IN_PWD '%(prefix)/ works' '
> +test_expect_success !VALGRIND,RUNTIME_PREFIX,CAN_EXEC_IN_PWD '%(prefix)/ works' '
>  	mkdir -p pretend/bin &&
>  	cp "$GIT_EXEC_PATH"/git$X pretend/bin/ &&
>  	git config yes.path "%(prefix)/yes" &&
> diff --git a/t/test-lib.sh b/t/test-lib.sh
> index 531cef097db..7f3d323e937 100644
> --- a/t/test-lib.sh
> +++ b/t/test-lib.sh
> @@ -1666,6 +1666,7 @@ test -n "$USE_LIBPCRE2" && test_set_prereq PCRE
>  test -n "$USE_LIBPCRE2" && test_set_prereq LIBPCRE2
>  test -z "$NO_GETTEXT" && test_set_prereq GETTEXT
>  test -n "$SANITIZE_LEAK" && test_set_prereq SANITIZE_LEAK
> +test -n "$GIT_VALGRIND_ENABLED" && test_set_prereq VALGRIND
>  
>  if test -z "$GIT_TEST_CHECK_CACHE_TREE"
>  then
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 3 of 20 in “Fix issues and a regression noted by valgrind”
  1. 0/4 Fix issues and a regression noted by valgrindÆvar Arnfjörð Bjarmason, Apr 21, 2022
  2. 1/4 tests: make RUNTIME_PREFIX compatible with --valgrindÆvar Arnfjörð Bjarmason, Apr 21, 2022
  3. Junio C HamanoApr 21, 2022
  4. 2/4 log test: skip a failing mkstemp() test under valgrindÆvar Arnfjörð Bjarmason, Apr 21, 2022
  5. 3/4 commit-graph.c: don't assume that stat() succeedsÆvar Arnfjörð Bjarmason, Apr 21, 2022
  6. Junio C HamanoApr 21, 2022
  7. 4/4 object-file: fix a unpack_loose_header() regression in 3b6a8db3b03Ævar Arnfjörð Bjarmason, Apr 21, 2022
  8. Junio C HamanoApr 21, 2022
  9. Ævar Arnfjörð BjarmasonApr 22, 2022
  10. 0/4 test fixes around valgrindJunio C Hamano, May 12, 2022
  11. 1/4 tests: using custom GIT_EXEC_PATH breaks --valgrind testsJunio C Hamano, May 12, 2022
  12. 2/4 log test: skip a failing mkstemp() test under valgrindJunio C Hamano, May 12, 2022
  13. 4/4 object-file: fix a unpack_loose_header() regression in 3b6a8db3b03Junio C Hamano, May 12, 2022
  14. Junio C HamanoMay 12, 2022
  15. Derrick StoleeMay 16, 2022
  16. 0/2 Alternate ab/valgrind-fixes fix-upÆvar Arnfjörð Bjarmason, May 19, 2022
  17. 1/2 object-file API: fix obscure unpack_loose_header() returnÆvar Arnfjörð Bjarmason, May 19, 2022
  18. 2/2 object-file API: have unpack_loose_header() return "int" againÆvar Arnfjörð Bjarmason, May 19, 2022
  19. Junio C HamanoMay 20, 2022
  20. 3/4 commit-graph.c: don't assume that stat() succeedsJunio C Hamano, May 12, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.