Skip to contentSkip to conversation

t/t0000-basic: make sure subtests also use TEST_SHELL_PATH

PATCH In review Carlo Marcelo Arenas Belón 2 participants 2 messages May 7, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 t/t0000-basic: make sure subtests also use TEST_SHELL_PATH

3f824e91c8 (t/Makefile: introduce TEST_SHELL_PATH, 2017-12-08) allows for setting a shell for running the tests, but the generated subtests weren't updated.

Correct that and while at it update it to use write_script.

---
 t/t0000-basic.sh | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
t/t0000-basic.sh +2 -5
index 3e440c078d..272f75ce63 100755
@@ -77,9 +77,7 @@ _run_sub_test_lib_test_common () {
 		# the sub-test.
 		sane_unset HARNESS_ACTIVE &&
 		cd "$name" &&
-		cat >"$name.sh" <<-EOF &&
-		#!$SHELL_PATH
-
+		write_script "$name.sh" "$TEST_SHELL_PATH" <<-EOF &&
 		test_description='$descr (run in sub test-lib)
 
 		This is run in a sub test-lib so that we do not get incorrect
@@ -94,7 +92,6 @@ _run_sub_test_lib_test_common () {
 		. "\$TEST_DIRECTORY"/test-lib.sh
 		EOF
 		cat >>"$name.sh" &&
-		chmod +x "$name.sh" &&
 		export TEST_DIRECTORY &&
 		TEST_OUTPUT_DIRECTORY=$(pwd) &&
 		export TEST_OUTPUT_DIRECTORY &&
@@ -102,7 +99,7 @@ _run_sub_test_lib_test_common () {
 		then
 			./"$name.sh" "$@" >out 2>err
 		else
-			!  ./"$name.sh" "$@" >out 2>err
+			! ./"$name.sh" "$@" >out 2>err
 		fi
 	)
 }
Signature · 1 line
2.26.2.686.gfaf46a9ccd
#1 lore raw
Quoted 3 lines · Carlo Marcelo Arenas Belón

3f824e91c8 (t/Makefile: introduce TEST_SHELL_PATH, 2017-12-08) allows for setting a shell for running the tests, but the generated subtests weren't updated.

Yeah, this makes sense. The primary benefit of $TEST_SHELL_PATH was to get better support for special testing options (like using bash's trace_fd with "-x"). But based on recent patches I guess you were wanting to test the behavior of an unusual shell. And if we're testing how the test framework runs, certainly using TEST_SHELL_PATH is the most sensible thing.

-Peff