tests: remove recipes that run tests with 'prove'
[platform/upstream/automake.git] / t / vala-mix2.sh
1 #! /bin/sh
2 # Copyright (C) 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 # Vala sources, C and C++ sources and C and C++ headers in the same
18 # program.  Functional test.  See automake bug#10894.
19
20 required='valac cc c++ GNUmake'
21 . ./defs || Exit 1
22
23 cat >> configure.ac <<'END'
24 AC_PROG_CC
25 AC_PROG_CXX
26 AM_PROG_VALAC([0.7.3])
27 AC_OUTPUT
28 END
29
30 cat > Makefile.am <<'END'
31 bin_PROGRAMS = zardoz
32 AM_VALAFLAGS = --profile=posix
33 zardoz_SOURCES = zardoz.vala foo.h bar.c baz.c zen.hh master.cxx
34 END
35
36 cat > zardoz.vala <<'END'
37 int main ()
38 {
39   stdout.printf ("foo is alive\n");
40   return 0;
41 }
42 END
43
44 cat > foo.h <<'END'
45 int foo;
46 int bar (void);
47 int baz (void);
48 END
49
50 cat > bar.c <<'END'
51 #include "foo.h"
52 int bar (void) { return foo + baz (); }
53 END
54
55 cat > baz.c <<'END'
56 #include "foo.h"
57 extern int foo = 0;
58 int baz (void) { return 0; }
59 END
60
61 cat > zen.hh <<'END'
62 #include <iostream>
63 END
64
65 cat > master.cxx <<'END'
66 #include "zen.hh"
67 void chatty (void) { std::cout << "Hello, stranger!\n"; }
68 END
69
70 $ACLOCAL
71 $AUTOMAKE -a
72 $AUTOCONF
73
74 ./configure
75
76 $MAKE all
77 ls -l # For debugging.
78
79 have_generated_files ()
80 {
81   test -f zardoz_vala.stamp
82   test -f zardoz.c
83 }
84
85 # Our vala-related rules must create stamp files and intermediate
86 # C files.
87 have_generated_files
88
89 # Remake rules are not uselessly triggered.
90 $MAKE -q
91 $MAKE -n | $FGREP vala.stamp && Exit 1
92
93 # But are triggered when they should.
94 for file in zardoz.vala foo.h bar.c baz.c zen.hh master.cxx; do
95   $sleep
96   echo '& choke me !' >> $file
97   $MAKE && Exit 1
98   $sleep
99   sed '$d' $file > t
100   mv -f t $file
101   $MAKE
102 done
103
104 # Check the distribution.
105 $MAKE distcheck
106
107 # Stamp files and intermediate C files should *not* be removed
108 # by "make clean".
109 $MAKE clean
110 ls -l # For debugging.
111 have_generated_files
112
113 # But stamp files should be removed by "maintainer-clean" (the
114 # behaviour w.r.t. intermediate C files is still unclear, and
115 # better left undefined for the moment).
116 $MAKE maintainer-clean
117 ls *vala*.stamp | grep . && Exit 1
118
119 :