tests: avoid a spurious failure on MSYS
[platform/upstream/automake.git] / t / parallel-tests-harderror.sh
1 #! /bin/sh
2 # Copyright (C) 2011-2013 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 # Check parallel-tests features: DISABLE_HARD_ERRORS
18
19 . test-init.sh
20
21 cat >> configure.ac << 'END'
22 AC_CONFIG_FILES([sub/Makefile])
23 AC_OUTPUT
24 END
25
26 mkdir sub
27
28 cat > Makefile.am << 'END'
29 SUBDIRS = . sub
30 TESTS = foo.test
31 XFAIL_TESTS = foo.test
32 EXTRA_DIST = $(TESTS)
33 END
34
35 cat > sub/Makefile.am << 'END'
36 TESTS = bar.test
37 XFAIL_TESTS = $(TESTS)
38 EXTRA_DIST = $(TESTS)
39 END
40
41 cat > foo.test <<'END'
42 #! /bin/sh
43 exit 99
44 END
45 chmod a+x foo.test
46 cp foo.test sub/bar.test
47
48 $ACLOCAL
49 $AUTOCONF
50 $AUTOMAKE -a
51
52 ./configure
53
54 # DISABLE_HARD_ERRORS is not defined as a make variable, so that it
55 # should be possible to define either from the environment or from
56 # command-line, also when recursive make invocations are involved,
57 # and also without using the '-e' make flag; this should work also
58 # for non-GNU make. Moreover, it shouldn't be necessary to define
59 # DISABLE_HARD_ERRORS to "yes" to really disable hard errors: any
60 # non-empty value should do.
61 $MAKE check DISABLE_HARD_ERRORS=yes
62 DISABLE_HARD_ERRORS=x $MAKE check
63
64 # But an empty values for DISABLE_HARD_ERRORS means that hard errors
65 # are not to be counted like normal failures.
66
67 $MAKE check DISABLE_HARD_ERRORS= && exit 1
68 cat test-suite.log
69 grep '^ERROR: foo$' test-suite.log
70
71 cd sub
72 $MAKE check DISABLE_HARD_ERRORS= && exit 1
73 cat test-suite.log
74 grep '^ERROR: bar$' test-suite.log
75 cd ..
76
77 # Check the distributions.
78 $MAKE DISABLE_HARD_ERRORS=y distcheck
79
80 # Finally, DISABLE_HARD_ERRORS should work also when the developer
81 # sets it directly in Makefile.am or Makefile.  And its effects
82 # should remain local to that specific Makefile, obviously.
83
84 echo 'DISABLE_HARD_ERRORS = yes' >> Makefile.am
85 $AUTOMAKE Makefile
86 ./config.status Makefile
87 VERBOSE=yes $MAKE check && exit 1
88 grep '^FAIL' test-suite.log && exit 1
89 grep '^ERROR: bar$' sub/test-suite.log
90
91 echo 'DISABLE_HARD_ERRORS = zardoz' >> sub/Makefile
92 VERBOSE=yes $MAKE check
93
94 :