tests: expose automake bug#14560
[platform/upstream/automake.git] / t / tap-no-spurious-numbers.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 #  - we shouldn't spuriously recognize as TAP result numbers what it
19 #    not, even if it seems pretty close
20
21 . test-init.sh
22
23 . tap-setup.sh
24
25 cat > prefixes <<'END'
26 A
27 a
28 _
29 +
30 -
31 =
32 /
33 *
34 .
35 :
36 ,
37 ;
38 $
39 @
40 %
41 &
42 #
43 ?
44 !
45 |
46 \
47 "
48 `
49 '
50 (
51 )
52 [
53 ]
54 {
55 }
56 <
57 >
58 END
59
60 n=$(wc -l <prefixes)
61
62 # See the loop below to understand this initialization.
63 pass=$(($n * 3))
64 fail=$pass
65 skip=$(($pass - 3))
66 xfail=$skip
67 xpass=$xfail
68 error=0
69 total=$(($pass + $fail + $skip + $xfail + $xpass))
70
71 echo 1..$total > all.test
72
73 highno=1000
74
75 for result in 'ok' 'not ok'; do
76   for spacing in "" " " "$tab"; do
77     subst="$result &$spacing$higno"
78     sed -e "s|.*|$subst|" prefixes
79     for directive in TODO SKIP; do
80       test "$result $directive" != "not ok SKIP" || continue
81       sed -e '/^#$/d' -e "s|.*|$subst # $directive|" prefixes
82     done
83   done
84 done >> all.test
85
86 cat all.test # For debugging.
87
88 # Sanity checks.
89 grep '#.*#' all.test \
90   && framework_failure_ "creating all.test"
91 test $(wc -l <all.test) -lt $highno \
92   || framework_failure_ "creating all.test"
93
94 run_make -O -e IGNORE check
95 count_test_results total=$total pass=$pass fail=$fail skip=$skip \
96                    xpass=$xpass xfail=$xfail error=$error
97
98 :