test-lib: use $SHELL_PATH, not $SHELL

The codepath for handling "--tee" ends up relaunching the test script under a shell, and that one has to be a Bourne. But we incorrectly used $SHELL, which could be a non-Bourne (e.g. zsh or csh); we have the Makefile variable $SHELL_PATH for exactly that, so use it instead. Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ramkumar Ramachandra committed Sep 22, 2012 at 10:25 UTC 4cde519fe666af478be4b86659c518949a853f91
1 file changed +16 -16
t/test-lib.sh
+16 -16
@@ -15,22 +15,6 @@
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see http://www.gnu.org/licenses/ .
17
18 -# if --tee was passed, write the output not only to the terminal, but
19 -# additionally to the file test-results/$BASENAME.out, too.
20 -case "$GIT_TEST_TEE_STARTED, $* " in
21 -done,*)
22 - # do not redirect again
23 - ;;
24 -*' --tee '*|*' --va'*)
25 - mkdir -p test-results
26 - BASE=test-results/$(basename "$0" .sh)
27 - (GIT_TEST_TEE_STARTED=done ${SHELL-sh} "$0" "$@" 2>&1;
28 - echo $? > $BASE.exit) | tee $BASE.out
29 - test "$(cat $BASE.exit)" = 0
30 - exit
31 - ;;
32 -esac
33 -
18 # Keep the original TERM for say_color
19 ORIGINAL_TERM=$TERM
20
@@ -54,6 +38,22 @@ GIT_BUILD_DIR="$TEST_DIRECTORY"/..
38 . "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
39 export PERL_PATH SHELL_PATH
40
41 +# if --tee was passed, write the output not only to the terminal, but
42 +# additionally to the file test-results/$BASENAME.out, too.
43 +case "$GIT_TEST_TEE_STARTED, $* " in
44 +done,*)
45 + # do not redirect again
46 + ;;
47 +*' --tee '*|*' --va'*)
48 + mkdir -p test-results
49 + BASE=test-results/$(basename "$0" .sh)
50 + (GIT_TEST_TEE_STARTED=done ${SHELL_PATH} "$0" "$@" 2>&1;
51 + echo $? > $BASE.exit) | tee $BASE.out
52 + test "$(cat $BASE.exit)" = 0
53 + exit
54 + ;;
55 +esac
56 +
57 # For repeatability, reset the environment to known value.
58 LANG=C
59 LC_ALL=C