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

Re: [PATCH] valgrind: support test helpers

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 28, 2016, 12:50 UTC
Message-ID
<xmqqshrg3af4.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<71c3d13a-fa29-75d3-50ac-81978c08f552@web.de>
René Scharfe <l.s.r@web.de> writes:
Show 12 quoted lines
> Tests run with --valgrind call git commands through a wrapper script
> that invokes valgrind on them.  This script (valgrind.sh) is in turn
> invoked through symlinks created for each command in t/valgrind/bin/.
>
> Since e6e7530d (test helpers: move test-* to t/helper/ subdirectory)
> these symlinks have been broken for test helpers -- they point to the
> old locations in the root of the build directory.  Fix that by teaching
> the code for creating the links about the new location of the binaries,
> and do the same in the wrapper script to allow it to find its payload.
>
> Signed-off-by: Rene Scharfe <l.s.r@web.de>
> ---

Hmph. I somehow thought this was supposed to have been fixed by 503e224180 ("t/test-lib.sh: fix running tests with --valgrind", 2016-07-11) already.

Show 55 quoted lines
>  t/test-lib.sh          |  9 ++++++++-
>  t/valgrind/valgrind.sh | 12 ++++++++++--
>  2 files changed, 18 insertions(+), 3 deletions(-)
>
> diff --git a/t/test-lib.sh b/t/test-lib.sh
> index b859db6..a724181 100644
> --- a/t/test-lib.sh
> +++ b/t/test-lib.sh
> @@ -809,7 +809,14 @@ then
>  		return;
>  
>  		base=$(basename "$1")
> -		symlink_target=$GIT_BUILD_DIR/$base
> +		case "$base" in
> +		test-*)
> +			symlink_target="$GIT_BUILD_DIR/t/helper/$base"
> +			;;
> +		*)
> +			symlink_target="$GIT_BUILD_DIR/$base"
> +			;;
> +		esac
>  		# do not override scripts
>  		if test -x "$symlink_target" &&
>  		    test ! -d "$symlink_target" &&
> diff --git a/t/valgrind/valgrind.sh b/t/valgrind/valgrind.sh
> index 4215303..669ebaf 100755
> --- a/t/valgrind/valgrind.sh
> +++ b/t/valgrind/valgrind.sh
> @@ -1,11 +1,19 @@
>  #!/bin/sh
>  
>  base=$(basename "$0")
> +case "$base" in
> +test-*)
> +	program="$GIT_VALGRIND/../../t/helper/$base"
> +	;;
> +*)
> +	program="$GIT_VALGRIND/../../$base"
> +	;;
> +esac
>  
>  TOOL_OPTIONS='--leak-check=no'
>  
>  test -z "$GIT_VALGRIND_ENABLED" &&
> -exec "$GIT_VALGRIND"/../../"$base" "$@"
> +exec "$program" "$@"
>  
>  case "$GIT_VALGRIND_MODE" in
>  memcheck-fast)
> @@ -29,4 +37,4 @@ exec valgrind -q --error-exitcode=126 \
>  	--log-fd=4 \
>  	--input-fd=4 \
>  	$GIT_VALGRIND_OPTIONS \
> -	"$GIT_VALGRIND"/../../"$base" "$@"
> +	"$program" "$@"
Previous: René ScharfeNext: René Scharfe
Message 4 of 5 in “valgrind: support test helpers”
  1. valgrind: support test helpersRené Scharfe, Oct 27, 2016
  2. Johannes SchindelinOct 28, 2016
  3. René ScharfeOct 29, 2016
  4. Junio C HamanoOct 28, 2016
  5. René ScharfeOct 29, 2016

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.