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