maint: run "make update-copyright"
[platform/upstream/automake.git] / tests / tap-bailout-leading-space.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 # Older versions of prove and TAP::Harness (e.g., 3.17) didn't recognize
18 # a "Bail out!" directive that was preceded by whitespace, but more modern
19 # versions (e.g., 3.23) do.  So we leave this behaviour undefined for the
20 # perl implementation of the Automake TAP driver, but expect the latter,
21 # "more modern" behaviour in our awk TAP driver.
22
23 am_parallel_tests=yes
24 am_tap_implementation=shell
25 . ./defs || Exit 1
26
27 . "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
28
29 cat > a.test <<END
30 1..1
31 ok 1
32  Bail out!
33 END
34
35 cat > b.test <<END
36 1..1
37 ok 1 # SKIP
38 ${tab}Bail out!
39 END
40
41 cat > c.test <<END
42 1..1
43   ${tab}  ${tab}${tab}Bail out!   FUBAR! $tab
44 END
45
46 cat >> exp <<END
47 PASS: a.test 1
48 ERROR: a.test - Bail out!
49 SKIP: b.test 1
50 ERROR: b.test - Bail out!
51 ERROR: c.test - Bail out! FUBAR!
52 END
53
54 TESTS='a.test b.test c.test' $MAKE -e check >stdout \
55   && { cat stdout; Exit 1; }
56 cat stdout
57
58 count_test_results total=5 pass=1 fail=0 xpass=0 xfail=0 skip=1 error=3
59
60 LC_ALL=C sort exp > t
61 mv -f t exp
62
63 # We need the sort below to account for parallel make usage.
64 grep ': [abcde]\.test' stdout \
65   | sed "s/[ $tab]*#[ $tab]*SKIP.*//" \
66   | LC_ALL=C sort > got
67
68 cat exp
69 cat got
70 diff exp got
71
72 :