test init: refactor: new function 'am_setup_testdir'
[automake.git] / t / tap-xfail-tests.sh
blob94ae1c906117dc4685da98eba01cccb96ac44579
1 #! /bin/sh
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)
7 # any later version.
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 # TAP and $(XFAIL_TESTS): test results without directives are turned from
18 # PASS to XPASS and from FAIL to XFAIL; other results are unchanged.
20 . ./defs || exit 1
22 . tap-setup.sh
24 echo 'XFAIL_TESTS = $(TESTS)' >> Makefile
26 cat > all.test <<END
27 1..6
28 ok 1
29 not ok 2
30 ok 3 # TODO
31 not ok 4 # TODO
32 ok 5 # SKIP
33 # The next should count as a failure (and thus will be
34 # rendered into an expected failure by XFAIL_TESTS).
35 not ok 6 # SKIP
36 Bail out!
37 END
39 $MAKE check >stdout && { cat stdout; exit 1; }
40 cat stdout
42 count_test_results total=7 pass=0 fail=0 xpass=2 xfail=3 skip=1 error=1
44 grep '^XPASS: all\.test 1$' stdout
45 grep '^XFAIL: all\.test 2$' stdout
46 grep '^XPASS: all\.test 3 # TODO' stdout
47 grep '^XFAIL: all\.test 4 # TODO' stdout
48 grep '^SKIP: all\.test 5 # SKIP' stdout
49 grep '^XFAIL: all\.test 6 # SKIP' stdout
50 grep '^ERROR: all\.test - Bail out!' stdout
52 # Check that the exit status of the testsuite is indeed 0 when we
53 # would expect success.
55 cat > all.test <<END
56 1..3
57 not ok 1
58 ok 2 # SKIP
59 not ok 3 # TODO
60 END
62 $MAKE check >stdout || { cat stdout; exit 1; }
63 cat stdout
65 count_test_results total=3 pass=0 fail=0 xpass=0 xfail=2 skip=1 error=0