Skip to content

Commit 4cde519

Browse files
artagnongitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 889d358 commit 4cde519

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

t/test-lib.sh

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,6 @@
1515
# You should have received a copy of the GNU General Public License
1616
# along with this program. If not, see http://www.gnu.org/licenses/ .
1717

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-
3418
# Keep the original TERM for say_color
3519
ORIGINAL_TERM=$TERM
3620

@@ -54,6 +38,22 @@ GIT_BUILD_DIR="$TEST_DIRECTORY"/..
5438
. "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
5539
export PERL_PATH SHELL_PATH
5640

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+
5757
# For repeatability, reset the environment to known value.
5858
LANG=C
5959
LC_ALL=C

0 commit comments

Comments
 (0)