2 # Copyright (C) 2011 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 # Custom test drivers: "abstract" XFAIL_TESTS support.
22 cat >> configure.in <<'END'
24 AC_SUBST([ac_xfail_tests], ['x5.test x6$(test_suffix)'])
25 AC_CONFIG_FILES([sub1/Makefile sub2/Makefile])
29 cat > Makefile.am <<'END'
31 TEST_LOG_DRIVER = $(srcdir)/td
32 TESTS = pass.test xfail.test
33 XFAIL_TESTS = xfail.test
38 cat > sub1/Makefile.am <<END
41 TEST_LOG_DRIVER = \$(top_srcdir)/td
43 # XFAIL_TESTS should gracefully handle TAB characters, and multiple
45 XFAIL_TESTS =\$(empty)${tab}x1.test x2.test${tab}x3.test${tab}\
46 x4.test ${tab} x5.test x6.test${tab}\$(empty)
48 TESTS = pass.test x1.test x2.test x3.test x4.test x5.test x6.test
51 cat > sub2/Makefile.am <<'END'
52 AUTOMAKE_OPTIONS = -Wno-portability-recursive
54 TEST_LOG_DRIVER = $(srcdir)/../td
56 # XFAIL_TESTS should gracefully AC_SUBST @substitution@ and
57 # make variables indirections.
58 an_xfail_test = x1.test
63 XFAIL_TESTS = $(an_xfail_test) x2.test @nihil@ x3${test_suffix}
64 XFAIL_TESTS += $($(v1)$(v2)) x4.test @ac_xfail_tests@
66 TESTS = pass.test x1.test x2.test x3.test x4.test x5.test x6.test
69 cat > pass.test <<'END'
74 cat > xfail.test <<'END'
79 chmod a+x pass.test xfail.test
81 cp pass.test sub1/pass.test
82 cp pass.test sub2/pass.test
84 for i in 1 2 3 4 5 6; do
85 cp xfail.test sub1/x$i.test
86 cp xfail.test sub2/x$i.test
96 while test $# -gt 0; do
98 --test-name) test_name=$2; shift;;
99 --expect-failure) expect_failure=$2; shift;;
100 --log-file) log_file=$2; shift;;
101 --trs-file) trs_file=$2; shift;;
103 --color-tests) shift;;
104 --enable-hard-errors) shift;;
105 # Explicitly terminate option list.
108 *) echo "$0: invalid option/argument: '$1'" >&2; exit 2;;
114 case $st,$expect_failure in
116 echo "PASS: $test_name" | tee "$log_file"
117 echo ":test-result: PASS" > "$trs_file"
120 echo "FAIL: $test_name" | tee "$log_file"
121 echo ":test-result: FAIL" > "$trs_file"
124 echo "XPASS: $test_name" | tee "$log_file"
125 echo ":test-result: XPASS" > "$trs_file"
128 echo "XFAIL: $test_name" | tee "$log_file"
129 echo ":test-result: XFAIL" > "$trs_file"
132 echo "INTERNAL ERROR" >&2
145 $MAKE check >stdout || { cat stdout; Exit 1; }
147 test `grep -c '^PASS:' stdout` -eq 3
148 test `grep -c '^XFAIL:' stdout` -eq 13
150 for dir in sub1 sub2; do
154 $MAKE check >stdout && { cat stdout; Exit 1; }
156 test "`cat pass.trs`" = ":test-result: FAIL"
157 test "`cat x1.trs`" = ":test-result: XPASS"
158 test "`cat x2.trs`" = ":test-result: XFAIL"
159 grep '^FAIL: pass\.test$' stdout
160 grep '^XPASS: x1\.test$' stdout
161 grep '^XFAIL: x2\.test$' stdout
162 count_test_results total=7 pass=0 xpass=1 fail=1 xfail=5 skip=0 error=0