From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Johannes Schindelin <johannes.schindelin@gmx.de>, git@vger.kernel.org
Subject: Re: [PATCH] test-lib: set BASH_XTRACEFD automatically
Date: Tue, 10 May 2016 15:06:59 -0700 [thread overview]
Message-ID: <xmqqd1otmut8.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20160510213218.GA27028@sigill.intra.peff.net> (Jeff King's message of "Tue, 10 May 2016 17:32:18 -0400")
Jeff King <peff@peff.net> writes:
> The patch itself is a trivial-looking one-liner, but there
> are a few subtleties worth mentioning:
>
> - the variable is _not_ exported; the "set -x" is local to
> our process, and so the tracefd should match
>
> - this line has to come after we do the redirection for fd
> 4, as bash will otherwise complain during the variable
> assignment
>
> - likewise, we cannot ever unset this variable, as it
> would close descriptor 4
>
> - setting it once here is sufficient to cover both the
> regular "-x" case (which implies "--verbose"), as well
> as "--verbose-only=1". This works because the latter
> flips "set -x" off and on for particular tests (if it
> didn't, we would get tracing for all tests, as going to
> descriptor 4 effectively circumvents the verbose flag).
Thanks. Some of them may deserve to be next to the one-liner to
prevent people from making changes that tickle them?
> Signed-off-by: Jeff King <peff@peff.net>
> ---
> t/README | 6 +++---
> t/test-lib.sh | 1 +
> 2 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/t/README b/t/README
> index 1dc908e..76a0daa 100644
> --- a/t/README
> +++ b/t/README
> @@ -84,9 +84,9 @@ appropriately before running "make".
>
> -x::
> Turn on shell tracing (i.e., `set -x`) during the tests
> - themselves. Implies `--verbose`. Note that this can cause
> - failures in some tests which redirect and test the
> - output of shell functions. Use with caution.
> + themselves. Implies `--verbose`. Note that in non-bash shells,
> + this can cause failures in some tests which redirect and test
> + the output of shell functions. Use with caution.
>
> -d::
> --debug::
> 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
next prev parent reply other threads:[~2016-05-10 22:07 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
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 [this message]
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=xmqqd1otmut8.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=johannes.schindelin@gmx.de \
--cc=peff@peff.net \
/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).