tests: cosmetic changes in t/extra-sources.sh
[platform/upstream/automake.git] / t / check4.sh
1 #! /bin/sh
2 # Copyright (C) 2005-2013 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 # For gen-testsuite-part: ==> try-with-serial-tests <==
20 . test-init.sh
21
22 cat >> configure.ac << 'END'
23 AC_CONFIG_FILES([dir/Makefile])
24 AC_OUTPUT
25 END
26
27 mkdir dir
28
29 cat > Makefile.am <<'END'
30 SUBDIRS = dir
31 TESTS = ok.sh
32 END
33
34 echo TESTS = fail.sh >dir/Makefile.am
35
36 cat >ok.sh <<'END'
37 #!/bin/sh
38 :
39 END
40
41 cat >dir/fail.sh <<'END'
42 #!/bin/sh
43 exit 1
44 END
45
46 chmod +x ok.sh dir/fail.sh
47
48 $ACLOCAL
49 $AUTOCONF
50 $AUTOMAKE --add-missing
51
52 ./configure --prefix "$(pwd)/inst"
53
54 run_make -O -e FAIL -- check
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 run_make -O -e IGNORE -- -k check
61 grep '^FAIL: fail\.sh *$' stdout
62 grep '^PASS: ok\.sh *$' stdout
63
64 # Should also works when -k is not in first position.
65 run_make -O -e IGNORE -- -s -k check
66 grep '^FAIL: fail\.sh *' stdout
67 grep '^PASS: ok\.sh *' stdout
68
69 # The rest of the test is for GNU Make.
70
71 if using_gmake; then
72   # Try with a long-option that do not have a short option equivalent
73   # (here, --no-print-directory).  That should cause all options to
74   # appear verbatim in MAKEFLAGS.
75   run_make -e FAIL -O -- --no-print-directory -k check
76   grep '^FAIL: fail\.sh *$' stdout
77   grep '^PASS: ok\.sh *$' stdout
78 fi
79
80 :