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

[PATCH v3] tests: fix overeager scrubbing of environment variables

From
Jens Lehmann <jens.lehmann@web.de>
Date
Mar 28, 2011, 19:16 UTC
Message-ID
<4D90DE79.7000103@web.de>
In-Reply-To
<7v4o6n18oy.fsf@alter.siamese.dyndns.org>

In commit 95a1d12e9b9f ("tests: scrub environment of GIT_* variables") all environment variables starting with "GIT_" were unset for the tests using a perl script rather than unsetting them one by one. Only three exceptions were made to make them work as before: "GIT_TRACE*", "GIT_DEBUG*" and "GIT_USE_LOOKUP".

Unfortunately some environment variables used by the test framework itself were not added to the exceptions and thus stopped working when given before the make command instead of after it. Those are:

- GIT_NOTES_TIMING_TESTS
- GIT_PATCHID_TIMING_TESTS
- GIT_PROVE_OPTS
- GIT_REMOTE_SVN_TEST_BIG_FILES
- GIT_SKIP_TESTS
- GIT_TEST*
- GIT_VALGRIND_OPTIONS
I noticed that when skipping a test the way I was used to suddenly failed:
GIT_SKIP_TESTS='t1234' GIT_TEST_OPTS='--root=/dev/shm' make -j10 test

This should work according to t/README, but didn't anymore, so let's fix that by adding them to the exception list. And to avoid having a long regexp put the exceptions in a separate variable using nicer formatting.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Acked-by: Jonathan Nieder <jrnieder@gmail.com>
Thanks-to: Jeff King <peff@peff.net>
---
Am 28.03.2011 19:00, schrieb Junio C Hamano:
> I think it is Ok to do this (yes I am trying to avoid doing this myself,
> as I am a bit behind and also am lazy) just as a single patch to rename
> the environment variables, and filter them with a single GIT_TEST_*
> pattern at the same time.

Agreed, that would be the best solution. But I got sidetracked by this issue while trying to fix something else, so I would rather want to avoid doing the whole exercise myself. So here is v3 of my patch which just makes these variables work again.

 t/test-lib.sh |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 7cc9a52..7a56f11 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -46,7 +46,16 @@ unset VISUAL
 unset EMAIL
 unset $(perl -e '
 	my @env = keys %ENV;
-	my @vars = grep(/^GIT_/ && !/^GIT_(TRACE|DEBUG|USE_LOOKUP)/, @env);
+	my $ok = join("|", qw(
+		TRACE
+		DEBUG
+		USE_LOOKUP
+		TEST
+		.*_TEST
+		PROVE
+		VALGRIND
+	));
+	my @vars = grep(/^GIT_/ && !/^GIT_($ok)/o, @env);
 	print join("\n", @vars);
 ')
 GIT_AUTHOR_EMAIL=author@example.com
-- 
1.7.4.2.407.g50b80.dirty
Previous: Junio C HamanoNext: Jonathan Nieder
Message 8 of 10 in “tests: fix overeager scrubbing of environment variables”
  1. tests: fix overeager scrubbing of environment variablesJens Lehmann, Mar 27, 2011
  2. Jonathan NiederMar 27, 2011
  3. squash! tests: fix overeager scrubbing of environment variablesJonathan Nieder, Mar 27, 2011
  4. Jeff KingMar 28, 2011
  5. tests: fix overeager scrubbing of environment variablesJens Lehmann, Mar 27, 2011
  6. tests: use the --long-tests facility to toggle some slow testsJonathan Nieder, Mar 27, 2011
  7. Junio C HamanoMar 28, 2011
  8. tests: fix overeager scrubbing of environment variablesJens Lehmann, Mar 28, 2011
  9. Jonathan NiederMar 28, 2011
  10. Junio C HamanoMar 28, 2011

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.