2 # Copyright (C) 2010 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
25 cat >> configure.in << 'END'
29 cat > Makefile.am << 'END'
39 exit ${A_EXIT_STATUS-0}
43 exit ${B_EXIT_STATUS-0}
45 chmod +x a.test b.test
47 cat >> Makefile.am << 'END'
49 EXTRA_DIST += $(TESTS)
52 A_EXIT_STATUS=0; export A_EXIT_STATUS
53 B_EXIT_STATUS=0; export B_EXIT_STATUS
57 cat >> Makefile.am << 'END'
58 AUTOMAKE_OPTIONS += dejagnu
59 DEJATOOL = hammer spanner
60 AM_RUNTESTFLAGS = HAMMER=$(srcdir)/hammer SPANNER=$(srcdir)/spanner
61 EXTRA_DIST += hammer.test/hammer.exp
62 EXTRA_DIST += spanner.test/spanner.exp
67 echo "Everything looks like a ${NAIL-nail} to me!"
70 NAIL=nail; export NAIL
72 cat > spanner << 'END'
74 echo "I'm a right spanner!"
76 chmod +x hammer spanner
78 mkdir hammer.test spanner.test
80 cat > hammer.test/hammer.exp << 'END'
84 "Everything looks like a nail to me!" { pass "$test" }
85 default { fail "$test" }
89 cat > spanner.test/spanner.exp << 'END'
93 "I'm a right spanner!" { pass "$test" }
94 default { fail "$test" }
98 ## User-defined extra tests.
100 cat >> Makefile.am <<'END'
102 case $$CHECKLOCAL_EXIT_STATUS in \
103 0) echo 'check-local succeded :-)';; \
104 *) echo 'check-local failed :-(';; \
106 exit $$CHECKLOCAL_EXIT_STATUS
107 CLEANFILES += local.log
109 CHECKLOCAL_EXIT_STATUS=0; export CHECKLOCAL_EXIT_STATUS
111 ## Go with the testcase execution.
115 $AUTOMAKE --add-missing
117 for vpath in : false; do
127 if test -f config.status; then
138 # This checks will be run only by the autogenerated `check12-p.test'.
139 if test x"$parallel_tests" = x"yes"; then
141 grep '^PASS: a\.test (exit: 0)' a.log
142 grep '^PASS: b\.test (exit: 0)' b.log
146 grep 'check-local succeded :-)' local.log
148 cp -f config.status config-status.sav
153 test ! -r spanner.log
154 test ! -r spanner.sum
155 test ! -r test-suite.log
160 mv -f config-status.sav config.status
163 NAIL=screw $MAKE check && Exit 1
168 grep 'FAIL: test_hammer' hammer.sum
169 grep 'FAIL:' spanner.sum && Exit 1
171 B_EXIT_STATUS=1 $MAKE check && Exit 1
172 # This checks will be run only by the autogenerated `check12-p.test'.
173 if test x"$parallel_tests" = x"yes"; then
175 grep '^PASS: a\.test (exit: 0)' a.log
176 grep '^FAIL: b\.test (exit: 1)' b.log
177 grep '^FAIL: b\.test (exit: 1)' test-suite.log
180 CHECKLOCAL_EXIT_STATUS=1 $MAKE check && Exit 1
181 grep 'check-local failed :-(' local.log
183 # Do not trust the exit status of `make -k'.
184 NAIL=screw B_EXIT_STATUS=23 CHECKLOCAL_EXIT_STATUS=1 $MAKE -k check || :
189 grep 'FAIL: test_hammer' hammer.sum
190 grep 'FAIL:' spanner.sum && Exit 1
191 # This checks will be run only by the autogenerated `check12-p.test'.
192 if test x"$parallel_tests" = x"yes"; then
194 grep '^PASS: a\.test (exit: 0)' a.log
195 grep '^FAIL: b\.test (exit: 23)' b.log
196 grep '^FAIL: b\.test (exit: 23)' test-suite.log
198 grep 'check-local failed :-(' local.log