summaryrefslogtreecommitdiff
path: root/selftest/format-subunit
blob: 1967fb4f852ba654eb4b2f85dc2e4c42d547e3c3 (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
#!/usr/bin/env python
# Pretty-format subunit output
# Copyright (C) 2008-2010 Jelmer Vernooij <jelmer@samba.org>
# Published under the GNU GPL, v3 or later

import optparse
import os
import sys

import subunithelper

parser = optparse.OptionParser("format-subunit [options]")
parser.add_option("--verbose", action="store_true",
	help="Be verbose")
parser.add_option("--immediate", action="store_true", 
	help="Show failures immediately, don't wait until test run has finished")
parser.add_option("--prefix", type="string", default=".",
	help="Prefix to write summary to")

opts, args = parser.parse_args()

statistics = {
	'SUITES_FAIL': 0,
	'TESTS_UNEXPECTED_OK': 0,
	'TESTS_EXPECTED_OK': 0,
	'TESTS_UNEXPECTED_FAIL': 0,
	'TESTS_EXPECTED_FAIL': 0,
	'TESTS_ERROR': 0,
	'TESTS_SKIP': 0,
}

msg_ops = PlainFormatter(os.path.join(opts.prefix, "summary"), opts.verbose, opts.immediate, statistics)

expected_ret = subunithelper.parse_results(msg_ops, statistics, sys.stdin)

msg_ops.summary()

sys.exit(expected_ret)