Merge branch 'branch-1.13.2' into maint
[platform/upstream/automake.git] / t / check8.sh
1 #! /bin/sh
2 # Copyright (C) 2008-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 # Check subdir TESTS.
18
19 # For gen-testsuite-part: ==> try-with-serial-tests <==
20 required='cc native'
21 . test-init.sh
22
23 cat >> configure.ac << 'END'
24 AC_PROG_CC
25 AC_OUTPUT
26 END
27
28 cat > Makefile.am << 'END'
29 AUTOMAKE_OPTIONS = subdir-objects
30 TESTS = foo sub/foo $(check_PROGRAMS)
31 XFAIL_TESTS = foo sub/baz
32 check_PROGRAMS = bar sub/bar baz sub/baz
33 END
34
35 mkdir sub
36
37 cat > foo <<'END'
38 #! /bin/sh
39 test -f "$srcdir/Makefile.am"
40 END
41 cat > sub/foo <<'END'
42 #! /bin/sh
43 test -f "$srcdir/Makefile.am"
44 END
45 chmod a+x foo sub/foo
46
47 cat > bar.c <<'END'
48 int main (void) { return 0; }
49 END
50 cat > sub/bar.c <<'END'
51 int main (void) { return 0; }
52 END
53 cat > baz.c <<'END'
54 #include <stdlib.h>
55 int main (void) { return EXIT_FAILURE; }
56 END
57 cat > sub/baz.c <<'END'
58 #include <stdlib.h>
59 int main (void) { return EXIT_FAILURE; }
60 END
61
62 $ACLOCAL
63 $AUTOCONF
64 $AUTOMAKE -a
65
66 ./configure
67 AM_COLOR_TESTS=always $MAKE check >stdout 2>stderr &&
68   { cat stdout; cat stderr >&2; exit 1; }
69 cat stdout
70 cat stderr >&2
71 grep 'XPASS.* foo$' stdout
72 grep '^[^X]*PASS.* sub/foo$' stdout
73 grep '^[^X]*PASS.* bar' stdout
74 grep '^[^X]*PASS.* sub/bar' stdout
75 grep '^[^X]*FAIL.* baz' stdout
76 grep 'XFAIL.* sub/baz' stdout
77 # The parallel test driver should cause circular dependencies.
78 # Look for known warnings from a couple of 'make' implementations.
79 grep -i 'circular.*dependency' stderr && exit 1
80 grep -i 'graph cycles' stderr && exit 1
81
82 $MAKE distclean
83
84 mkdir build
85 cd build
86 ../configure
87 $MAKE check >stdout && { cat stdout; exit 1; }
88 cat stdout
89 # Note: we are not grepping for the space in the lines from the 'foo'
90 # tests, due to the Solaris make VPATH rewriting (if we fix that, we
91 # can still write a separate test for it).
92 grep 'XPASS.*foo$' stdout
93 grep '^[^X]*PASS.*sub/foo$' stdout
94 grep '^[^X]*PASS.* bar' stdout
95 grep '^[^X]*PASS.* sub/bar' stdout
96 grep '^[^X]*FAIL.* baz' stdout
97 grep 'XFAIL.* sub/baz' stdout
98
99 :