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)
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 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 # This checks will be run only by the autogenerated 'check12-p.test'.
140 if test x"$am_serial_tests" != x"yes"; then
141 test -f test-suite.log
145 grep 'check-local succeeded :-)' local.log
147 cp -f config.status config-status.sav
152 test ! -r spanner.log
153 test ! -r spanner.sum
154 test ! -r test-suite.log
159 mv -f config-status.sav config.status
162 NAIL=screw $MAKE check && Exit 1
167 grep 'FAIL: test_hammer' hammer.sum
168 grep 'FAIL:' spanner.sum && Exit 1
170 B_EXIT_STATUS=1 $MAKE check && Exit 1
171 # This checks will be run only by the autogenerated 'check12-p.test'.
172 if test x"$am_serial_tests" != x"yes"; then
176 grep '^a\.test: exit status: 0$' a.log
177 grep '^b\.test: exit status: 1$' b.log
178 grep '^FAIL: b$' test-suite.log
179 grep '^b\.test: exit status: 1$' test-suite.log
180 grep '^a\.test' test-suite.log && Exit 1
181 : For shells with busted 'set -e'.
184 CHECKLOCAL_EXIT_STATUS=1 $MAKE check && Exit 1
185 grep 'check-local failed :-(' local.log
187 # Do not trust the exit status of 'make -k'.
188 NAIL=screw B_EXIT_STATUS=23 CHECKLOCAL_EXIT_STATUS=1 $MAKE -k check || :
193 grep 'FAIL: test_hammer' hammer.sum
194 grep 'FAIL:' spanner.sum && Exit 1
195 # This checks will be run only by the autogenerated 'check12-p.test'.
196 if test x"$am_serial_tests" != x"yes"; then
200 grep '^a\.test: exit status: 0$' a.log
201 grep '^b\.test: exit status: 23$' b.log
202 grep '^FAIL: b$' test-suite.log
203 grep '^b\.test: exit status: 23$' test-suite.log
204 grep '^a\.test' test-suite.log && Exit 1
205 : For shells with busted 'set -e'.
207 grep 'check-local failed :-(' local.log