summaryrefslogtreecommitdiff
path: root/selftest/subunithelper.py
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2010-03-30 00:30:52 +0200
committerJelmer Vernooij <jelmer@samba.org>2010-03-30 01:08:20 +0200
commitef3fb75261d1ce0d10da3e0c636c895aeb8b8441 (patch)
treea976d17d164d4ecfc17cbef3f9933a73497f16a3 /selftest/subunithelper.py
parent0c78368a3108ad7437a20fac7e6da42ecf6f348a (diff)
downloadsamba-ef3fb75261d1ce0d10da3e0c636c895aeb8b8441.tar.gz
samba-ef3fb75261d1ce0d10da3e0c636c895aeb8b8441.tar.bz2
samba-ef3fb75261d1ce0d10da3e0c636c895aeb8b8441.zip
selftest: Replace perl subunit formatter with python subunit formatter,
so we can leverage the work happening in python-subunit.
Diffstat (limited to 'selftest/subunithelper.py')
-rw-r--r--selftest/subunithelper.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/selftest/subunithelper.py b/selftest/subunithelper.py
index 3cd0f013d0..770b14befa 100644
--- a/selftest/subunithelper.py
+++ b/selftest/subunithelper.py
@@ -28,24 +28,29 @@ def parse_results(msg_ops, statistics, fh):
while fh:
l = fh.readline()
+ if l == "":
+ break
if l.startswith("test: "):
msg_ops.control_msg(l)
name = l.split(":", 1)[1].strip()
msg_ops.start_test(name)
open_tests.append(name)
elif l.startswith("time: "):
- (year, month, day, hour, minute, second) = re.match(
- "^time: (\d+)-(\d+)-(\d+) (\d+):(\d+):(\d+)\n/", l)
- msg_ops.report_time(time.mktime(second, minute, hour, day, month-1, year-1900))
+ grp = re.match(
+ "^time: (\d+)-(\d+)-(\d+) (\d+):(\d+):(\d+)\n", l)
+ 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):
msg_ops.control_msg(l)
- (result, testname, hasreason) = re.match("^(" + "|".join(VALID_RESULTS) + "): (.*?)( \[)?([ \t]*)( multipart)?\n", l)
+ grp = re.match("^(" + "|".join(VALID_RESULTS) + "): (.*?)( \[)?([ \t]*)( multipart)?\n", l)
+ (result, testname, hasreason) = (grp.group(1), grp.group(2), grp.group(3))
if hasreason:
reason = ""
# reason may be specified in next lines
terminated = False
while fh:
l = fh.readline()
+ if l == "":
+ break
msg_ops.control_msg(l)
if l == "]\n":
terminated = True
@@ -58,6 +63,8 @@ def parse_results(msg_ops, statistics, fh):
msg_ops.end_test(testname, "error", 1,
"reason (%s) interrupted" % result)
return 1
+ else:
+ reason = None
if result in ("success", "successful"):
open_tests.pop() #FIXME: Check that popped value == $testname
statistics['TESTS_EXPECTED_OK']+=1
@@ -104,12 +111,6 @@ def parse_results(msg_ops, statistics, fh):
"was started but never finished!")
statistics['TESTS_ERROR']+=1
- # if the Filter module is in use, it will have the right counts
- if 'total_error' in msg_ops:
- statistics['TESTS_ERROR'] = msg_ops['total_error']
- statistics['TESTS_UNEXPECTED_FAIL'] = msg_ops['total_fail']
- statistics['TESTS_EXPECTED_FAIL'] = msg_ops['total_xfail']
-
if statistics['TESTS_ERROR'] > 0:
return 1
if statistics['TESTS_UNEXPECTED_FAIL'] > 0: