{"thread":{"id":"44385","subject":"[PATCH] valgrind: support test helpers","startedAt":"2016-10-27T22:14:34Z","lastAt":"2016-10-29T09:44:18Z","messageCount":5,"participants":["René Scharfe","Johannes Schindelin","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"305006","messageId":"71c3d13a-fa29-75d3-50ac-81978c08f552@web.de","threadId":"44385","inReplyTo":null,"subject":"[PATCH] valgrind: support test helpers","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2016-10-27T22:14:00Z","receivedAt":"2016-10-27T22:14:34Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Tests run with --valgrind call git commands through a wrapper script\nthat invokes valgrind on them.  This script (valgrind.sh) is in turn\ninvoked through symlinks created for each command in t/valgrind/bin/.\n\nSince e6e7530d (test helpers: move test-* to t/helper/ subdirectory)\nthese symlinks have been broken for test helpers -- they point to the\nold locations in the root of the build directory.  Fix that by teaching\nthe code for creating the links about the new location of the binaries,\nand do the same in the wrapper script to allow it to find its payload.\n\nSigned-off-by: Rene Scharfe <l.s.r@web.de>\n---\n t/test-lib.sh          |  9 ++++++++-\n t/valgrind/valgrind.sh | 12 ++++++++++--\n 2 files changed, 18 insertions(+), 3 deletions(-)\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex b859db6..a724181 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -809,7 +809,14 @@ then\n \t\treturn;\n \n \t\tbase=$(basename \"$1\")\n-\t\tsymlink_target=$GIT_BUILD_DIR/$base\n+\t\tcase \"$base\" in\n+\t\ttest-*)\n+\t\t\tsymlink_target=\"$GIT_BUILD_DIR/t/helper/$base\"\n+\t\t\t;;\n+\t\t*)\n+\t\t\tsymlink_target=\"$GIT_BUILD_DIR/$base\"\n+\t\t\t;;\n+\t\tesac\n \t\t# do not override scripts\n \t\tif test -x \"$symlink_target\" &&\n \t\t    test ! -d \"$symlink_target\" &&\ndiff --git a/t/valgrind/valgrind.sh b/t/valgrind/valgrind.sh\nindex 4215303..669ebaf 100755\n--- a/t/valgrind/valgrind.sh\n+++ b/t/valgrind/valgrind.sh\n@@ -1,11 +1,19 @@\n #!/bin/sh\n \n base=$(basename \"$0\")\n+case \"$base\" in\n+test-*)\n+\tprogram=\"$GIT_VALGRIND/../../t/helper/$base\"\n+\t;;\n+*)\n+\tprogram=\"$GIT_VALGRIND/../../$base\"\n+\t;;\n+esac\n \n TOOL_OPTIONS='--leak-check=no'\n \n test -z \"$GIT_VALGRIND_ENABLED\" &&\n-exec \"$GIT_VALGRIND\"/../../\"$base\" \"$@\"\n+exec \"$program\" \"$@\"\n \n case \"$GIT_VALGRIND_MODE\" in\n memcheck-fast)\n@@ -29,4 +37,4 @@ exec valgrind -q --error-exitcode=126 \\\n \t--log-fd=4 \\\n \t--input-fd=4 \\\n \t$GIT_VALGRIND_OPTIONS \\\n-\t\"$GIT_VALGRIND\"/../../\"$base\" \"$@\"\n+\t\"$program\" \"$@\"\n-- \n2.10.1\n"},{"id":"305048","messageId":"alpine.DEB.2.20.1610281050220.3264@virtualbox","threadId":"44385","inReplyTo":"71c3d13a-fa29-75d3-50ac-81978c08f552@web.de","subject":"Re: [PATCH] valgrind: support test helpers","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2016-10-28T08:51:27Z","receivedAt":"2016-10-28T08:51:48Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Fri, 28 Oct 2016, René Scharfe wrote:\n\n> Tests run with --valgrind call git commands through a wrapper script\n> that invokes valgrind on them.  This script (valgrind.sh) is in turn\n> invoked through symlinks created for each command in t/valgrind/bin/.\n> \n> Since e6e7530d (test helpers: move test-* to t/helper/ subdirectory)\n> these symlinks have been broken for test helpers -- they point to the\n> old locations in the root of the build directory.  Fix that by teaching\n> the code for creating the links about the new location of the binaries,\n> and do the same in the wrapper script to allow it to find its payload.\n> \n> Signed-off-by: Rene Scharfe <l.s.r@web.de>\n\nApart from the missing accent (\"é\") in your SOB: ACK.\n\nCiao,\nDscho"},{"id":"305057","messageId":"xmqqshrg3af4.fsf@gitster.mtv.corp.google.com","threadId":"44385","inReplyTo":"71c3d13a-fa29-75d3-50ac-81978c08f552@web.de","subject":"Re: [PATCH] valgrind: support test helpers","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-10-28T12:50:07Z","receivedAt":"2016-10-28T12:50:17Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"René Scharfe <l.s.r@web.de> writes:\n\n> Tests run with --valgrind call git commands through a wrapper script\n> that invokes valgrind on them.  This script (valgrind.sh) is in turn\n> invoked through symlinks created for each command in t/valgrind/bin/.\n>\n> Since e6e7530d (test helpers: move test-* to t/helper/ subdirectory)\n> these symlinks have been broken for test helpers -- they point to the\n> old locations in the root of the build directory.  Fix that by teaching\n> the code for creating the links about the new location of the binaries,\n> and do the same in the wrapper script to allow it to find its payload.\n>\n> Signed-off-by: Rene Scharfe <l.s.r@web.de>\n> ---\n\nHmph.  I somehow thought this was supposed to have been fixed by\n503e224180 (\"t/test-lib.sh: fix running tests with --valgrind\",\n2016-07-11) already.\n\n\n\n>  t/test-lib.sh          |  9 ++++++++-\n>  t/valgrind/valgrind.sh | 12 ++++++++++--\n>  2 files changed, 18 insertions(+), 3 deletions(-)\n>\n> diff --git a/t/test-lib.sh b/t/test-lib.sh\n> index b859db6..a724181 100644\n> --- a/t/test-lib.sh\n> +++ b/t/test-lib.sh\n> @@ -809,7 +809,14 @@ then\n>  \t\treturn;\n>  \n>  \t\tbase=$(basename \"$1\")\n> -\t\tsymlink_target=$GIT_BUILD_DIR/$base\n> +\t\tcase \"$base\" in\n> +\t\ttest-*)\n> +\t\t\tsymlink_target=\"$GIT_BUILD_DIR/t/helper/$base\"\n> +\t\t\t;;\n> +\t\t*)\n> +\t\t\tsymlink_target=\"$GIT_BUILD_DIR/$base\"\n> +\t\t\t;;\n> +\t\tesac\n>  \t\t# do not override scripts\n>  \t\tif test -x \"$symlink_target\" &&\n>  \t\t    test ! -d \"$symlink_target\" &&\n> diff --git a/t/valgrind/valgrind.sh b/t/valgrind/valgrind.sh\n> index 4215303..669ebaf 100755\n> --- a/t/valgrind/valgrind.sh\n> +++ b/t/valgrind/valgrind.sh\n> @@ -1,11 +1,19 @@\n>  #!/bin/sh\n>  \n>  base=$(basename \"$0\")\n> +case \"$base\" in\n> +test-*)\n> +\tprogram=\"$GIT_VALGRIND/../../t/helper/$base\"\n> +\t;;\n> +*)\n> +\tprogram=\"$GIT_VALGRIND/../../$base\"\n> +\t;;\n> +esac\n>  \n>  TOOL_OPTIONS='--leak-check=no'\n>  \n>  test -z \"$GIT_VALGRIND_ENABLED\" &&\n> -exec \"$GIT_VALGRIND\"/../../\"$base\" \"$@\"\n> +exec \"$program\" \"$@\"\n>  \n>  case \"$GIT_VALGRIND_MODE\" in\n>  memcheck-fast)\n> @@ -29,4 +37,4 @@ exec valgrind -q --error-exitcode=126 \\\n>  \t--log-fd=4 \\\n>  \t--input-fd=4 \\\n>  \t$GIT_VALGRIND_OPTIONS \\\n> -\t\"$GIT_VALGRIND\"/../../\"$base\" \"$@\"\n> +\t\"$program\" \"$@\"\n"},{"id":"305157","messageId":"d6485418-e009-f808-8ee2-a06e60c60d0d@web.de","threadId":"44385","inReplyTo":"xmqqshrg3af4.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH] valgrind: support test helpers","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2016-10-29T09:43:32Z","receivedAt":"2016-10-29T09:43:50Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Am 28.10.2016 um 14:50 schrieb Junio C Hamano:\n> Hmph.  I somehow thought this was supposed to have been fixed by\n> 503e224180 (\"t/test-lib.sh: fix running tests with --valgrind\",\n> 2016-07-11) already.\n\nIts title seems to indicate that intention.  Probably the quickest test\nscript that calls a helper is t0009-prio-queue.sh, and without my patch\nit reports something like this, unfortunately:\n\n  expecting success:\n          test-prio-queue 2 6 3 10 9 5 7 4 5 8 1 dump >actual &&\n          test_cmp expect actual\n  \n  ./t0009-prio-queue.sh: 4: eval: test-prio-queue: not found\n  not ok 1 - basic ordering\n  #\n  #               test-prio-queue 2 6 3 10 9 5 7 4 5 8 1 dump >actual &&\n  #               test_cmp expect actual\n  #\n\nRené\n"},{"id":"305158","messageId":"da3542a1-f7c5-b480-16ca-fb20ef4a4fdd@web.de","threadId":"44385","inReplyTo":"alpine.DEB.2.20.1610281050220.3264@virtualbox","subject":"Re: [PATCH] valgrind: support test helpers","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2016-10-29T09:44:09Z","receivedAt":"2016-10-29T09:44:18Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Am 28.10.2016 um 10:51 schrieb Johannes Schindelin:\n> On Fri, 28 Oct 2016, René Scharfe wrote:\n>> Signed-off-by: Rene Scharfe <l.s.r@web.de>\n>\n> Apart from the missing accent (\"é\") in your SOB: ACK.\n\nI sign off without accent out of habit, to avoid display problems -- \nbetter have a plain \"e\" than something like \"<C3><A9>\" or worse.\n\nBut only now I realized that I can fix at least my end by using an UTF-8 \nlocale (e.g. LANG=C.UTF-8 instead of LANG=C) -- together with PuTTY and \nits settings Window, Translation, Remote character set: UTF-8 and \nConnection, Data, Terminal-type-string: linux, which I already had.  My \nterminal just got boosted into the 21st century, woohoo! ;)\n\nRené\n"}]}