test: protect more yacc declarations against C vs. C++ linkage.
[automake.git] / t / test-driver-fail.sh
blob51f30638c2160a137bd413781b1ac4f76592c75c
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 # Custom test drivers: what happens when a test driver fails? Well,
18 # "make check" should at least fail too, and the test-suite.log
19 # shouldn't be created. Unfortunately, we cannot truly control also
20 # the (non-)creation of individual test logs, since those are expected
21 # to be created by the drivers themselves, and an ill-behaved driver
22 # (like our dummy one in this test) might leave around a test log even
23 # in case of internal failures.
25 . test-init.sh
27 cat >> configure.ac <<'END'
28 AC_OUTPUT
29 END
31 cat > Makefile.am <<'END'
32 TEST_LOG_DRIVER = ./oops
33 TESTS = foo.test
34 END
36 cat > foo.test <<'END'
37 #! /bin/sh
38 exit 0
39 END
41 $ACLOCAL
42 $AUTOCONF
43 $AUTOMAKE
45 ./configure
47 # The testsuite driver does not exist.
48 $MAKE check && exit 1
49 test ! -e test-suite.log
51 # The testsuite driver exists and create the test log files, but fails.
53 cat > oops <<'END'
54 #!/bin/sh
55 : > foo.log
56 echo 'Oops, I fail!' >&2
57 exit 1
58 END
59 chmod a+x oops
61 $MAKE check && exit 1
62 test ! -e test-suite.log