diff --git a/autospec/count.py b/autospec/count.py index 48214eb..38cc45f 100644 --- a/autospec/count.py +++ b/autospec/count.py @@ -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 diff --git a/tests/test_count.py b/tests/test_count.py index d1761b3..1de3848 100644 --- a/tests/test_count.py +++ b/tests/test_count.py @@ -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