summaryrefslogtreecommitdiff
path: root/tests/tap-html.test
blob: ca0ffd0c14d7b07fa609d1b96132efb51426cde4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#! /bin/sh
# Copyright (C) 2011 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# TAP support:
#  - "check-html" and "recheck-html" targets
#  - reStructuredText -> HTML conversion

am_parallel_tests=yes
required=rst2html
. ./defs || Exit 1

cat > Makefile.am << 'END'
TEST_LOG_COMPILER = cat
TESTS = ok.test ko.test
END

. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"

cat > ok.test << 'END'
1..3
ok 1 - expected success
not ok 2 - expectred failure # TODO
ok 3 - skipped test # SKIP
END

cat > ko.test << 'END'
1..2
not ok 1 - unexpected failure
ok 2 - spurious success # TODO
Bail out! hard error
END

no_rst2html_error ()
{
  $EGREP '(test-suite\.log:[0-9]|WARNING|SEVERE)' output && Exit 1
  :
}

# Overriding TESTS should work with check-html.
TESTS=ok.test $MAKE -e check-html >output 2>&1 || { cat output; Exit 1; }
cat output
no_rst2html_error
test -f test-suite.html

mv output stdout
count_test_results total=3 pass=1 fail=0 xpass=0 xfail=1 skip=1 error=0

: > older
$sleep
$MAKE check-html >output 2>&1 && { cat output; Exit 1; }
cat output
no_rst2html_error
# test-suite.html should be remake if if it was up-to-date.
test -f test-suite.html
is_newest test-suite.html older

mv output stdout
count_test_results total=6 pass=1 fail=1 xpass=1 xfail=1 skip=1 error=1

rm -f ok.test
$MAKE recheck-html >output 2>&1 && { cat output; Exit 1; }
cat output
no_rst2html_error

mv output stdout
count_test_results total=3 pass=0 fail=1 xpass=1 xfail=0 skip=0 error=1

: