tests: remove redundant 'set -e' calls
[platform/upstream/automake.git] / t / vala-vapi.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 # Test and that vapi files are correctly handled by Vala support.
18
19 required='valac cc GNUmake'
20 . ./defs || Exit 1
21
22 cat >> configure.ac <<'END'
23 AC_PROG_CC
24 AM_PROG_CC_C_O
25 AM_PROG_VALAC([0.7.3])
26 AC_OUTPUT
27 END
28
29 cat > Makefile.am <<'END'
30 bin_PROGRAMS = zardoz
31 AM_VALAFLAGS = --profile=posix
32 zardoz_SOURCES = zardoz.vala foo.vapi foo.h
33 END
34
35 cat > zardoz.vala <<'END'
36 int main ()
37 {
38     stdout.printf (BARBAR);
39     return 0;
40 }
41 END
42
43 echo '#define BARBAR "Zardoz!\n"' > foo.h
44
45 cat > foo.vapi <<'END'
46 [CCode (cprefix="", lower_case_cprefix="", cheader_filename="foo.h")]
47 public const string BARBAR;
48 END
49
50 if cross_compiling; then :; else
51   unindent >> Makefile.am <<'END'
52     check-local: test2
53     .PHONY: test1 test2
54     test1:
55         ./zardoz
56         ./zardoz | grep 'Zardoz!'
57     test2:
58         ./zardoz
59         ./zardoz | grep 'Quux!'
60 END
61 fi
62
63 $ACLOCAL
64 $AUTOMAKE -a
65 $AUTOCONF
66
67 ./configure --enable-dependency-tracking
68
69 $MAKE
70 ls -l        # For debugging.
71 cat zardoz.c # Likewise.
72 grep 'BARBAR' zardoz.c
73 cross_compiling || $MAKE test1 || Exit 1
74
75 # Simple check on remake rules.
76 $sleep
77 echo '#define BAZBAZ "Quux!\n"' > foo.h
78 sed 's/BARBAR/BAZBAZ/' zardoz.vala > t && mv -f t zardoz.vala || Exit 99
79 $MAKE && Exit 1
80 sed 's/BARBAR/BAZBAZ/' foo.vapi > t && mv -f t foo.vapi || Exit 99
81 $MAKE
82 cat zardoz.c # For debugging.
83 grep 'BAZBAZ' zardoz.c
84 cross_compiling || $MAKE test2 || Exit 1
85
86 # Check the distribution.
87 $MAKE distcheck
88
89 :