]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t/perf: do not run tests in user's $SHELL
authorJohannes Altmanninger <aclopte@gmail.com>
Sat, 25 Dec 2021 08:16:58 +0000 (09:16 +0100)
committerJunio C Hamano <gitster@pobox.com>
Sat, 25 Dec 2021 22:24:58 +0000 (14:24 -0800)
The environment variable $SHELL is usually set to the user's
interactive shell. Our build and test scripts never use $SHELL because
there are no guarantees about its input language.  Instead, we use
/bin/sh which should be a POSIX shell.

For systems with a broken /bin/sh, we allow to override that path via
SHELL_PATH.  To run tests in yet another shell we allow to override
SHELL_PATH with TEST_SHELL_PATH.

Perf tests run in $SHELL via a wrapper defined in t/perf/perf-lib.sh,
so they break with e.g. SHELL=python.  Use TEST_SHELL_PATH like
in other tests.  TEST_SHELL_PATH is always defined because
t/perf/perf-lib.sh includes t/test-lib.sh, which includes
GIT-BUILD-OPTIONS.

Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Johannes Altmanninger <aclopte@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/perf/perf-lib.sh

index 780a7402d5191f72f7b50a48da4adf665090349f..407252bac70fbfc7b3a30fe29833f5944b3de8a5 100644 (file)
@@ -161,7 +161,7 @@ test_run_perf_ () {
        test_cleanup=:
        test_export_="test_cleanup"
        export test_cleanup test_export_
-       "$GTIME" -f "%E %U %S" -o test_time.$i "$SHELL" -c '
+       "$GTIME" -f "%E %U %S" -o test_time.$i "$TEST_SHELL_PATH" -c '
 . '"$TEST_DIRECTORY"/test-lib-functions.sh'
 test_export () {
        test_export_="$test_export_ $*"