@matheusbsbs / matheus-bagliano / commits / 730477f199
Fork 0

tests: fix overeager scrubbing of environment variables

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> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jens Lehmann committed Mar 28, 2011 at 21:16 UTC 730477f199489d61b960633501c390e03f04cba9
1 file changed +10 -1
t/test-lib.sh
+10 -1
@@ -46,7 +46,16 @@ unset VISUAL
46 unset EMAIL
47 unset $(perl -e '
48 my @env = keys %ENV;
49 - my @vars = grep(/^GIT_/ && !/^GIT_(TRACE|DEBUG|USE_LOOKUP)/, @env);
49 + my $ok = join("|", qw(
50 + TRACE
51 + DEBUG
52 + USE_LOOKUP
53 + TEST
54 + .*_TEST
55 + PROVE
56 + VALGRIND
57 + ));
58 + my @vars = grep(/^GIT_/ && !/^GIT_($ok)/o, @env);
59 print join("\n", @vars);
60 ')
61 GIT_AUTHOR_EMAIL=author@example.com