Merge branch 'maint'
[platform/upstream/automake.git] / t / check-subst.sh
1 #! /bin/sh
2 # Copyright (C) 2008-2012 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 @substituted@ TESTS.
18 # Note that in this test, we rely on the .test extension for the
19 # substituted names: this is necessary for parallel-tests.
20 # See also sister test 'check-subst-prog.test'.
21
22 . ./defs || Exit 1
23
24 cat >> configure.ac << 'END'
25 AC_SUBST([script_tests], ['subst-pass-script.sh subst-xfail-script.sh'])
26 AC_SUBST([xfail_tests], ['xfail-script.test subst-xfail-script.sh'])
27 AC_OUTPUT
28 END
29
30 cat > Makefile.am << 'END'
31 TESTS = pass-script.test xfail-script.test @script_tests@
32 XFAIL_TESTS = @xfail_tests@
33 END
34
35 if test "$am_parallel_tests" = yes; then
36   unindent >> Makefile.am <<'END'
37     TEST_EXTENSIONS = .sh .test
38     SH_LOG_COMPILER = $(SHELL)
39 END
40 fi
41
42 cat > pass-script.test <<'END'
43 #! /bin/sh
44 exit 0
45 END
46 cat > xfail-script.test <<'END'
47 #! /bin/sh
48 exit 1
49 END
50 cp pass-script.test subst-pass-script.sh
51 cp xfail-script.test subst-xfail-script.sh
52 chmod a+x pass-script.test xfail-script.test
53
54 if test "$am_parallel_tests" != yes; then
55   chmod a+x subst-pass-script.sh subst-xfail-script.sh
56 fi
57
58 $ACLOCAL
59 $AUTOCONF
60 $AUTOMAKE -a
61
62 for vpath in false : ; do
63
64   if $vpath; then
65     mkdir build
66     cd build
67     srcdir=..
68   else
69     srcdir=.
70   fi
71
72   $srcdir/configure
73   $MAKE all
74   $MAKE check
75   if test "$am_parallel_tests" = yes; then
76     ls -l
77     test -f pass-script.log
78     test -f xfail-script.log
79     test -f subst-pass-script.log
80     test -f subst-xfail-script.log
81   fi
82   $MAKE distclean
83   cd $srcdir
84
85 done
86
87 :