On Sat, Mar 18, 2017 at 05:13:59PM +0100, SZEDER Gábor wrote:
> 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.
>
> [...]
>
> debug () {
> - GIT_TEST_GDB=1 "$@"
> + GIT_TEST_GDB=1 "$@" <&6 >&5 2>&7
> }
Yep, this looks fine to me.
> diff --git a/t/test-lib.sh b/t/test-lib.sh
> index 86d77c16d..23c29bce6 100644
> --- a/t/test-lib.sh
> +++ b/t/test-lib.sh
> @@ -342,6 +342,7 @@ fi
>
> exec 5>&1
> exec 6<&0
> +exec 7>&2
And this obviously is required to keep stdout/stderr separate.
-Peff