VERSION: Disable git snapshots for the 4.2.5 release.
[Samba.git] / selftest / format-subunit
blob5da56beb09046f7e76be5a5c205b500c572cd96e
1 #!/usr/bin/env python
2 # vim: expandtab
3 # Pretty-format subunit output
4 # Copyright (C) 2008-2010 Jelmer Vernooij <jelmer@samba.org>
5 # Published under the GNU GPL, v3 or later
7 import optparse
8 import os
9 import signal
10 import sys
12 sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../lib/subunit/python"))
13 sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../lib/testtools"))
14 sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../lib/mimeparse"))
15 sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../lib/extras"))
17 import subunithelper
19 parser = optparse.OptionParser("format-subunit [options]")
20 parser.add_option("--verbose", action="store_true",
21 help="Be verbose")
22 parser.add_option("--immediate", action="store_true",
23 help="Show failures immediately, don't wait until test run has finished")
24 parser.add_option("--prefix", type="string", default=".",
25 help="Prefix to write summary to")
27 opts, args = parser.parse_args()
29 def handle_sigint(sig, stack):
30 sys.exit(0)
31 signal.signal(signal.SIGINT, handle_sigint)
33 statistics = {
34 'SUITES_FAIL': 0,
35 'TESTS_UNEXPECTED_OK': 0,
36 'TESTS_EXPECTED_OK': 0,
37 'TESTS_UNEXPECTED_FAIL': 0,
38 'TESTS_EXPECTED_FAIL': 0,
39 'TESTS_ERROR': 0,
40 'TESTS_SKIP': 0,
43 msg_ops = subunithelper.PlainFormatter(opts.verbose, opts.immediate, statistics)
45 expected_ret = subunithelper.parse_results(msg_ops, statistics, sys.stdin)
47 summaryfile = os.path.join(opts.prefix, "summary")
49 msg_ops.write_summary(summaryfile)
51 print "\nA summary with detailed information can be found in:"
52 print " %s" % summaryfile
54 sys.exit(expected_ret)