git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Johannes Schindelin <johannes.schindelin@gmx.de>, git@vger.kernel.org
Subject: Re: [PATCH 2/2] t3404: be resilient against running with the -x flag
Date: Tue, 10 May 2016 16:58:01 -0400	[thread overview]
Message-ID: <20160510205800.GC19958@sigill.intra.peff.net> (raw)
In-Reply-To: <xmqqshxpofqh.fsf@gitster.mtv.corp.google.com>

On Tue, May 10, 2016 at 12:49:42PM -0700, Junio C Hamano wrote:

> I wonder if we can fix "-x" instead so that we do not have to
> butcher tests like this patch does.  It was quite clear what it
> expected to see before this patch, and it is sad that the workaround
> makes less readable (and relies on the real output we are looking
> for never begins with '+').

I don't think there is a scalable, portable way to do so. "-x" output is
going to stderr, and is inherited by any functions or subshells. So
either we have to ask "-x" output to go somewhere else, or we have to
turn it off inside the functions and subshells. The latter requires
tweaking each site, which isn't scalable. And there is no way to do the
former in a portable way (AFAIK).

That being said, bash supports BASH_XTRACEFD, so maybe something like
this:

diff --git a/t/test-lib.sh b/t/test-lib.sh
index 286c5f3..482ec11 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -321,6 +321,7 @@ then
 else
 	exec 4>/dev/null 3>/dev/null
 fi
+BASH_XTRACEFD=4
 
 test_failure=0
 test_count=0

would help Dscho's case (and people on other shells aren't helped, but
they are not hurt either).

-Peff

  reply	other threads:[~2016-05-10 20:58 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-10 13:59 [PATCH 0/2] Work on t3404 in preparation for rebase--helper Johannes Schindelin
2016-05-10 14:05 ` [PATCH 1/2] t3404: fix typo Johannes Schindelin
2016-05-10 14:07 ` [PATCH 2/2] t3404: be resilient against running with the -x flag Johannes Schindelin
2016-05-10 19:49   ` Junio C Hamano
2016-05-10 20:58     ` Jeff King [this message]
2016-05-10 21:13       ` Junio C Hamano
2016-05-10 21:32         ` [PATCH] test-lib: set BASH_XTRACEFD automatically Jeff King
2016-05-10 22:06           ` Junio C Hamano
2016-05-11 13:44             ` [PATCH v2] " Jeff King
2016-05-12 15:39               ` Johannes Schindelin
2016-05-12 15:43 ` [PATCH v2 0/2] Work on t3404 in preparation for rebase--helper Johannes Schindelin
2016-05-12 15:44   ` [PATCH v2 1/2] t3404: fix typo Johannes Schindelin
2016-05-12 15:44   ` [PATCH v2 2/2] test-lib: set BASH_XTRACEFD automatically Johannes Schindelin
2016-05-12 16:21   ` [PATCH v2 0/2] Work on t3404 in preparation for rebase--helper Junio C Hamano
2016-05-13  6:37     ` Johannes Schindelin
2016-05-13 17:57       ` Junio C Hamano
2016-05-16  6:33         ` Johannes Schindelin

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20160510205800.GC19958@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).