Revert Automake license to GPLv2+.
[platform/upstream/automake.git] / tests / check4.test
1 #! /bin/sh
2 # Copyright (C) 2005, 2007, 2008  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 # Make sure `make -k check' processes all directories.
18
19 . ./defs || Exit 1
20
21 set -e
22
23 cat >> configure.in << 'END'
24 AC_CONFIG_FILES([dir/Makefile])
25 AC_OUTPUT
26 END
27
28 mkdir dir
29
30 cat > Makefile.am <<'END'
31 SUBDIRS = dir
32 TESTS = ok.sh
33 END
34
35 echo TESTS = fail.sh >dir/Makefile.am
36
37 cat >ok.sh <<'END'
38 #!/bin/sh
39 :
40 END
41
42 cat >dir/fail.sh <<'END'
43 #!/bin/sh
44 exit 1
45 END
46
47 chmod +x ok.sh dir/fail.sh
48
49 $ACLOCAL
50 $AUTOCONF
51 $AUTOMAKE
52 ./configure --prefix "`pwd`/inst"
53 $MAKE check >stdout && { cat stdout; Exit 1; }
54 cat stdout
55 grep 'FAIL: fail.sh' stdout
56 grep 'PASS: ok.sh' stdout && Exit 1
57
58 # The exit status of `make -k' can be anything
59 # (depending on the Make implementation)
60 $MAKE -k check >stdout || :
61 cat stdout
62 grep 'FAIL: fail.sh' stdout
63 grep 'PASS: ok.sh' stdout
64
65 # should also works when -k is not in first position
66 $MAKE -s -k check >stdout || :
67 cat stdout
68 grep 'FAIL: fail.sh' stdout
69 grep 'PASS: ok.sh' stdout
70
71 # The rest of the test is for GNU Make.
72
73 # Use --version AND -v, because SGI Make doesn't fail on --version.
74 # Also grep for GNU because newer versions of FreeBSD make do
75 # not complain about `--version' (they seem to silently ignore it).
76 ($MAKE --version -v | grep GNU) || Exit 0
77
78 # Try with a long-option that do not have a short option equivalent
79 # (here, --no-print-directory).  That should cause all options to
80 # appear verbatim in MAKEFLAGS.
81 $MAKE --no-print-directory -k check >stdout || :
82 cat stdout
83 grep 'FAIL: fail.sh' stdout
84 grep 'PASS: ok.sh' stdout