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

Re: [RFC/PATCH] t3300-*.sh: Fix a TAP parse error

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jul 21, 2012, 18:20 UTC
Message-ID
<20120721182049.GL19860@burratino>
In-Reply-To
<500AEB11.4050006@ramsay1.demon.co.uk>

(cc-ing Ævar, TAP wizard) Hi,

Ramsay Jones wrote:
Show 8 quoted lines
>     $ ./t3300-funny-names.sh
>     ok 1 - setup
>     # passed all 1 test(s)
>     1..1 # SKIP Your filesystem does not allow tabs in filenames
>     $
>
> Unfortunately, this is not valid TAP output, which prove notes
> as follows:
[...]
>       Parse errors: No plan found in TAP output
[...]
> This is an RFC because I suspect some people may prefer the much
> simpler patch:
[...]
>      	# since FAT/NTFS does not allow tabs in filenames, skip this test
>     -	skip_all='Your filesystem does not allow tabs in filenames'
>     +	say '# SKIP Your filesystem does not allow tabs in filenames'
>      	test_done
[...]
> ... the output of which looks like:
[...]
>     ok 1 - setup
>     # SKIP Your filesystem does not allow tabs in filenames
>     # passed all 1 test(s)
>     1..1
[..]
> Needless to say, I much prefer the patch below. :-D

Thanks for a nice explanation. In general I definitely like getting rid of these setup tests when possible. Let's see:

[...]
Show 17 quoted lines
> --- a/t/t3300-funny-names.sh
> +++ b/t/t3300-funny-names.sh
> @@ -15,28 +15,20 @@ p0='no-funny'
>  p1='tabs	," (dq) and spaces'
>  p2='just space'
>  
> -test_expect_success 'setup' '
> -	cat >"$p0" <<-\EOF &&
> -	1. A quick brown fox jumps over the lazy cat, oops dog.
> -	2. A quick brown fox jumps over the lazy cat, oops dog.
> -	3. A quick brown fox jumps over the lazy cat, oops dog.
> -	EOF
> +cat >"$p0" <<\EOF
> +1. A quick brown fox jumps over the lazy cat, oops dog.
> +2. A quick brown fox jumps over the lazy cat, oops dog.
> +3. A quick brown fox jumps over the lazy cat, oops dog.
> +EOF

The problem is that on platforms not supporting funny filenames, it will write a complaint to stderr and because the code is not guarded by test_expect_success, that output goes to the terminal. So I think this is a wrong approach.

Would it make sense to avoid the "# SKIP" comment when a test has been run, like this?

diff --git i/t/test-lib.sh w/t/test-lib.sh
index acda33d1..038f6e9f 100644
--- i/t/test-lib.sh
+++ w/t/test-lib.sh
@@ -354,6 +354,11 @@ test_done () {
 	case "$test_failure" in
 	0)
 		# Maybe print SKIP message
+		if test -n "$skip_all" && test "$test_count" != 0
+		then
+			say "# SKIP $skill_all"
+			skip_all=
+		fi
 		[ -z "$skip_all" ] || skip_all=" # SKIP $skip_all"
 
 		if test $test_external_has_tap -eq 0; then
Previous: Ramsay JonesNext: Ramsay Jones
Message 2 of 13 in “t3300-*.sh: Fix a TAP parse error”
  1. t3300-*.sh: Fix a TAP parse errorRamsay Jones, Jul 21, 2012
  2. Jonathan NiederJul 21, 2012
  3. Ramsay JonesJul 24, 2012
  4. Jonathan NiederJul 24, 2012
  5. Ramsay JonesJul 25, 2012
  6. Junio C HamanoJul 24, 2012
  7. Ramsay JonesJul 25, 2012
  8. Jonathan NiederJul 25, 2012
  9. Junio C HamanoJul 25, 2012
  10. Ramsay JonesJul 28, 2012
  11. Ramsay JonesJul 28, 2012
  12. Junio C HamanoAug 16, 2012
  13. Ramsay JonesAug 19, 2012

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.