2 # Copyright (C) 2010-2018 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)
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 make sure dejagnu tests, automake-style tests, and check-local
20 # For gen-testsuite-part: ==> try-with-serial-tests <==
24 cat >> configure.ac
<< 'END'
28 cat > Makefile.am
<< 'END'
38 echo a.
test: exit status
: ${A_EXIT_STATUS-0}
39 exit ${A_EXIT_STATUS-0}
43 echo b.
test: exit status
: ${B_EXIT_STATUS-0}
44 exit ${B_EXIT_STATUS-0}
46 chmod +x a.
test b.
test
48 cat >> Makefile.am
<< 'END'
50 EXTRA_DIST
+= $
(TESTS
)
53 A_EXIT_STATUS
=0; export A_EXIT_STATUS
54 B_EXIT_STATUS
=0; export B_EXIT_STATUS
58 cat >> Makefile.am
<< 'END'
59 AUTOMAKE_OPTIONS
+= dejagnu
60 DEJATOOL
= hammer spanner
61 AM_RUNTESTFLAGS
= HAMMER
=$
(srcdir
)/hammer SPANNER
=$
(srcdir
)/spanner
62 EXTRA_DIST
+= hammer.test
/hammer.exp
63 EXTRA_DIST
+= spanner.test
/spanner.exp
68 echo "Everything looks like a ${NAIL-nail} to me!"
71 NAIL
=nail
; export NAIL
73 cat > spanner
<< 'END'
75 echo "I'm a right spanner!"
77 chmod +x hammer spanner
79 mkdir hammer.
test spanner.
test
81 cat > hammer.test
/hammer.exp
<< 'END'
85 "Everything looks like a nail to me!" { pass
"$test" }
86 default
{ fail
"$test" }
90 cat > spanner.test
/spanner.exp
<< 'END'
94 "I'm a right spanner!" { pass
"$test" }
95 default
{ fail
"$test" }
99 ## User-defined extra tests.
101 cat >> Makefile.am
<<'END'
103 case $$CHECKLOCAL_EXIT_STATUS in \
104 0) echo 'check-local succeeded :-)';; \
105 *) echo 'check-local failed :-(';; \
107 exit $$CHECKLOCAL_EXIT_STATUS
108 CLEANFILES += local.log
110 CHECKLOCAL_EXIT_STATUS
=0; export CHECKLOCAL_EXIT_STATUS
112 ## Go with the testcase execution.
116 $AUTOMAKE --add-missing
118 for vpath
in : false
; do
128 if test -f config.status
; then
139 if test x
"$am_serial_tests" != x
"yes"; then
140 test -f test-suite.log
144 grep 'check-local succeeded :-)' local.log
146 cp -f config.status config-status.sav
151 test ! -e spanner.log
152 test ! -e spanner.
sum
153 test ! -e test-suite.log
158 mv -f config-status.sav config.status
161 NAIL
=screw
$MAKE check
&& exit 1
166 grep 'FAIL: test_hammer' hammer.
sum
167 grep 'FAIL:' spanner.
sum && exit 1
169 B_EXIT_STATUS
=1 $MAKE check
&& exit 1
170 if test x
"$am_serial_tests" != x
"yes"; then
174 grep '^a\.test: exit status: 0$' a.log
175 grep '^b\.test: exit status: 1$' b.log
176 grep '^FAIL: b$' test-suite.log
177 grep '^b\.test: exit status: 1$' test-suite.log
178 grep '^a\.test' test-suite.log
&& exit 1
179 : For shells with busted
'set -e'.
182 CHECKLOCAL_EXIT_STATUS
=1 $MAKE check
&& exit 1
183 grep 'check-local failed :-(' local.log
185 # Do not trust the exit status of 'make -k'.
186 NAIL
=screw B_EXIT_STATUS
=23 CHECKLOCAL_EXIT_STATUS
=1 $MAKE -k check ||
:
191 grep 'FAIL: test_hammer' hammer.
sum
192 grep 'FAIL:' spanner.
sum && exit 1
193 if test x
"$am_serial_tests" != x
"yes"; then
197 grep '^a\.test: exit status: 0$' a.log
198 grep '^b\.test: exit status: 23$' b.log
199 grep '^FAIL: b$' test-suite.log
200 grep '^b\.test: exit status: 23$' test-suite.log
201 grep '^a\.test' test-suite.log
&& exit 1
202 : For shells with busted
'set -e'.
204 grep 'check-local failed :-(' local.log