Skip to content

Commit 5c658f4

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 a9b3c2b commit 5c658f4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

t/test-lib.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
# for git on windows so stdin will not be misdetected as attached to a
1919
# terminal
20+
test -z "$TEST_NO_REDIRECT" ||
2021
exec < /dev/null
2122

2223
# Keep the original TERM for say_color
@@ -524,7 +525,12 @@ maybe_setup_valgrind () {
524525
test_eval_ () {
525526
# This is a separate function because some tests use
526527
# "return" to end a test_expect_success block early.
527-
eval </dev/null >&3 2>&4 "$*"
528+
if test -z "$TEST_NO_REDIRECT"
529+
then
530+
eval </dev/null >&3 2>&4 "$*"
531+
else
532+
eval "$*"
533+
fi
528534
}
529535

530536
test_run_ () {

0 commit comments

Comments
 (0)