1#! /bin/sh
2# Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>.
16
17# Check parallel-tests features:
18# - generated distributed tests.
19# - listing $(srcdir)/ or $(top_srcdir)/ in TESTS doesn't work ATM,
20#   and is thus diagnosed.
21
22# TODO: this test should also ensure that the 'make' implementation
23#       properly adheres to rules in all cases.  See the Autoconf
24#       manual for the ugliness in this area, when VPATH comes into
25#       play.  :-/
26
27. test-init.sh
28
29cat >> configure.ac << 'END'
30AC_OUTPUT
31END
32
33cat > Makefile.am << 'END'
34TESTS = foo.test
35## the next line will cause automake to error out:
36TESTS += $(srcdir)/bar.test $(top_srcdir)/baz.test
37.in.test:
38## Account for VPATH issues on weaker make implementations (e.g. IRIX 6.5)
39	cp `test -f '$<' || echo $(srcdir)/`$< $@
40	chmod +x $@
41check_SCRIPTS = $(TESTS)
42EXTRA_DIST = foo.in foo.test
43DISTCLEANFILES = foo.test
44END
45
46cat > foo.in <<'END'
47#! /bin/sh
48echo "this is $0"
49exit 0
50END
51
52$ACLOCAL
53$AUTOCONF
54AUTOMAKE_fails -a
55grep '$(srcdir).*TESTS.*bar\.test' stderr
56grep '$(top_srcdir).*TESTS.*baz\.test' stderr
57
58sed '/^TESTS +=.*srcdir/d' < Makefile.am > t
59mv -f t Makefile.am
60$AUTOMAKE -a
61
62./configure
63$MAKE check
64$MAKE distcheck
65$MAKE distclean
66
67mkdir build
68cd build
69../configure
70$MAKE check
71test ! -e ../foo.log
72$MAKE distcheck
73
74:
75