From: "SZEDER Gábor" <szeder.dev@gmail.com>
To: git@vger.kernel.org
Cc: "Jeff King" <peff@peff.net>, "SZEDER Gábor" <szeder.dev@gmail.com>
Subject: [PATCH 0/3] Teach 'test_must_fail' to save the command's stderr to a file
Date: Fri, 9 Feb 2018 03:42:32 +0100 [thread overview]
Message-ID: <20180209024235.3431-1-szeder.dev@gmail.com> (raw)
To check that a git command fails with the expected error message, we
usually execute a command like this:
test_must_fail git command --option 2>output.err
Alas, this command doesn't limit the redirection to the git command,
but it redirects the standard error of the 'test_must_fail' helper
function as well, causing various issues discussed in detail in the
second patch. Therefore that patch introduces the 'test_must_fail
stderr=<file>' option to save the executed git command's standard
error to the given file.
The last patch converts one test script to use 'test_must_fail
stderr=<file>' to demonstrate its benefits: thereafter that script
will succeed with '-x'. There are plenty more places to convert:
$ git grep -E 'test_(must|might)_fail .* 2>' t/*.sh |wc -l
430
$ git grep --name-only -E 'test_(must|might)_fail .* 2>' t/*.sh |wc -l
135
... and this doesn't even count commands spanning more lines, and
there are more in 'pu'.
I didn't convert more test scripts, because it's boring ;) but more
importantly because it could give us 135+ GSoC micro projects.
SZEDER Gábor (3):
t: document 'test_must_fail ok=<signal-name>'
t: teach 'test_must_fail' to save the command's stderr to a file
t1404: use 'test_must_fail stderr=<file>'
t/README | 20 +++++++++++++++++--
t/t1404-update-ref-errors.sh | 46 ++++++++++++++++++++++----------------------
t/test-lib-functions.sh | 45 +++++++++++++++++++++++++++++++++----------
3 files changed, 76 insertions(+), 35 deletions(-)
--
2.16.1.180.g07550b0b1b
next reply other threads:[~2018-02-09 2:43 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-09 2:42 SZEDER Gábor [this message]
2018-02-09 2:42 ` [PATCH 1/3] t: document 'test_must_fail ok=<signal-name>' SZEDER Gábor
2018-02-09 2:42 ` [PATCH 2/3] t: teach 'test_must_fail' to save the command's stderr to a file SZEDER Gábor
2018-02-09 3:11 ` Eric Sunshine
2018-02-09 14:21 ` Jeff King
2018-02-09 18:36 ` Junio C Hamano
2018-02-09 18:57 ` Jeff King
2018-02-09 19:03 ` Jeff King
2018-02-23 23:26 ` SZEDER Gábor
2018-02-09 2:42 ` [PATCH 3/3] t1404: use 'test_must_fail stderr=<file>' SZEDER Gábor
2018-02-09 3:16 ` Eric Sunshine
2018-02-09 3:33 ` SZEDER Gábor
2018-02-09 18:22 ` Junio C Hamano
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=20180209024235.3431-1-szeder.dev@gmail.com \
--to=szeder.dev@gmail.com \
--cc=git@vger.kernel.org \
--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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.