tests: never source test-defs.sh directly, source test-lib.sh instead
[automake.git] / t / check4.sh
blob946290f34c426f209172386d683d443c0a38006f
1 #! /bin/sh
2 # Copyright (C) 2005-2012 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 <http://www.gnu.org/licenses/>.
17 # Make sure 'make -k check' processes all directories.
19 # For gen-testsuite-part: ==> try-with-serial-tests <==
20 . ./defs || exit 1
22 cat >> configure.ac << 'END'
23 AC_CONFIG_FILES([dir/Makefile])
24 AC_OUTPUT
25 END
27 mkdir dir
29 cat > Makefile.am <<'END'
30 SUBDIRS = dir
31 TESTS = ok.sh
32 END
34 echo TESTS = fail.sh >dir/Makefile.am
36 cat >ok.sh <<'END'
37 #!/bin/sh
39 END
41 cat >dir/fail.sh <<'END'
42 #!/bin/sh
43 exit 1
44 END
46 chmod +x ok.sh dir/fail.sh
48 $ACLOCAL
49 $AUTOCONF
50 $AUTOMAKE --add-missing
52 ./configure --prefix "$(pwd)/inst"
54 $MAKE check >stdout && { cat stdout; exit 1; }
55 cat stdout
56 grep '^FAIL: fail\.sh *$' stdout
57 grep '^PASS: ok\.sh *$' stdout && exit 1
59 # The exit status of 'make -k' can be anything
60 # (depending on the Make implementation)
61 $MAKE -k check >stdout || :
62 cat stdout
63 grep '^FAIL: fail\.sh *$' stdout
64 grep '^PASS: ok\.sh *$' stdout
66 # Should also works when -k is not in first position.
67 $MAKE -s -k check >stdout || :
68 cat stdout
69 grep '^FAIL: fail\.sh *' stdout
70 grep '^PASS: ok\.sh *' stdout
72 # The rest of the test is for GNU Make.
74 if using_gmake; then
75 # Try with a long-option that do not have a short option equivalent
76 # (here, --no-print-directory). That should cause all options to
77 # appear verbatim in MAKEFLAGS.
78 $MAKE --no-print-directory -k check >stdout || :
79 cat stdout
80 grep '^FAIL: fail\.sh *$' stdout
81 grep '^PASS: ok\.sh *$' stdout