tests: create an interactive gdb session with the 'debug' helper

The 'debug' test helper is supposed to facilitate debugging by running a command of the test suite under gdb. Unfortunately, its usefulness is severely limited, because that gdb session is not interactive, since the test's, and thus gdb's standard input is redirected from /dev/null (for a good reason, see 781f76b15 (test-lib: redirect stdin of tests, 2011-12-15)). Redirect gdb's standard file descriptors from/to the test environment's stdin, stdout and stderr in the 'debug' helper, thus creating an interactive gdb session (even in non-verbose mode), which is much, much more useful. Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

SZEDER Gábor committed Mar 18, 2017 at 17:13 UTC 4ecae3c8c182a7d3bd27b6e0e0afd0000f825d8e
2 files changed +2 -1
t/test-lib-functions.sh
+1 -1
@@ -154,7 +154,7 @@ test_pause () {
154 #
155 # Example: "debug git checkout master".
156 debug () {
157 - GIT_TEST_GDB=1 "$@"
157 + GIT_TEST_GDB=1 "$@" <&6 >&5 2>&7
158 }
159
160 # Call test_commit with the arguments
t/test-lib.sh
+1
@@ -342,6 +342,7 @@ fi
342
343 exec 5>&1
344 exec 6<&0
345 +exec 7>&2
346 if test "$verbose_log" = "t"
347 then
348 exec 3>>"$GIT_TEST_TEE_OUTPUT_FILE" 4>&3