Merge branch 'maint'
[platform/upstream/automake.git] / t / tap-out-of-order.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 # TAP support:
18 #  - out-of-order test results
19
20 am_parallel_tests=yes
21 . ./defs || Exit 1
22
23 . "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
24
25 cat > a.test <<END
26 1..3
27 ok
28 not ok 2 # TODO
29 ok 71
30 END
31
32 cat > b.test <<END
33 1..5
34 ok 1
35 ok 2
36 ok 4 foo # SKIP mu
37 not ok 2 bar # TODO um
38 ok 5
39 END
40
41 cat > c.test <<END
42 1..4
43 ok 1
44 ok foo
45 ok 4 - zardoz
46 not ok 3
47 END
48
49 # This is documented as an "test out of sequence" error in the
50 # TAP::Parser documentation.  Keep it in sync with the example
51 # there.
52 cat > d.test <<'END'
53 1..5
54 ok 1
55 ok 2
56 ok 15
57 ok 16
58 ok 17
59 END
60
61 TESTS='a.test b.test c.test d.test' $MAKE -e check >stdout \
62   && { cat stdout; Exit 1; }
63 cat stdout
64
65 count_test_results total=17 pass=8 fail=0 xpass=0 xfail=1 skip=0 error=8
66
67 test `$FGREP -c ': a.test' stdout` -eq 3
68 test `$FGREP -c ': b.test' stdout` -eq 5
69 test `$FGREP -c ': c.test' stdout` -eq 4
70 test `$FGREP -c ': d.test' stdout` -eq 5
71
72 grep '^ERROR: a\.test 71 # OUT-OF-ORDER (expecting 3)$' stdout
73 grep '^ERROR: b\.test 4 foo # OUT-OF-ORDER (expecting 3)$' stdout
74 grep '^ERROR: b\.test 2 bar # OUT-OF-ORDER (expecting 4)$' stdout
75 grep '^ERROR: c\.test 4 - zardoz # OUT-OF-ORDER (expecting 3)$' stdout
76 grep '^ERROR: c\.test 3 # OUT-OF-ORDER (expecting 4)$' stdout
77 grep '^ERROR: d\.test 15 # OUT-OF-ORDER (expecting 3)$' stdout
78 grep '^ERROR: d\.test 16 # OUT-OF-ORDER (expecting 4)$' stdout
79 grep '^ERROR: d\.test 17 # OUT-OF-ORDER (expecting 5)$' stdout
80
81 :