Skip to content

Commit 4d5a7c0

Browse files
committed
Tests: optionally skip redirecting stdin/stdout/stderr
There is a really useful debugging technique developed by Sverre Rabbelier that inserts "bash &&" somewhere in the test scripts, letting the developer interact at given points with the current state. Another debugging technique, used a lot by this here coder, is to run certain executables via gdb by guarding a "gdb -args" call in bin-wrappers/git. Both techniques were disabled by 781f76b(test-lib: redirect stdin of tests). Let's reinstate the ability to run an interactive shell by making the redirection optional: setting the TEST_NO_REDIRECT environment variable will skip the redirection. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 88db477 commit 4d5a7c0

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

t/test-lib.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,20 @@ test_eval_ () {
568568
#
569569
# The test itself is run with stderr put back to &4 (so either to
570570
# /dev/null, or to the original stderr if --verbose was used).
571+
if test -n "$TEST_NO_REDIRECT"
572+
then
573+
test_eval_inner_ "$@"
574+
test_eval_ret_=$?
575+
if test "$trace" = t
576+
then
577+
set +x
578+
if test "$test_eval_ret_" != 0
579+
then
580+
say_color error >&4 "error: last command exited with \$?=$test_eval_ret_"
581+
fi
582+
fi
583+
return $test_eval_ret_
584+
fi
571585
{
572586
test_eval_inner_ "$@" </dev/null >&3 2>&4
573587
test_eval_ret_=$?

0 commit comments

Comments
 (0)