tests: make 'lzip.test' executable
[automake.git] / tests / gnits2.test
blob4c5d54feb4cf163244a90a6a5796e9e3ba1b070b
1 #! /bin/sh
2 # Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
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.
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.
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/>.
17 # Test to ensure std-options checking is correct.
19 required=gcc
20 . ./defs || Exit 1
22 cat >> configure.in << 'END'
23 AC_PROG_CC
24 AC_OUTPUT
25 END
27 cat > Makefile.am << 'END'
28 AUTOMAKE_OPTIONS = gnits
29 noinst_PROGRAMS = fubar2
30 bin_PROGRAMS = fubar sub/fine
31 nobase_bin_PROGRAMS = sub/fubar3
32 fubar_SOURCES = fubar.c
33 fubar2_SOURCES = fubar.c
34 sub_fubar3_SOURCES = fubar.c
35 sub_fine_SOURCES = fine.c
36 bin_SCRIPTS = sub/scriptok.sh sub/scriptnok.sh
38 grep-stderr:
39 grep 'pfubar$(EXEEXT) does not support' stderr
40 grep 'pfubar3$(EXEEXT) does not support' stderr
41 grep 'pscriptnok.sh does not support' stderr
42 ## Only three failures please.
43 test `grep 'does not support --help' stderr | wc -l` = 3
44 test `grep 'does not support --version' stderr | wc -l` = 3
46 test-install: install
47 test -f ../inst-dir/bin/pfine$(EXEEXT)
48 test ! -f ../inst-dir/bin/fine$(EXEEXT)
49 END
51 echo 'int main () { return 0; }' > fubar.c
53 cat > fine.c << 'END'
54 #include <stdio.h>
55 int
56 main ()
58 puts ("Which version? Which usage?");
59 return 0;
61 END
63 mkdir sub
65 cat >sub/scriptok.sh <<EOF
66 #!/bin/sh
67 echo "Which version? Which usage?"
68 EOF
70 # Not only does this script not support --help/--version, but
71 # it will also hang when run without input.
72 cat >sub/scriptnok.sh <<EOF
73 #!/bin/sh
74 cat
75 EOF
77 chmod +x sub/scriptok.sh
78 chmod +x sub/scriptnok.sh
80 # Files required by Gnits.
81 : > INSTALL
82 : > NEWS
83 : > README
84 : > COPYING
85 : > AUTHORS
86 : > ChangeLog
87 : > THANKS
89 # The following file should not be distributed.
90 # (alpha.test checks the case where it must be distributed.)
91 : > README-alpha
93 set -e
95 $ACLOCAL
96 $AUTOCONF
97 $AUTOMAKE -a
99 grep README-alpha Makefile.in && Exit 1
101 mkdir build
102 cd build
104 # Use --program-prefix to make sure the std-options check honors it.
105 ../configure "--prefix=`pwd`/../inst-dir" --program-prefix=p
106 $MAKE all
107 $MAKE test-install
108 $MAKE -k installcheck 2>stderr || : # Never trust the exit status of make -k.
109 cat stderr
110 $MAKE grep-stderr