git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 0/3] Teach 'test_must_fail' to save the command's stderr to a file

From
SZEDER Gábor <szeder.dev@gmail.com>
Date
Feb 9, 2018, 02:42 UTC
Message-ID
<20180209024235.3431-1-szeder.dev@gmail.com>
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: SZEDER Gábor
Message 1 of 13 in “Teach 'test_must_fail' to save the command's stderr to a file”
  1. 0/3 Teach 'test_must_fail' to save the command's stderr to a fileSZEDER Gábor, Feb 9, 2018
  2. 1/3 t: document 'test_must_fail ok=<signal-name>'SZEDER Gábor, Feb 9, 2018
  3. 2/3 t: teach 'test_must_fail' to save the command's stderr to a fileSZEDER Gábor, Feb 9, 2018
  4. Eric SunshineFeb 9, 2018
  5. Jeff KingFeb 9, 2018
  6. Junio C HamanoFeb 9, 2018
  7. Jeff KingFeb 9, 2018
  8. Jeff KingFeb 9, 2018
  9. SZEDER GáborFeb 23, 2018
  10. 3/3 t1404: use 'test_must_fail stderr=<file>'SZEDER Gábor, Feb 9, 2018
  11. Eric SunshineFeb 9, 2018
  12. SZEDER GáborFeb 9, 2018
  13. Junio C HamanoFeb 9, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.