report-xfstests.py: Count the number of passing tests

Rather than relying on the `tests` field, which may be inaccurate for
some reason.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
This commit is contained in:
Anna Schumaker 2022-02-08 13:41:07 -05:00
parent 31166081bf
commit e5a8e46cd9
2 changed files with 5 additions and 2 deletions

View File

@ -25,11 +25,11 @@ class NotRun(GObject.GObject):
class Results(Property):
def __init__(self, properties):
total = properties["TESTS"]
time = properties["TIME"]
passed = properties["PASSED"]
failed = properties["FAILURES"]
skipped = properties["SKIPPED"]
passed = int(total) - (int(skipped) + int(failed))
total = int(passed) + int(failed) + int(skipped)
Property.__init__(self, "RESULTS",
f"Ran {total} tests in {time} seconds: " \
f"{passed} passed, {failed} failed, {skipped} skipped")

View File

@ -52,6 +52,7 @@ class TestResults:
for file in sorted(testdir.iterdir()):
self.versions.append(file.stem)
passed = 0
root = xml.etree.ElementTree.parse(file).getroot()
for prop in root.attrib.keys():
@ -65,12 +66,14 @@ class TestResults:
elif elm.tag == "testcase":
if len(elm) == 0:
result = PassingTest(elm)
passed += 1
elif elm[0].tag == "skipped":
result = SkippedTest(elm)
self.skipped.add(result.message)
elif elm[0].tag == "failure":
result = FailedTest(elm)
self.add_testcase(elm.attrib["name"], file.stem, result)
self.set_property("passed", file.stem, str(passed))
def set_property(self, name, vers, value):
self.properties.setdefault(vers, dict())[name.upper()] = value