Improve meson test results reporting

Support the output of `meson test` in addition to `ninja test`, since
the meson docs recommend running `meson test`.

Also add a new unit test to cover some of the test result summary line
differences.

Fixes #323

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
This commit is contained in:
Patrick McCarty
2020-01-30 16:10:14 -08:00
committed by William Douglas
parent c3dc981d95
commit 756d1871a8
2 changed files with 37 additions and 13 deletions
+20 -13
View File
@@ -136,23 +136,30 @@ def convert_int(intstr):
def parse_meson_test(lines):
"""Parse outout of meson tests logs."""
"""Parse output of meson tests logs."""
global total_pass
global total_xfail
global total_fail
global total_skip
for line in lines:
line = line.rstrip().split()
if len(line) != 2:
lsplit = line.rstrip().split()
if len(lsplit) == 2:
val = lsplit[-1]
if re.search(r'^ok:', line, flags=re.I):
total_pass += convert_int(val)
elif re.search(r'^fail:', line, flags=re.I):
total_fail += convert_int(val)
elif re.search(r'^skip(ped)?:', line, flags=re.I):
total_skip += convert_int(val)
elif re.search(r'^timeout:', line, flags=re.I):
# Count timeouts as failures.
total_fail += convert_int(val)
elif len(lsplit) == 3:
val = lsplit[-1]
if re.search(r'^expected fail:', line, flags=re.I):
total_xfail += convert_int(val)
else:
continue
if line[0] == 'OK:':
total_pass = convert_int(line[1])
elif line[0] == 'FAIL:':
total_fail = convert_int(line[1])
elif line[0] == 'SKIP:':
total_skip = convert_int(line[1])
elif line[0] == 'TIMEOUT:':
# Count timeouts as failures.
total_fail = convert_int(line[1])
def parse_log(log, pkgname=''):
@@ -188,7 +195,7 @@ def parse_log(log, pkgname=''):
else:
incheck = True
if "/usr/bin/meson test" in line:
if "meson test" in line:
zero_test_data()
parse_meson_test(lines[idx:])
break
+17
View File
@@ -456,6 +456,23 @@ pats = [
'SKIP: 0\n'
'TIMEOUT: 0\n',
[16, 16, 0, 0, 0, 0, 0, 0, 0, 0]),
# gstreamer (uses meson / ninja)
('+ meson test -C builddir\n'
"ninja: Entering directory `builddir'\n"
'ninja: no work to do.\n'
'1/6 gst_gst OK 0.40 s\n'
'2/6 gst_gstabi FAIL 0.35 s\n'
'3/6 pipelines_stress OK 10.49 s\n'
'4/6 generic_sinks EXPECTEDFAIL 4.12 s\n'
'5/6 gst_gstcpp OK 0.37 s\n'
'6/6 libs_gstlibscpp OK 0.03 s\n'
'Ok: 4\n'
'Expected Fail: 1\n'
'Fail: 1\n'
'Unexpected Pass: 0\n'
'Skipped: 0\n'
'Timeout: 0\n',
[6, 4, 1, 1, 0, 0, 0, 0, 0, 0]),
]
backup_zero_test_data = count.zero_test_data