1#! /bin/sh
2# Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>.
16
17# TAP support:
18#  - out-of-order test results
19
20. test-init.sh
21
22. tap-setup.sh
23
24cat > a.test <<END
251..3
26ok
27not ok 2 # TODO
28ok 71
29END
30
31cat > b.test <<END
321..5
33ok 1
34ok 2
35ok 4 foo # SKIP mu
36not ok 2 bar # TODO um
37ok 5
38END
39
40cat > c.test <<END
411..4
42ok 1
43ok foo
44ok 4 - zardoz
45not ok 3
46END
47
48# This is documented as an "test out of sequence" error in the
49# TAP::Parser documentation.  Keep it in sync with the example
50# there.
51cat > d.test <<'END'
521..5
53ok 1
54ok 2
55ok 15
56ok 16
57ok 17
58END
59
60run_make -O -e FAIL TESTS='a.test b.test c.test d.test' check
61count_test_results total=17 pass=8 fail=0 xpass=0 xfail=1 skip=0 error=8
62
63test $($FGREP -c ': a.test' stdout) -eq 3
64test $($FGREP -c ': b.test' stdout) -eq 5
65test $($FGREP -c ': c.test' stdout) -eq 4
66test $($FGREP -c ': d.test' stdout) -eq 5
67
68grep '^ERROR: a\.test 71 # OUT-OF-ORDER (expecting 3)$' stdout
69grep '^ERROR: b\.test 4 foo # OUT-OF-ORDER (expecting 3)$' stdout
70grep '^ERROR: b\.test 2 bar # OUT-OF-ORDER (expecting 4)$' stdout
71grep '^ERROR: c\.test 4 - zardoz # OUT-OF-ORDER (expecting 3)$' stdout
72grep '^ERROR: c\.test 3 # OUT-OF-ORDER (expecting 4)$' stdout
73grep '^ERROR: d\.test 15 # OUT-OF-ORDER (expecting 3)$' stdout
74grep '^ERROR: d\.test 16 # OUT-OF-ORDER (expecting 4)$' stdout
75grep '^ERROR: d\.test 17 # OUT-OF-ORDER (expecting 5)$' stdout
76
77:
78