git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"GIT Mailing-list" <git@vger.kernel.org>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: Re: [RFC/PATCH] t3300-*.sh: Fix a TAP parse error
Date: Sat, 21 Jul 2012 13:20:49 -0500	[thread overview]
Message-ID: <20120721182049.GL19860@burratino> (raw)
In-Reply-To: <500AEB11.4050006@ramsay1.demon.co.uk>

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

Ramsay Jones wrote:

>     $ ./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:

[...]
> --- 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

  reply	other threads:[~2012-07-21 18:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-21 17:46 [RFC/PATCH] t3300-*.sh: Fix a TAP parse error Ramsay Jones
2012-07-21 18:20 ` Jonathan Nieder [this message]
2012-07-24 18:34   ` Ramsay Jones
2012-07-24 19:21     ` Jonathan Nieder
2012-07-25 18:36       ` Ramsay Jones
2012-07-24 19:57     ` Junio C Hamano
2012-07-25 19:07       ` Ramsay Jones
2012-07-25 20:51         ` Jonathan Nieder
2012-07-25 22:08           ` Junio C Hamano
2012-07-28 18:12             ` Ramsay Jones
2012-07-28 18:03           ` Ramsay Jones
2012-08-16 23:40           ` Junio C Hamano
2012-08-19 17:57             ` Ramsay Jones

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=20120721182049.GL19860@burratino \
    --to=jrnieder@gmail.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=ramsay@ramsay1.demon.co.uk \
    /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 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 NNTP newsgroup(s).