tests: avoid a spurious failure on MSYS
[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 AM_PROG_CC_C_O
26 AC_OUTPUT
27 END
28
29 cat > Makefile.am << 'END'
30 AUTOMAKE_OPTIONS = subdir-objects
31 TESTS = foo sub/foo $(check_PROGRAMS)
32 XFAIL_TESTS = foo sub/baz
33 check_PROGRAMS = bar sub/bar baz sub/baz
34 END
35
36 mkdir sub
37
38 cat > foo <<'END'
39 #! /bin/sh
40 test -f "$srcdir/Makefile.am"
41 END
42 cat > sub/foo <<'END'
43 #! /bin/sh
44 test -f "$srcdir/Makefile.am"
45 END
46 chmod a+x foo sub/foo
47
48 cat > bar.c <<'END'
49 int main (void) { return 0; }
50 END
51 cat > sub/bar.c <<'END'
52 int main (void) { return 0; }
53 END
54 cat > baz.c <<'END'
55 #include <stdlib.h>
56 int main (void) { return EXIT_FAILURE; }
57 END
58 cat > sub/baz.c <<'END'
59 #include <stdlib.h>
60 int main (void) { return EXIT_FAILURE; }
61 END
62
63 $ACLOCAL
64 $AUTOCONF
65 $AUTOMAKE -a
66
67 ./configure
68 run_make -E -O -e FAIL check
69 grep 'XPASS.* foo$' stdout
70 grep '^[^X]*PASS.* sub/foo$' stdout
71 grep '^[^X]*PASS.* bar' stdout
72 grep '^[^X]*PASS.* sub/bar' stdout
73 grep '^[^X]*FAIL.* baz' stdout
74 grep 'XFAIL.* sub/baz' stdout
75 # The parallel test driver should cause circular dependencies.
76 # Look for known warnings from a couple of 'make' implementations.
77 grep -i 'circular.*dependency' stderr && exit 1
78 grep -i 'graph cycles' stderr && exit 1
79
80 $MAKE distclean
81
82 mkdir build
83 cd build
84 ../configure
85 run_make -O -e FAIL check
86 # Note: we are not grepping for the space in the lines from the 'foo'
87 # tests, due to the Solaris make VPATH rewriting (if we fix that, we
88 # can still write a separate test for it).
89 grep 'XPASS.*foo$' stdout
90 grep '^[^X]*PASS.*sub/foo$' stdout
91 grep '^[^X]*PASS.* bar' stdout
92 grep '^[^X]*PASS.* sub/bar' stdout
93 grep '^[^X]*FAIL.* baz' stdout
94 grep 'XFAIL.* sub/baz' stdout
95
96 :