git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Sixt <j6t@kdbg.org>
To: Duy Nguyen <pclouds@gmail.com>
Cc: Christian Couder <christian.couder@gmail.com>,
	git <git@vger.kernel.org>, Junio C Hamano <gitster@pobox.com>
Subject: Re: "./t0001-init.sh --valgrind" is broken
Date: Thu, 3 Mar 2016 07:55:17 +0100	[thread overview]
Message-ID: <56D7DFD5.8010108@kdbg.org> (raw)
In-Reply-To: <CACsJy8AL_RGEb2z44-yoL+3yF7n1+FMLqZkmWwUDFJnEPYS_nw@mail.gmail.com>

Am 03.03.2016 um 02:04 schrieb Duy Nguyen:
> On Thu, Mar 3, 2016 at 7:07 AM, Christian Couder
> <christian.couder@gmail.com> 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.
> 

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 <j6t@kdbg.org>
---
 t/t0001-init.sh | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index 295aa59..a5b9e7a 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -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" &&
-		echo GIT_PREFIX &&        # setup.c
-		echo GIT_TEXTDOMAINDIR    # wrapper-for-bin.sh
-	) | sort | uniq >expected &&
-	cat <<-\EOF >script &&
-	#!/bin/sh
-	env | sed -ne "/^GIT_/s/=.*//p" | sort >actual
-	exit 0
+	write_script script <<-\EOF &&
+	env |
+		sed -n \
+			-e "/^GIT_PREFIX=/d" \
+			-e "/^GIT_TEXTDOMAINDIR=/d" \
+			-e "/^GIT_/s/=.*//p" |
+		sort
 	EOF
-	chmod 755 script &&
+	./script >expected &&
 	git config alias.script \!./script &&
-	( mkdir sub && cd sub && git script ) &&
+	( mkdir sub && cd sub && git script >../actual ) &&
 	test_cmp expected actual
 '
 
-- 
2.7.0.118.g90056ae

  parent reply	other threads:[~2016-03-03  6:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-03  0:07 "./t0001-init.sh --valgrind" is broken Christian Couder
2016-03-03  1:04 ` Duy Nguyen
2016-03-03  2:57   ` Junio C Hamano
2016-03-03  6:55   ` Johannes Sixt [this message]
2016-03-03 12:09     ` Duy Nguyen
2016-03-03 12:16       ` Duy Nguyen
2016-03-03 15:56         ` Junio C Hamano
2016-03-03 18:05       ` Jeff King
2016-03-03 18:17       ` Johannes Sixt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56D7DFD5.8010108@kdbg.org \
    --to=j6t@kdbg.org \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pclouds@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).