test harness: improve catching of usage errors in script 'test-driver'
[platform/upstream/automake.git] / t / tap-todo-skip.sh
1 #! /bin/sh
2 # Copyright (C) 2011-2013 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 # TAP support:
18 #  - TODO and SKIP directives are case-insensitive
19 #  - TODO and SKIP directives can be followed optionally by a colon ":"
20 #    and by an optional explanation.
21 #  - our driver isn't fooled into recognizing TODO and SKIP directives
22 #    spuriously
23 #  - the reasons for TODO and SKIP, if present, are nicely printed in
24 #    the testsuite progress output
25
26 . test-init.sh
27
28 . tap-setup.sh
29
30 # ----------------------------------------------------- #
31 #  Check all possible combinations of:                  #
32 #    - uppercase/lowercase                              #
33 #    - with/without colon character ":"                 #
34 #    - with/without explanatory message                 #
35 #  in TODO and SKIP directives.                         #
36 # ----------------------------------------------------- #
37
38 # There are 2 * 2^6 + 2 * 2^6 = 256 tests.
39 echo 1..256 > all.test
40
41 # These nested loops are clearer without indentation.
42
43 for c1 in t T; do
44 for c2 in o O; do
45 for c3 in d D; do
46 for c4 in o O; do
47 for ex in '' ':' ' foo' ': foo'; do
48   echo "not ok # $c1$c2$c3$c4$ex"
49   echo "not ok# $c1$c2$c3$c4$ex"
50 done; done; done; done; done >> all.test
51
52 for c1 in s S; do
53 for c2 in k K; do
54 for c3 in i I; do
55 for c4 in p P; do
56 for ex in '' ':' ' foo' ': foo'; do
57   echo "ok # $c1$c2$c3$c4$ex"
58   echo "ok# $c1$c2$c3$c4$ex"
59 done; done; done; done; done >> all.test
60
61 cat all.test # For debugging.
62
63 run_make -O check
64 count_test_results total=256 pass=0 fail=0 xpass=0 xfail=128 skip=128 error=0
65
66 # -------------------------------------------------------- #
67 #  TODO ans SKIP directives aren't recognized spuriously.  #
68 # -------------------------------------------------------- #
69
70 cat > all.test <<'END'
71 1..9
72 ok TODO
73 ok - TODO
74 ok 3 TODO
75 ok 4 - TODO
76 ok SKIP
77 ok - SKIP
78 ok 7 SKIP
79 ok 8 - SKIP
80 ok 9
81 END
82
83 run_make -O check
84 count_test_results total=9 pass=9 fail=0 xpass=0 xfail=0 skip=0 error=0
85
86 :