Commit aaf0aa59 authored by norvell's avatar norvell
Browse files

Remove obsolete parse_mld.py and add sorting of results in parse_mld_xml.py

parent fa428a2c
Loading
Loading
Loading
Loading

scripts/parse_mld.py

deleted100644 → 0
+0 −32
Original line number Diff line number Diff line
#!/usr/bin/python3

import argparse
import re

# Main routine
if __name__ == "__main__":
    parser = argparse.ArgumentParser(
        description="Parse HTML report to extract MLD values"
    )
    parser.add_argument(
        "html_report", type=str, help="HTML report input file, e.g. report.html"
    )
    parser.add_argument("csv_file", type=str, help="Output CSV file, e.g. output.csv")
    args = parser.parse_args()
    html_report = args.html_report
    csv_file = args.csv_file

    mld = {}

    with open(html_report, "r") as infile:
        for line in infile.readlines():
            if "col-name" in line:
                test_name = re.search("\[(.*)\]", line).group(1)
                mld[test_name] = 0.0
            if "MLD" in line:
                mld_val = float(line.split()[1])
                mld[test_name] = mld_val

    with open(csv_file, "w") as outfile:
        for test_name in mld:
            outfile.write(test_name + ";" + str(mld[test_name]) + "\n")
+26 −20
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ import argparse
from xml.etree import ElementTree

"""
Parse a junit report and create a MLD summary report.
Parse a junit report and create an MLD summary report.
"""

PROPERTIES = ["MLD", "MAXIMUM ABS DIFF"]
@@ -34,9 +34,7 @@ if __name__ == "__main__":

    testcases = tree.findall(".//testcase")
    
    with open(csv_file, "w") as outfile:
        headerline = ";".join(["testcase"] + PROPERTIES) + "\n"
        outfile.write(headerline)
    results_unsorted = {}

    for testcase in testcases:
        if testcase.find(".//skipped") is None:
@@ -55,4 +53,12 @@ if __name__ == "__main__":
            }
            properties_values = [str(properties_found.get(p)) for p in PROPERTIES]
            outline = ";".join([fulltestname] + properties_values) + "\n"
                outfile.write(outline)
            results_unsorted[fulltestname] = outline

    results_sorted = dict(sorted(results_unsorted.items()))

    with open(csv_file, "w") as outfile:
        headerline = ";".join(["testcase"] + PROPERTIES) + "\n"
        outfile.write(headerline)
        for test in results_sorted:
            outfile.write(results_sorted[test])