doc: update Vala documentation
[automake.git] / t / tap-bailout.sh
bloba804f4c7ed700272fe657e6a3e0a2c0825bda98d
1 #! /bin/sh
2 # Copyright (C) 2011-2024 Free Software Foundation, Inc.
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.
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.
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/>.
17 # Basic TAP test protocol support:
18 # - "Bail out!" magic
20 . test-init.sh
22 . tap-setup.sh
24 : > exp
26 #------------------------------------------------------------------
28 # Bailout without explanation.
30 cat > a.test <<END
31 1..4
32 ok 1
33 not ok 2
34 Bail out!
35 not ok 3
36 ok 4 # SKIP
37 END
39 cat >> exp <<END
40 PASS: a.test 1
41 FAIL: a.test 2
42 ERROR: a.test - Bail out!
43 END
45 # pass += 1, fail +=1, error += 1
47 #------------------------------------------------------------------
49 # Bailout with explanation.
51 cat > b.test <<END
52 1..7
53 ok 1 # SKIP
54 ok 2 # TODO
55 not ok 3 # TODO
56 Bail out! We're out of disk space.
57 ok 4
58 not ok 5
59 not ok 6 # TODO
60 ok 7 # TODO
61 END
63 cat >> exp <<END
64 SKIP: b.test 1 # SKIP
65 XPASS: b.test 2 # TODO
66 XFAIL: b.test 3 # TODO
67 ERROR: b.test - Bail out! We're out of disk space.
68 END
70 # skip += 1, xpass += 1, xfail += 1, error += 1
72 #------------------------------------------------------------------
74 # Bail out before the test plan.
76 cat > c.test <<END
77 ok 1
78 ok 2
79 Bail out! BOOOH!
80 1..2
81 END
83 cat >> exp <<END
84 PASS: c.test 1
85 PASS: c.test 2
86 ERROR: c.test - Bail out! BOOOH!
87 END
89 # pass += 2, error += 1
91 #------------------------------------------------------------------
93 # Bailout on the first line.
95 cat > d.test <<END
96 Bail out! mktemp -d: Permission denied
97 ok 1
98 END
100 echo 'ERROR: d.test - Bail out! mktemp -d: Permission denied' >> exp
102 # error += 1
104 #------------------------------------------------------------------
106 # TAP input comprised only of a bailout directive.
108 cat > e.test <<END
109 Bail out!
112 echo "ERROR: e.test - Bail out!" >> exp
114 # error += 1
116 #------------------------------------------------------------------
118 # Doing the sums above, we have:
119 test_counts='total=12 pass=3 fail=1 xpass=1 xfail=1 skip=1 error=5'
121 run_make -O -e FAIL TESTS='a.test b.test c.test d.test e.test' check
122 count_test_results $test_counts
124 LC_ALL=C sort exp > t
125 mv -f t exp
127 # We need the sort below to account for parallel make usage.
128 grep ': [abcde]\.test' stdout | LC_ALL=C sort > got
130 cat exp
131 cat got
132 diff exp got