summaryrefslogtreecommitdiffstats
path: root/selftest/format-subunit
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 17:20:00 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 17:20:00 +0000
commit8daa83a594a2e98f39d764422bfbdbc62c9efd44 (patch)
tree4099e8021376c7d8c05bdf8503093d80e9c7bad0 /selftest/format-subunit
parentInitial commit. (diff)
downloadsamba-8daa83a594a2e98f39d764422bfbdbc62c9efd44.tar.xz
samba-8daa83a594a2e98f39d764422bfbdbc62c9efd44.zip
Adding upstream version 2:4.20.0+dfsg.upstream/2%4.20.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'selftest/format-subunit')
-rwxr-xr-xselftest/format-subunit52
1 files changed, 52 insertions, 0 deletions
diff --git a/selftest/format-subunit b/selftest/format-subunit
new file mode 100755
index 0000000..c7ec579
--- /dev/null
+++ b/selftest/format-subunit
@@ -0,0 +1,52 @@
+#!/usr/bin/env python3
+# vim: expandtab
+# 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 signal
+import sys
+
+sys.path.insert(0, "bin/python")
+
+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()
+
+def handle_sigint(sig, stack):
+ sys.exit(0)
+
+signal.signal(signal.SIGINT, handle_sigint)
+
+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 = subunithelper.PlainFormatter(opts.verbose, opts.immediate, statistics)
+
+expected_ret = subunithelper.parse_results(msg_ops, statistics, sys.stdin)
+
+summaryfile = os.path.join(opts.prefix, "summary")
+
+msg_ops.write_summary(summaryfile)
+
+print("\nThere might be more detail in "
+ f"{os.path.join(opts.prefix, 'subunit')} or {summaryfile}.")
+
+sys.exit(expected_ret)