From 7da94cc4a664521be279b019e9f32121cd410193 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 11 Apr 2010 01:39:06 +0200 Subject: subunit: Support formatting compatible with upstream subunit, for consistency. Upstream subunit makes a ":" after commands optional, so I've fixed any places where we might trigger commands accidently. I've filed a bug about this in subunit. --- selftest/subunithelper.py | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'selftest/subunithelper.py') diff --git a/selftest/subunithelper.py b/selftest/subunithelper.py index 7d6896ad3c..d03a1d0441 100644 --- a/selftest/subunithelper.py +++ b/selftest/subunithelper.py @@ -32,19 +32,25 @@ def parse_results(msg_ops, statistics, fh): l = fh.readline() if l == "": break - if l.startswith("test: ") or l.startswith("testing: "): + parts = l.split(None, 1) + if not len(parts) == 2 or not l.startswith(parts[0]): + continue + command = parts[0].rstrip(":") + arg = parts[1] + if command in ("test", "testing"): + msg_ops.control_msg(l) + msg_ops.start_test(arg.rstrip()) + open_tests.append(arg.rstrip()) + elif command == "time": msg_ops.control_msg(l) - name = l.split(":", 1)[1].strip() - msg_ops.start_test(name) - open_tests.append(name) - elif l.startswith("time: "): grp = re.match( - "^time: (\d+)-(\d+)-(\d+) (\d+):(\d+):(\d+)\n", l) + "(\d+)-(\d+)-(\d+) (\d+):(\d+):(\d+)\n", arg) msg_ops.report_time(time.mktime((int(grp.group(1)), int(grp.group(2)), int(grp.group(3)), int(grp.group(4)), int(grp.group(5)), int(grp.group(6)), 0, 0, 0))) - elif re.match("^(" + "|".join(VALID_RESULTS) + "): (.*?)( \[)?([ \t]*)( multipart)?\n", l): + elif command in VALID_RESULTS: msg_ops.control_msg(l) - grp = re.match("^(" + "|".join(VALID_RESULTS) + "): (.*?)( \[)?([ \t]*)( multipart)?\n", l) - (result, testname, hasreason) = (grp.group(1), grp.group(2), grp.group(3)) + result = command + grp = re.match("(.*?)( \[)?([ \t]*)( multipart)?\n", arg) + (testname, hasreason) = (grp.group(1), grp.group(2)) if hasreason: reason = "" # reason may be specified in next lines @@ -122,10 +128,10 @@ def parse_results(msg_ops, statistics, fh): msg_ops.end_testsuite(testname, "xfail", reason) elif result == "testsuite-error": msg_ops.end_testsuite(testname, "error", reason) - elif l.startswith("testsuite: "): - msg_ops.start_testsuite(l.split(":", 1)[1].strip()) - elif l.startswith("progress: "): - arg = l.split(":", 1)[1].strip() + elif command == "testsuite": + msg_ops.start_testsuite(arg.strip()) + elif command == "progress": + arg = arg.strip() if arg == "pop": msg_ops.progress(None, subunit.PROGRESS_POP) elif arg == "push": -- cgit