git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: "SZEDER Gábor" <szeder.dev@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
	Johannes Schindelin <johannes.schindelin@gmx.de>,
	git@vger.kernel.org
Subject: Re: [PATCHv2 1/2] tests: create an interactive gdb session with the 'debug' helper
Date: Mon, 20 Mar 2017 00:31:34 -0400	[thread overview]
Message-ID: <20170320043134.exaiz6adzcxp4zld@sigill.intra.peff.net> (raw)
In-Reply-To: <20170318161400.19753-1-szeder.dev@gmail.com>

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

  parent reply	other threads:[~2017-03-20  4:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-17 14:46 [PATCH] tests: create an interactive gdb session with the 'debug' helper SZEDER Gábor
2017-03-17 14:55 ` Jeff King
2017-03-18 16:10   ` SZEDER Gábor
2017-03-18 16:13     ` [PATCHv2 1/2] " SZEDER Gábor
2017-03-18 16:14       ` [PATCHv2 2/2] tests: make the 'test_pause' helper work in non-verbose mode SZEDER Gábor
2017-03-20  4:32         ` Jeff King
2017-03-20  4:31       ` Jeff King [this message]
2017-03-21 11:07       ` [PATCHv2 1/2] tests: create an interactive gdb session with the 'debug' helper Johannes Schindelin
2017-03-20  4:29     ` [PATCH] " Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170320043134.exaiz6adzcxp4zld@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    --cc=szeder.dev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).