2 # Copyright (C) 2011-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/>.
18 # - LOG_COMPILER support;
19 # - basic support for TODO and SKIP directives, and "Bail out!" magic;
20 # - testsuite progress output on console;
21 # - runtime overriding of TESTS and TEST_LOGS;
22 # - correct counts of test results (both in summary and in progress
24 # Note that some of the features checked here are checked in other
25 # test cases too, usually in a more thorough and detailed way.
31 cat >> configure.ac <<END
35 cat > Makefile.am << 'END'
36 TEST_LOG_DRIVER = $(srcdir)/tap-driver
37 ## Defining LOG_COMPILER should work and not intefere with the
39 TEST_LOG_COMPILER = cat
45 echo 'not ok 2 # TODO' >>$@-t
46 echo 'ok 3 # SKIP' >>$@-t
47 cat $@-t ;: For debugging.
51 cat > success.test << 'END'
64 ok 12 twelve twelve # TODO
66 not ok 14 fourteen # TODO
67 not ok 15 - fifteen # TODO
68 not ok 16 sixteen sixteen # TODO
71 ok 19 - nineteen # SKIP
72 ok 20 twenty twenty # SKIP
81 # Basilar usage and testsuite progress output.
83 $MAKE check >stdout && { cat stdout; exit 1; }
86 count_test_results total=20 pass=4 fail=4 xpass=4 xfail=4 skip=4 error=0
89 test -f test-suite.log
93 PASS: success.test 2 two
94 PASS: success.test 3 - three
95 PASS: success.test 4 four four
97 FAIL: success.test 6 six
98 FAIL: success.test 7 - seven
99 FAIL: success.test 8 eight eight
100 XPASS: success.test 9 # TODO
101 XPASS: success.test 10 ten # TODO
102 XPASS: success.test 11 - eleven # TODO
103 XPASS: success.test 12 twelve twelve # TODO
104 XFAIL: success.test 13 # TODO
105 XFAIL: success.test 14 fourteen # TODO
106 XFAIL: success.test 15 - fifteen # TODO
107 XFAIL: success.test 16 sixteen sixteen # TODO
108 SKIP: success.test 17 # SKIP
109 SKIP: success.test 18 eighteen # SKIP
110 SKIP: success.test 19 - nineteen # SKIP
111 SKIP: success.test 20 twenty twenty # SKIP
114 $FGREP ': success.test' stdout > got
120 # Override TESTS from the command line.
124 cat > bail.test <<'END'
130 TESTS=bail.test $MAKE -e check >stdout && { cat stdout; exit 1; }
133 count_test_results total=1 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=1
135 test ! -e success.log
137 test -f test-suite.log
139 grep '^ERROR: bail\.test - Bail out!' stdout
140 grep '^PASS:' stdout && exit 1
141 test $($FGREP -c ': bail.test' stdout) -eq 1
142 $FGREP 'success.test' stdout && exit 1
144 # Override TEST_LOGS from the command line, making it point to a test
145 # (ok.test) that has to be generated at make time.
149 TEST_LOGS=ok.log $MAKE -e check >stdout || { cat stdout; exit 1; }
152 count_test_results total=3 pass=1 fail=0 xpass=0 xfail=1 skip=1 error=0
156 test ! -e success.log
158 test -f test-suite.log
160 $EGREP '(bail|success)\.test' stdout && exit 1
164 XFAIL: ok.test 2 # TODO
165 SKIP: ok.test 3 # SKIP
168 $FGREP ': ok.test' stdout > got