tests: give few vala tests more significant names
[automake.git] / t / posixsubst-scripts.sh
blobc9083cbd3993521716cb09d549d6d9ae3305c83d
1 #! /bin/sh
2 # Copyright (C) 2010-2012 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 that POSIX variable expansion '$(var:str=rpl)' works when used
18 # with the SCRIPTS primary.
20 . ./defs || exit 1
22 cat >> configure.ac << 'END'
23 AC_OUTPUT
24 END
26 # We have to be careful with 'test -x' commands on MinGW/MSYS, because
27 # the file system does not actually have execute permission information.
28 # Instead, that is emulated by looking at the file content, and returning
29 # 0 if the file starts with, e.g., a COFF header or with '#!'.
30 # So we need to create actual scripts in the make rules and in the file
31 # creation below.
33 cat > Makefile.am << 'END'
34 t1 = foo1 foo2
35 t2 = bar1x bar2
36 t3 = quu-baz
38 bar1 bar2:
39 (echo '#!/bin/sh' && echo 'exit 0') > $@
40 quux.pl:
41 (echo '#!/bin/perl' && echo '1;') > $@
42 CLEANFILES = bar1 bar2 quux.pl
44 # Also try an empty match suffix, to ensure that the ':=' in there is
45 # not confused by the parser with an unportable assignment operator.
46 dist_sbin_SCRIPTS = $(t1:=.sh)
47 libexec_SCRIPTS = $(t2:x=)
48 nodist_bin_SCRIPTS = $(t3:-baz=x.pl)
50 check-local: test1 test2
51 .PHONY: test1 test2
52 test1:
53 ls -l
54 test -f bar1
55 test -f bar2
56 test -f quux.pl
57 test2: distdir
58 ls -l $(distdir)
59 ## The scripts foo1.sh and foo2.sh should be distributed.
60 test -f $(distdir)/foo1.sh
61 test -f $(distdir)/foo2.sh
62 ## The scripts bar1, bar2 and quux.pl shouldn't be distributed.
63 test ! -r $(distdir)/bar1
64 test ! -r $(distdir)/bar2
65 test ! -r $(distdir)/quux.pl
67 installcheck-local:
68 ls -l $(libexecdir) $(bindir) $(sbindir)
69 test -f $(sbindir)/foo1.sh
70 test -x $(sbindir)/foo1.sh
71 test -f $(sbindir)/foo2.sh
72 test -x $(sbindir)/foo2.sh
73 test -f $(libexecdir)/bar1
74 test -x $(libexecdir)/bar1
75 test -f $(libexecdir)/bar2
76 test -x $(libexecdir)/bar2
77 test -f $(bindir)/quux.pl
78 test -x $(bindir)/quux.pl
79 END
81 cat > foo1.sh <<'END'
82 #!/bin/sh
83 exit 0
84 END
85 cp foo1.sh foo2.sh
87 $ACLOCAL
88 $AUTOCONF
89 $AUTOMAKE
91 cwd=$(pwd) || fatal_ "getting current working directory"
92 ./configure --prefix="$cwd/_inst"
93 $MAKE
94 $MAKE test1 test2
95 $MAKE install
96 $MAKE installcheck
97 $MAKE distcheck