Merge branch 'minor'
[automake.git] / t / built-sources-check.sh
blob7b2de25699d7f1ba2ba0862c2f4114db591032d8
1 #! /bin/sh
2 # Copyright (C) 2002-2017 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 <https://www.gnu.org/licenses/>.
17 # Make sure 'check:' honors $(BUILT_SOURCES).
18 # PR/359.
20 # For gen-testsuite-part: ==> try-with-serial-tests <==
21 . test-init.sh
23 cat >> configure.ac << 'END'
24 AC_CONFIG_FILES([dir/Makefile])
25 AC_OUTPUT
26 END
28 mkdir dir
30 cat > Makefile.am << 'END'
31 BUILT_SOURCES = command1.inc
32 SUBDIRS = dir
33 TESTS = subrun.sh
34 subrun.sh:
35 (echo '#! /bin/sh'; cat command1.inc) > $@
36 chmod +x $@
37 command1.inc:
38 echo 'dir/echo.sh' > $@
39 CLEANFILES = subrun.sh command1.inc
40 END
42 cat > dir/Makefile.am << 'END'
43 BUILT_SOURCES = command2.inc
44 check_SCRIPTS = echo.sh
45 echo.sh:
46 ## The next line ensures that command1.inc has been built before
47 ## recurring into the subdir.
48 test -f ../command1.inc
49 (echo '#! /bin/sh'; cat command2.inc) > $@
50 chmod +x $@
51 command2.inc:
52 echo 'echo Hello' > $@
53 CLEANFILES = echo.sh command2.inc
54 END
56 $ACLOCAL
57 $AUTOCONF
58 $AUTOMAKE -a
59 ./configure --prefix "$(pwd)/inst"
61 run_make -O check
62 grep '^PASS: subrun\.sh *$' stdout
63 grep 'PASS.*echo\.sh' stdout && exit 1
65 $MAKE distcheck