From 5c658f4f5b99b656ea9b6fedf77cd9b957f0579d Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 20 Feb 2015 14:21:04 +0000 Subject: [PATCH] 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 781f76b1(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 --- t/test-lib.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/t/test-lib.sh b/t/test-lib.sh index 20bd2ff348..f3736ccd0a 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -17,6 +17,7 @@ # for git on windows so stdin will not be misdetected as attached to a # terminal +test -z "$TEST_NO_REDIRECT" || exec < /dev/null # Keep the original TERM for say_color @@ -524,7 +525,12 @@ maybe_setup_valgrind () { test_eval_ () { # This is a separate function because some tests use # "return" to end a test_expect_success block early. - eval &3 2>&4 "$*" + if test -z "$TEST_NO_REDIRECT" + then + eval &3 2>&4 "$*" + else + eval "$*" + fi } test_run_ () {