tests: rename 'tests/' => 't/', '*.test' => '*.sh'
[platform/upstream/automake.git] / t / tap-planskip.sh
1 #! /bin/sh
2 # Copyright (C) 2011-2012 Free Software Foundation, Inc.
3 #
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.
8 #
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.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17 # Basic TAP test protocol support:
18 #  - special plan format to skip all the tests in a script
19
20 am_parallel_tests=yes
21 . ./defs || Exit 1
22
23 . "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
24
25 weirdchars=\''"$!&()[]<>#;^?*/@%=,.:'
26
27 cat > foo.test <<END
28 1..0
29 END
30
31 cat > bar.test <<END
32 blah
33 # blah
34 1..0$tab $tab
35 END
36
37 # It is undefined whether the comment after the plan below should
38 # count as an explanation; still, the test should be skipped.
39 cat > baz.test <<END
40 1..0 # WWW::Mechanize not installed
41 other
42     junk
43        lines
44 END
45
46 cat > wget.test <<END
47 1..0 # SKIP wget(1) not installed
48 # See also curl.test
49 END
50
51 cat > curl.test <<END
52 1..0 # SKIP: Can't connect to gnu.org!
53 # See also wget.test
54 END
55
56 cat > mu.test <<END
57 1..0 # SKIP $weirdchars
58 END
59
60 env TESTS='foo.test bar.test baz.test wget.test curl.test mu.test' \
61   $MAKE -e check >stdout || { cat stdout; Exit 1; }
62 cat stdout
63
64 count_test_results total=6 pass=0 fail=0 xpass=0 xfail=0 skip=6 error=0
65
66 # Look for a regression where the "1..0" wasn't being stripped from the
67 # SKIP message.
68 $FGREP '1..0' stdout && Exit 1
69
70 grep '^SKIP: foo\.test$' stdout
71 grep '^SKIP: bar\.test$' stdout
72 grep '^SKIP: baz\.test' stdout # Deliberately laxer, see above for why.
73 grep '^SKIP: wget\.test .* wget(1) not installed$' stdout
74 grep '^SKIP: curl\.test .* Can'\''t connect to gnu\.org!$' stdout
75 grep '^SKIP: mu\.test' stdout | $FGREP "$weirdchars" stdout
76 test `grep -c ': .*\.test' stdout` -eq 6
77
78 :