tests: avoid a spurious failure on MSYS
[platform/upstream/automake.git] / t / built-sources-check.sh
1 #! /bin/sh
2 # Copyright (C) 2002-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 # Make sure 'check:' honors $(BUILT_SOURCES).
18 # PR/359.
19
20 # For gen-testsuite-part: ==> try-with-serial-tests <==
21 . test-init.sh
22
23 cat >> configure.ac << 'END'
24 AC_CONFIG_FILES([dir/Makefile])
25 AC_OUTPUT
26 END
27
28 mkdir dir
29
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
41
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
55
56 $ACLOCAL
57 $AUTOCONF
58 $AUTOMAKE -a
59 ./configure --prefix "$(pwd)/inst"
60
61 run_make -O check
62 grep '^PASS: subrun\.sh *$' stdout
63 grep 'PASS.*echo\.sh' stdout && exit 1
64
65 $MAKE distcheck
66
67 :