doc: update Vala documentation
[automake.git] / t / test-trs-basic.sh
blobbf16ce2eba3961949006ae9a151ad9dfe8b0351b
1 #! /bin/sh
2 # Copyright (C) 2011-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 # Check parallel harness features:
18 # - creation and removal of '.trs' auxiliary files
19 # - check some internals regarding the use of '.trs' files.
21 . test-init.sh
23 cat >> configure.ac <<END
24 AC_OUTPUT
25 END
27 cat > Makefile.am << 'END'
28 TEST_EXTENSIONS = .sh .test
29 TESTS = foo.test bar.sh sub/zardoz.test
30 TEST_LOG_COMPILER = $(SHELL)
31 SH_LOG_COMPILER = $(SHELL)
33 ## Used to check some internal details. And yes, the quotes around
34 ## '$bases' are deliberate: they check for whitespace normalization.
35 tb:
36 $(am__set_TESTS_bases); echo "$$bases" > $@
37 END
39 cat > foo.test << 'END'
40 #! /bin/sh
41 exit $FOO_STATUS
42 END
43 : > bar.sh
44 mkdir sub
45 : > sub/zardoz.test
47 FOO_STATUS=0; export FOO_STATUS
49 $ACLOCAL
50 $AUTOCONF
51 $AUTOMAKE -a
55 # Check some internal details first.
58 for vpath in : false; do
60 if $vpath; then
61 srcdir=..
62 mkdir build
63 cd build
64 else
65 srcdir=.
68 $srcdir/configure
70 $MAKE tb
71 test x"$(cat tb)" = x"foo bar sub/zardoz"
72 rm -f tb
73 # Please don't change the order of the stuff in TESTS, below.
74 run_make TESTS='foo.test foo2.sh foo-log foolog.test a.log.b.sh 0.exe' tb
75 test x"$(cat tb)" = x"foo foo2 foo-log foolog a.log.b 0.exe"
76 rm -f tb
78 cd $srcdir
80 done
83 # The 'test-suite.stamp' file and the '.trs' files get created by
84 # "make check" and removed by "make clean" and "make mostlyclean".
87 : > unrelated.trs
88 : > sub/foo.trs
90 $MAKE check
91 test -f foo.trs
92 test -f bar.trs
93 test -f sub/zardoz.trs
94 $MAKE clean
95 test ! -e foo.trs
96 test ! -e bar.trs
97 test ! -e sub/zardoz.trs
98 # Unrelated '.trs' files shouldn't be removed.
99 test -f unrelated.trs
100 test -f sub/foo.trs
102 # The files should be properly created in case of testsuite failure too.
103 FOO_STATUS=1 $MAKE check && exit 1
104 test -f foo.trs
105 test -f bar.trs
106 test -f sub/zardoz.trs
107 $MAKE mostlyclean
108 test ! -e foo.trs
109 test ! -e bar.trs
110 test ! -e sub/zardoz.trs
111 # Unrelated '.trs' files shouldn't be removed.
112 test -f unrelated.trs
113 test -f sub/foo.trs
116 # Try with a subset of TESTS.
119 run_make TESTS=foo.test check
120 test -f foo.trs
121 test ! -e bar.trs
122 test ! -e sub/zardoz.trs
123 $MAKE clean
124 test ! -e foo.trs
125 run_make TESTS='foo.test bar.sh' check
126 test -f foo.trs
127 test -f bar.trs
128 test ! -e sub/zardoz.trs
129 # "make clean" shouldn't remove '.trs' files for tests not in $(TESTS).
130 run_make TESTS=bar.sh clean
131 test -f foo.trs
132 test ! -e bar.trs
134 $MAKE clean
137 # Try with a subset of TEST_LOGS.
140 run_make TEST_LOGS=sub/zardoz.log check
141 test ! -e foo.trs
142 test ! -e bar.trs
143 test -f sub/zardoz.trs
144 $MAKE clean
145 test ! -e sub/zardoz.trs
146 run_make TEST_LOGS='foo.log bar.log' check
147 test -f foo.trs
148 test -f bar.trs
149 test ! -e sub/zardoz.trs
150 # "make clean" shouldn't remove '.trs' files for tests whose log
151 # is not in $(TEST_LOGS).
152 run_make TEST_LOGS=foo.log clean
153 test ! -e foo.trs
154 test -f bar.trs
155 test ! -e sub/zardoz.trs