(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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to