Teach 'test_must_fail' to save the command's stderr to a file
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest3 patches 9 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | t: document 'test_must_fail ok=<signal-name>'t/ t/ | +22 | 0 replies | |
| 2/3 | t: teach 'test_must_fail' to save the command's stderr to a filet/ t/ | +31 | 6 replies | |
| 3/3 | t1404: use 'test_must_fail stderr=<file>'t/ | +23 | 3 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/3] Teach 'test_must_fail' to save the command's stderr to a file
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(-)
Signature · 1 line
2.16.1.180.g07550b0b1b