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