Merge branch 'yacc-quote-fix'
[automake.git] / tests / check-tests-in-builddir.test
blob93dd966393a9771169ef3a6208769bbfb6a2a71c
1 #! /bin/sh
2 # Copyright (C) 2011-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 # Check that the testsuite driver can find test in the srcdir as
18 # well as in builddir, and that is prefers those in the builddir.
20 . ./defs || Exit 1
22 cat >> configure.in << 'END'
23 AC_OUTPUT
24 END
26 cat > Makefile.am << 'END'
27 TESTS = foo.test bar.test
28 EXTRA_DIST = $(TESTS)
29 END
31 cat > foo.test << 'END'
32 #! /bin/sh
33 exit ${FOO_EXIT_STATUS-0}
34 END
35 chmod a+x foo.test
37 unset FOO_EXIT_STATUS || :
39 $ACLOCAL
40 $AUTOCONF
41 $AUTOMAKE -a
43 mkdir build
44 cd build
46 ../configure
48 cat > bar.test << 'END'
49 #! /bin/sh
50 exit 0
51 END
52 chmod a+x bar.test
54 $MAKE check >out 2>&1 || { cat out; Exit1; }
55 cat out
56 # The simple-tests driver does not strip VPATH components from
57 # the name of the test, but the parallel-tests driver should.
58 if test x"$am_parallel_tests" = x"yes"; then
59 grep '\.\./foo' out && Exit 1
60 grep '^PASS: foo.test *$' out
61 else
62 grep '^PASS: .*foo.test *$' out
64 grep '^PASS: bar.test *$' out
66 rm -f test-suite.log foo.log bar.log
68 FOO_EXIT_STATUS=1 $MAKE check >out 2>&1 && { cat out; Exit1; }
69 cat out
70 # See comments above.
71 if test x"$am_parallel_tests" = x"yes"; then
72 grep '\.\./foo' out && Exit 1
73 grep '^FAIL: foo.test *$' out
74 else
75 grep '^FAIL: .*foo.test *$' out
77 grep '^PASS: bar.test *$' out
79 rm -f test-suite.log foo.log bar.log
81 # Check that if the same test is present in srcdir and builddir,
82 # the one in builddir is preferred.
83 cp bar.test foo.test
84 FOO_EXIT_STATUS=1 $MAKE check >out 2>&1 || { cat out; Exit1; }
85 cat out
86 grep '^PASS: foo.test *$' out
87 grep '^PASS: bar.test *$' out
89 # The tests in the builddir must be preferred also by "make dist".
90 FOO_EXIT_STATUS=1 $MAKE distcheck