Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / check9.test
1 #! /bin/sh
2 # Copyright (C) 2008, 2009, 2010  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
21 . ./defs || Exit 1
22
23 set -e
24
25 cat >> configure.in << 'END'
26 AC_PROG_CC
27 AC_SUBST([script_tests], ['subst-pass-script.test subst-xfail-script.test'])
28 AC_SUBST([prog_tests], ['subst-pass-prog.test$(EXEEXT) subst-xfail-prog.test$(EXEEXT)'])
29 AC_SUBST([xfail_tests], ['xfail-script.test subst-xfail-script.test xfail-prog$(EXEEXT) subst-xfail-prog.test$(EXEEXT)'])
30 AC_OUTPUT
31 END
32
33 cat > Makefile.am << 'END'
34 TESTS = pass-script.test xfail-script.test @script_tests@ $(check_PROGRAMS)
35 XFAIL_TESTS = @xfail_tests@
36 check_PROGRAMS = pass-prog xfail-prog @prog_tests@
37 EXTRA_PROGRAMS = subst-pass-prog.test subst-xfail-prog.test
38 END
39
40 cat >>pass-script.test <<'END'
41 #! /bin/sh
42 exit 0
43 END
44 cat >>xfail-script.test <<'END'
45 #! /bin/sh
46 exit 1
47 END
48 chmod a+x pass-script.test xfail-script.test
49 cp pass-script.test subst-pass-script.test
50 cp xfail-script.test subst-xfail-script.test
51
52 cat >>pass-prog.c <<'END'
53 int main() { return 0; }
54 END
55 cat >>xfail-prog.c <<'END'
56 #include <stdlib.h>
57 int main() { return EXIT_FAILURE; }
58 END
59 # The .test extension is removed for the default source file name:
60 cp pass-prog.c subst-pass-prog.c
61 cp xfail-prog.c subst-xfail-prog.c
62
63 $ACLOCAL
64 $AUTOCONF
65 $AUTOMAKE -a
66
67 ./configure
68 $MAKE all
69 $MAKE check
70 $MAKE distclean
71
72 mkdir build
73 cd build
74 ../configure
75 $MAKE all
76 $MAKE check
77 $MAKE distclean
78 :