On Thu, Mar 3, 2016 at 7:07 AM, Christian Couder
[off-list ref] wrote:
Hi,
It looks like commit 57ea7123c86771f47f34e7d92d1822d8b429897a (git.c:
make sure we do not leak GIT_* to alias scripts, Dec 20 14:50:19 2015)
broke "./t0001-init.sh --valgrind".
Just wanted to confirm the problem. I will look at it later today.
--
Duy
From: Johannes Sixt <hidden> Date: 2016-06-15 23:08:36
Am 03.03.2016 um 02:04 schrieb Duy Nguyen:
On Thu, Mar 3, 2016 at 7:07 AM, Christian Couder
[off-list ref] wrote:
quoted
Hi,
It looks like commit 57ea7123c86771f47f34e7d92d1822d8b429897a (git.c:
make sure we do not leak GIT_* to alias scripts, Dec 20 14:50:19 2015)
broke "./t0001-init.sh --valgrind".
Just wanted to confirm the problem. I will look at it later today.
Here's a patch.
---- 8< ----
Subject: [PATCH] t0001: fix GIT_* environment variable check under --valgrind
When a test case is run without --valgrind, the wrap-for-bin.sh
helper script inserts the environment variable GIT_TEXTDOMAINDIR, but
when run with --valgrind, the variable is missing. A recently
introduced test case expects the presence of the variable, though, and
fails under --valgrind.
Rewrite the test case to strip conditially defined environment variables
from both expected and actual output.
Signed-off-by: Johannes Sixt <redacted>
---
t/t0001-init.sh | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
@@ -88,19 +88,17 @@ test_expect_success 'plain nested in bare through aliased command' '' test_expect_success'No extra GIT_* on alias scripts''-(-env|sed-ne"/^GIT_/s/=.*//p"&&-echoGIT_PREFIX&&# setup.c-echoGIT_TEXTDOMAINDIR# wrapper-for-bin.sh-)|sort|uniq>expected&&-cat<<-\EOF>script&&-#!/bin/sh-env|sed-ne"/^GIT_/s/=.*//p"|sort>actual-exit0+write_scriptscript<<-\EOF&&+env|+sed-n\+-e"/^GIT_PREFIX=/d"\+-e"/^GIT_TEXTDOMAINDIR=/d"\+-e"/^GIT_/s/=.*//p"|+sortEOF-chmod755script&&+./script>expected&&gitconfigalias.script\!./script&&-(mkdirsub&&cdsub&&gitscript)&&+(mkdirsub&&cdsub&&gitscript>../actual)&&test_cmpexpectedactual'
+the-other-Johannes who added valgrind support.
On Thu, Mar 3, 2016 at 1:55 PM, Johannes Sixt [off-list ref] wrote:
---- 8< ----
Subject: [PATCH] t0001: fix GIT_* environment variable check under --valgrind
When a test case is run without --valgrind, the wrap-for-bin.sh
helper script inserts the environment variable GIT_TEXTDOMAINDIR, but
when run with --valgrind, the variable is missing. A recently
introduced test case expects the presence of the variable, though, and
fails under --valgrind.
Yep.
It's interesting though that valgrind sets up some variables without
going through bin-wrappers. That's understandable because valgrind
support is added (in 4e1be63) 10 months before bin-wrappers (in
ea92519). But it's probably better that we inject valgrind command
from inside bin-wrappers script, the same way we inject gdb, I think.
Rewrite the test case to strip conditially defined environment variables
from both expected and actual output.
Or we could set GIT_TEXTDOMAINDIR in the "if test -n $valgrind" code
in test-lib.sh, which makes the two more consistent. Also simpler
patch.
@@ -88,19 +88,17 @@ test_expect_success 'plain nested in bare through aliased command' '' test_expect_success'No extra GIT_* on alias scripts''-(-env|sed-ne"/^GIT_/s/=.*//p"&&-echoGIT_PREFIX&&# setup.c-echoGIT_TEXTDOMAINDIR# wrapper-for-bin.sh-)|sort|uniq>expected&&-cat<<-\EOF>script&&-#!/bin/sh-env|sed-ne"/^GIT_/s/=.*//p"|sort>actual-exit0+write_scriptscript<<-\EOF&&+env|+sed-n\+-e"/^GIT_PREFIX=/d"\+-e"/^GIT_TEXTDOMAINDIR=/d"\+-e"/^GIT_/s/=.*//p"|+sortEOF-chmod755script&&+./script>expected&&gitconfigalias.script\!./script&&-(mkdirsub&&cdsub&&gitscript)&&+(mkdirsub&&cdsub&&gitscript>../actual)&&test_cmpexpectedactual'--
On Thu, Mar 3, 2016 at 7:09 PM, Duy Nguyen [off-list ref] wrote:
But it's probably better that we inject valgrind command
from inside bin-wrappers script, the same way we inject gdb, I think.
For the best of both worlds, we should recreate bin-wrappers in
test-lib.sh (i.e. the valgrind way), not in Makefile. Somewhat
unrelated, but because topdir is getting really crowded and
bin-wrappers is used for the test suite only, it should be moved
inside t/ (i'm going to move all test-* to t/ too, later).
--
Duy
From: Jeff King <hidden> Date: 2016-06-15 23:08:36
On Thu, Mar 03, 2016 at 07:09:12PM +0700, Duy Nguyen wrote:
+the-other-Johannes who added valgrind support.
On Thu, Mar 3, 2016 at 1:55 PM, Johannes Sixt [off-list ref] wrote:
quoted
---- 8< ----
Subject: [PATCH] t0001: fix GIT_* environment variable check under --valgrind
When a test case is run without --valgrind, the wrap-for-bin.sh
helper script inserts the environment variable GIT_TEXTDOMAINDIR, but
when run with --valgrind, the variable is missing. A recently
introduced test case expects the presence of the variable, though, and
fails under --valgrind.
Yep.
It's interesting though that valgrind sets up some variables without
going through bin-wrappers. That's understandable because valgrind
support is added (in 4e1be63) 10 months before bin-wrappers (in
ea92519). But it's probably better that we inject valgrind command
from inside bin-wrappers script, the same way we inject gdb, I think.
I had the same thought and even started on a patch, but it doesn't quite
work. The bin-wrappers are all about intercepting what goes into the
user's $PATH, and pointing our libexec dir at the main build.
So we have "git" and "git-upload-pack" in bin-wrappers, but not
"git-log". Whereas the valgrind code wants to intercept _all_ of the
test script's invocations of git, including ones spawned by scripts,
other git commands, etc. So conceptually, it wants to intercept
$GIT_EXEC_PATH.
-Peff
From: Johannes Sixt <hidden> Date: 2016-06-15 23:08:36
Am 03.03.2016 um 13:09 schrieb Duy Nguyen:
+the-other-Johannes who added valgrind support.
On Thu, Mar 3, 2016 at 1:55 PM, Johannes Sixt [off-list ref] wrote:
quoted
---- 8< ----
Subject: [PATCH] t0001: fix GIT_* environment variable check under --valgrind
When a test case is run without --valgrind, the wrap-for-bin.sh
helper script inserts the environment variable GIT_TEXTDOMAINDIR, but
when run with --valgrind, the variable is missing. A recently
introduced test case expects the presence of the variable, though, and
fails under --valgrind.
Yep.
It's interesting though that valgrind sets up some variables without
going through bin-wrappers. That's understandable because valgrind
support is added (in 4e1be63) 10 months before bin-wrappers (in
ea92519). But it's probably better that we inject valgrind command
from inside bin-wrappers script, the same way we inject gdb, I think.
quoted
Rewrite the test case to strip conditially defined environment variables
from both expected and actual output.
Or we could set GIT_TEXTDOMAINDIR in the "if test -n $valgrind" code
in test-lib.sh, which makes the two more consistent. Also simpler
patch.
My fix (or something along its lines) is needed nevertheless. Just
s/--valgrind/--with-dashes/g in the commit message if you want to fix
the --valgrind case differently ;-)
I run tests on Windows --with-dashes in the hopes that it saves a fork
and exec or two on every git invocation.
-- Hannes