maint: Update copyright years to 2018
[automake.git] / t / tap-planskip.sh
blob488aa78d93c736e25f28d7baba1c3395fcdf6883
1 #! /bin/sh
2 # Copyright (C) 2011-2018 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
7 # any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <https://www.gnu.org/licenses/>.
17 # Basic TAP test protocol support:
18 # - special plan format to skip all the tests in a script
20 . test-init.sh
22 . tap-setup.sh
24 weirdchars=\''"$!&()[]<>#;^?*/@%=,.:'
26 cat > foo.test <<END
27 1..0
28 END
30 cat > bar.test <<END
31 blah
32 # blah
33 1..0$tab $tab
34 END
36 # It is undefined whether the comment after the plan below should
37 # count as an explanation; still, the test should be skipped.
38 cat > baz.test <<END
39 1..0 # WWW::Mechanize not installed
40 other
41 junk
42 lines
43 END
45 cat > wget.test <<END
46 1..0 # SKIP wget(1) not installed
47 # See also curl.test
48 END
50 cat > curl.test <<END
51 1..0 # SKIP: Can't connect to gnu.org!
52 # See also wget.test
53 END
55 cat > mu.test <<END
56 1..0 # SKIP $weirdchars
57 END
59 run_make -O check \
60 TESTS='foo.test bar.test baz.test wget.test curl.test mu.test'
61 count_test_results total=6 pass=0 fail=0 xpass=0 xfail=0 skip=6 error=0
63 # Look for a regression where the "1..0" wasn't being stripped from the
64 # SKIP message.
65 $FGREP '1..0' stdout && exit 1
67 grep '^SKIP: foo\.test$' stdout
68 grep '^SKIP: bar\.test$' stdout
69 grep '^SKIP: baz\.test' stdout # Deliberately laxer, see above for why.
70 grep '^SKIP: wget\.test .* wget(1) not installed$' stdout
71 grep '^SKIP: curl\.test .* Can'\''t connect to gnu\.org!$' stdout
72 grep '^SKIP: mu\.test' stdout | $FGREP "$weirdchars" stdout
73 test $(grep -c ': .*\.test' stdout) -eq 6