tests: fix a failure in Lex/C++ tests on Mac OS X
[platform/upstream/automake.git] / t / tap-planskip-badexit.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 #  - an exit status != 0 of a test script causes an hard error, even if
19 #    the last line of output is a "SKIP plan" (e.g., "1..0 # SKIP").
20
21 am_parallel_tests=yes
22 . ./defs || Exit 1
23
24 echo TESTS = one.test two.test > Makefile.am
25
26 . "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
27
28 cat > one.test <<'END'
29 #!/bin/sh
30 echo '1..0 # SKIP'
31 exit 1
32 END
33
34 cat > two.test <<'END'
35 #!/bin/sh
36 echo '1..0'
37 exit 22
38 END
39
40 chmod a+x one.test two.test
41
42 $MAKE check >stdout && { cat stdout; Exit 1; }
43 cat stdout
44
45 # The 'prove' utility reports both the skip and the non-zero exit status,
46 # so we do the same.
47 count_test_results total=4 pass=0 fail=0 xpass=0 xfail=0 skip=2 error=2
48
49 grep '^ERROR: one\.test - exited with status 1$' stdout
50 grep '^ERROR: two\.test - exited with status 22$' stdout
51
52 :