doc: typos in test file.
[automake.git] / t / gnits2.sh
blobd9f6b480d89ebb9b9cb387e1fe39fbbe4cc04e93
1 #! /bin/sh
2 # Copyright (C) 2002-2024 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 <https://www.gnu.org/licenses/>.
17 # Test to ensure std-options checking is correct.
19 required='cc native'
20 . test-init.sh
22 cat >> configure.ac << '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 cat > fubar.c <<'END'
52 int main (void)
54 return 0;
56 END
58 cat > fine.c << 'END'
59 #include <stdio.h>
60 int main (void)
62 puts ("Which version? Which usage?");
63 return 0;
65 END
67 mkdir sub
69 cat >sub/scriptok.sh <<EOF
70 #!/bin/sh
71 echo "Which version? Which usage?"
72 EOF
74 # Not only does this script not support --help/--version, but
75 # it will also hang when run without input.
76 cat >sub/scriptnok.sh <<EOF
77 #!/bin/sh
78 cat
79 EOF
81 chmod +x sub/scriptok.sh
82 chmod +x sub/scriptnok.sh
84 # Files required by Gnits.
85 : > INSTALL
86 : > NEWS
87 : > README
88 : > COPYING
89 : > AUTHORS
90 : > ChangeLog
91 : > THANKS
93 # The following file should not be distributed.
94 # (alpha.sh checks the case where it must be distributed.)
95 : > README-alpha
97 $ACLOCAL
98 $AUTOCONF
99 $AUTOMAKE -a
101 grep README-alpha Makefile.in && exit 1
103 mkdir build
104 cd build
106 # Use --program-prefix to make sure the std-options check honors it.
107 ../configure "--prefix=$(pwd)/../inst-dir" --program-prefix=p
108 $MAKE all
109 $MAKE test-install
110 # Don't trust th exit status of "make -k" for non-GNU makes.
111 if using_gmake; then status=FAIL; else status=IGNORE; fi
112 run_make -e $status -E -- -k installcheck
113 $MAKE grep-stderr