subdirs: don't return false positives for the '-k' option's presence
[platform/upstream/automake.git] / t / tap-numbers-leading-zero.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 #  - how does TAP result numbers with leading zero fares?
19
20 . test-init.sh
21
22 . tap-setup.sh
23
24 do_checks ()
25 {
26   $MAKE check >stdout && { cat stdout; exit 1; }
27   cat stdout
28   count_test_results "$@"
29   # Allow some normalization of leading zeros, without forcing it.
30   LC_ALL=C sed -n 's/: all\.test 0*\([0-9]\)/: all.test \1/p' stdout > got
31   cat exp
32   cat got
33   diff exp got
34 }
35
36 cat > all.test <<END
37 1..15
38
39 ok 01
40 ok 0002
41
42 not ok 03
43 not ok 0004
44
45 ok 05 # SKIP
46 ok 0006 # SKIP
47
48 not ok 07 # TODO
49 not ok 0008 # TODO
50
51 ok 009
52 ok 010
53
54 ok 00000011
55 not ok 0012
56 ok 00000013 # SKIP
57 not ok 0014 # TODO
58 ok 00000015 # TODO
59 END
60
61 cat > exp <<END
62 PASS: all.test 1
63 PASS: all.test 2
64 FAIL: all.test 3
65 FAIL: all.test 4
66 SKIP: all.test 5 # SKIP
67 SKIP: all.test 6 # SKIP
68 XFAIL: all.test 7 # TODO
69 XFAIL: all.test 8 # TODO
70 PASS: all.test 9
71 PASS: all.test 10
72 PASS: all.test 11
73 FAIL: all.test 12
74 SKIP: all.test 13 # SKIP
75 XFAIL: all.test 14 # TODO
76 XPASS: all.test 15 # TODO
77 END
78
79 do_checks total=15 pass=5 fail=3 xpass=1 xfail=3 skip=3 error=0
80
81 cat > all.test <<END
82 1..8
83
84 ok 010
85 not ok 003
86 ok 0001 # SKIP
87 not ok 010 # TODO
88 ok 00100 # TODO
89
90 ok 06
91 ok 00007
92 ok 8
93 END
94
95 cat > exp <<END
96 ERROR: all.test 10 # OUT-OF-ORDER (expecting 1)
97 ERROR: all.test 3 # OUT-OF-ORDER (expecting 2)
98 ERROR: all.test 1 # OUT-OF-ORDER (expecting 3)
99 ERROR: all.test 10 # OUT-OF-ORDER (expecting 4)
100 ERROR: all.test 100 # OUT-OF-ORDER (expecting 5)
101 PASS: all.test 6
102 PASS: all.test 7
103 PASS: all.test 8
104 END
105
106 do_checks total=8 pass=3 fail=0 xpass=0 xfail=0 skip=0 error=5
107
108 :