2010-03-29 22:25:25 +02:00
#!/usr/bin/env python
2010-03-30 00:30:52 +02:00
# vim: expandtab
2009-06-03 17:16:56 +02:00
# Pretty-format subunit output
2010-03-29 22:25:25 +02:00
# Copyright (C) 2008-2010 Jelmer Vernooij <jelmer@samba.org>
2009-06-03 17:16:56 +02:00
# Published under the GNU GPL, v3 or later
2010-03-29 22:25:25 +02:00
import optparse
import os
2010-03-30 02:39:50 +02:00
import signal
2010-03-29 22:25:25 +02:00
import sys
2009-06-04 13:49:11 +02:00
2014-11-04 20:37:41 +00:00
sys.path.insert(0, "bin/python")
2010-03-31 04:51:05 +02:00
2010-03-31 04:52:13 +02:00
import subunithelper
2010-03-30 00:30:52 +02:00
2010-03-29 22:25:25 +02:00
parser = optparse.OptionParser("format-subunit [options]")
parser.add_option("--verbose", action="store_true",
2010-03-30 00:30:52 +02:00
help="Be verbose")
2014-12-14 19:38:48 +00:00
parser.add_option("--immediate", action="store_true",
2010-03-30 00:30:52 +02:00
help="Show failures immediately, don't wait until test run has finished")
2010-03-29 22:25:25 +02:00
parser.add_option("--prefix", type="string", default=".",
2010-03-30 00:30:52 +02:00
help="Prefix to write summary to")
2009-06-04 13:49:11 +02:00
2010-03-29 22:25:25 +02:00
opts, args = parser.parse_args()
2009-06-04 13:49:11 +02:00
2010-10-02 18:40:44 +02:00
def handle_sigint(sig, stack):
2014-11-01 08:38:31 -07:00
sys.exit(0)
2010-10-02 18:40:44 +02:00
signal.signal(signal.SIGINT, handle_sigint)
2010-03-29 22:25:25 +02:00
statistics = {
2010-03-30 00:30:52 +02:00
'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,
2010-03-29 22:25:25 +02:00
}
2009-06-04 13:49:11 +02:00
2010-10-02 18:40:44 +02:00
msg_ops = subunithelper.PlainFormatter(opts.verbose, opts.immediate, statistics)
2009-06-04 13:49:11 +02:00
2010-03-29 22:25:25 +02:00
expected_ret = subunithelper.parse_results(msg_ops, statistics, sys.stdin)
2009-06-04 13:49:11 +02:00
2010-10-02 18:40:44 +02:00
summaryfile = os.path.join(opts.prefix, "summary")
msg_ops.write_summary(summaryfile)
print "\nA summary with detailed information can be found in:"
print " %s" % summaryfile
2009-06-04 13:49:11 +02:00
2010-03-29 22:25:25 +02:00
sys.exit(expected_ret)