doc: typos in test file.
[automake.git] / t / posixsubst-tests.sh
blobd813b248320ca611db93600c6e14b45a4af53b0b
1 #! /bin/sh
2 # Copyright (C) 2010-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 that POSIX variable expansion '$(var:str=rpl)' works when used
18 # with the TESTS special variable.
20 # For gen-testsuite-part: ==> try-with-serial-tests <==
21 . test-init.sh
23 cat >> configure.ac << 'END'
24 AC_OUTPUT
25 END
27 cat > Makefile.am << 'END'
28 t1 = foo1 foo2
29 t2 = barx
30 t3 = bar2
32 foo2.test barz:
33 (echo '#!/bin/sh' && echo 'exit 0') > $@ && chmod a+x $@
34 CLEANFILES = foo2.test barz # For FreeBSD make.
36 # Also try an empty match suffix, to ensure that the ':=' in there is
37 # not confused by the parser with an unportable assignment operator.
38 TESTS = $(t1:=.test) $(t2:x=y) $(t3:2=z)
40 EXTRA_DIST = $(TESTS)
41 MOSTLYCLEANFILES = *.out
42 END
44 cat > foo1.test <<'END'
45 #!/bin/sh
46 touch foo1.out
47 test x"${TESTSUITE_OK-no}" = x"yes"
48 END
49 sed 's/foo1/bary/g' foo1.test > bary
50 chmod +x foo1.test bary
52 $ACLOCAL
53 $AUTOCONF
54 $AUTOMAKE -a
56 ./configure
57 run_make -M -e FAIL check
58 ls -l
59 grep '^FAIL: foo1\.test *$' output
60 grep '^PASS: foo2\.test *$' output
61 grep '^FAIL: bary *$' output
62 grep '^PASS: barz *$' output
63 test -f foo1.out
64 test -f bary.out
66 TESTSUITE_OK=yes $MAKE distcheck