Commit d79f81cf authored by Jan Kiene's avatar Jan Kiene
Browse files

unify split and non-split case and handle "whole" suffix

parent ecc40ef3
Loading
Loading
Loading
Loading
Loading
+21 −33
Original line number Diff line number Diff line
@@ -145,7 +145,7 @@ if __name__ == "__main__":
    count = {"PASS": 0, "FAIL": 0, "ERROR": 0}

    # filter out skipped testcases
    testcases = [tc for tc in testcases if tc.find(".//skipped") is not None]
    testcases = [tc for tc in testcases if tc.find(".//skipped") is None]

    for testcase in testcases:
        filename = testcase.get(
@@ -153,24 +153,16 @@ if __name__ == "__main__":
        )
        fulltestname = filename + "::" + testcase.get("name")

        # only include the properties listed above
        # we need to find all occurences with any suffixes to also handle the split-comparison
        # runs correctly
        properties_found = {
            p.get("name"): p.get("value") for p in testcase.findall(".//property")
            p.get("name"): p.get("value")
            for p in testcase.findall(".//property")
            if "CHANNEL" not in p.get("name")
            and any(p_listed in p.get("name") for p_listed in PROPERTIES)
        }

        # Extract number of splits, if any
        splits = [p.split("_")[-1] for p in properties_found if "split" in p]
        splits = list(dict.fromkeys(splits))  # Remove duplicates, keeping order

        if splits:
            properties_values = {}
            for s in splits:
                properties_suffixed = [p + "_" + s for p in PROPERTIES]
                properties_values[s] = [
                    str(properties_found.get(p)) for p in properties_suffixed
                ]
        else:
            properties_values = [str(properties_found.get(p)) for p in PROPERTIES]

        # Identify format and category (mode of operation)
        # For the format, favor the earliest match in the test case name
        fmt = get_format_from_fulltestname(fulltestname)
@@ -179,20 +171,21 @@ if __name__ == "__main__":

        testresult = get_testresult(testcase)

        # get all present suffixes
        pattern = re.compile("|".join(PROPERTIES))
        suffixes = set(pattern.sub("", p) for p in properties_found)

        # record the result for all suffixes
        # For ERROR cases, both a FAIL and an ERROR result is generated.
        # Here, a FAIL would be overwritten with an ERROR result since it has the same name.
        if splits:
            for s in splits:
                fulltestname_split = f"{fulltestname}-{s}"
                results[fmt][cat][fulltestname_split] = {"Result": testresult}
                for propertyname, propertyvalue in zip(
                    PROPERTIES, properties_values[s]
                ):
                    results[fmt][cat][fulltestname_split][propertyname] = propertyvalue
        else:
            results[fmt][cat][fulltestname] = {"Result": testresult}
            for propertyname, propertyvalue in zip(PROPERTIES, properties_values):
                results[fmt][cat][fulltestname][propertyname] = propertyvalue
        for s in suffixes:
            fulltestname_suffix = f"{fulltestname}{s}"
            results[fmt][cat][fulltestname_suffix] = {"Result": testresult}
            for propertyname in PROPERTIES:
                results[fmt][cat][fulltestname_suffix][propertyname] = properties_found[
                    f"{propertyname}{s}"
                ]
        count[testresult] += 1

    header = ["testcase", "Format", "Category", "Result"] + PROPERTIES

@@ -204,11 +197,6 @@ if __name__ == "__main__":
            for cat in CATEGORIES:
                results[fmt][cat] = dict(sorted(results[fmt][cat].items()))
                for test in results[fmt][cat]:
                    if splits:
                        if "split1" in test:
                            count[results[fmt][cat][test]["Result"]] += 1
                    else:
                        count[results[fmt][cat][test]["Result"]] += 1
                    line = (
                        ";".join(
                            [test, fmt, cat] + list(results[fmt][cat][test].values())