maint: run "make update-copyright"
[platform/upstream/automake.git] / tests / tap-no-spurious-numbers.test
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 # TAP support:
18 #  - we shouldn't spuriously recognize as TAP result numbers what it
19 #    not, even if it seems pretty close
20
21 am_parallel_tests=yes
22 . ./defs || Exit 1
23
24 . "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
25
26 cat > prefixes <<'END'
27 A
28 a
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 >
59 END
60
61 n=`wc -l <prefixes`
62
63 # See the loop below to understand this initialization.
64 pass=`expr $n '*' 3`
65 fail=$pass
66 skip=`expr $pass - 3`
67 xfail=$skip
68 xpass=$xfail
69 error=0
70 total=`expr $pass + $fail + $skip + $xfail + $xpass`
71
72 echo 1..$total > all.test
73
74 highno=1000
75
76 for result in 'ok' 'not ok'; do
77   for spacing in "" " " "$tab"; do
78     subst="$result &$spacing$higno"
79     sed -e "s|.*|$subst|" prefixes
80     for directive in TODO SKIP; do
81       test "$result $directive" != "not ok SKIP" || continue
82       sed -e '/^#$/d' -e "s|.*|$subst # $directive|" prefixes
83     done
84   done
85 done >> all.test
86
87 cat all.test # For debugging.
88
89 # Sanity checks.
90 grep '#.*#' all.test && framework_failure_ "creating all.test"
91 test `wc -l <all.test` -lt $highno || framework_failure_ "creating all.test"
92
93 $MAKE check >stdout || :
94 cat stdout
95
96 count_test_results total=$total pass=$pass fail=$fail skip=$skip \
97                    xpass=$xpass xfail=$xfail error=$error
98
99 :