doc: typos in test file.
[automake.git] / t / parallel-tests-harderror.sh
blob315bb5337d19a72833a70b5493bbfc68b3fe8ac3
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 # Check parallel-tests features: DISABLE_HARD_ERRORS
19 . test-init.sh
21 cat >> configure.ac << 'END'
22 AC_CONFIG_FILES([sub/Makefile])
23 AC_OUTPUT
24 END
26 mkdir sub
28 cat > Makefile.am << 'END'
29 SUBDIRS = . sub
30 TESTS = foo.test
31 XFAIL_TESTS = foo.test
32 EXTRA_DIST = $(TESTS)
33 END
35 cat > sub/Makefile.am << 'END'
36 TESTS = bar.test
37 XFAIL_TESTS = $(TESTS)
38 EXTRA_DIST = $(TESTS)
39 END
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
48 $ACLOCAL
49 $AUTOCONF
50 $AUTOMAKE -a
52 ./configure
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
64 # But an empty values for DISABLE_HARD_ERRORS means that hard errors
65 # are not to be counted like normal failures.
67 $MAKE check DISABLE_HARD_ERRORS= && exit 1
68 cat test-suite.log
69 grep '^ERROR: foo$' test-suite.log
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 ..
77 # Check the distributions.
78 $MAKE DISABLE_HARD_ERRORS=y distcheck
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.
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
91 echo 'DISABLE_HARD_ERRORS = zardoz' >> sub/Makefile
92 VERBOSE=yes $MAKE check