Loading ci/basop-pages/create_report_pages.py +33 −9 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ import pathlib import argparse from functools import partial FORMATS = ['Stereo', 'ISM', 'Multichannel','MASA','SBA', 'OSBA', 'OMASA', 'Renderer'] FORMATS = ["Stereo", "ISM", "Multichannel", "MASA", "SBA", "OSBA", "OMASA", "Renderer"] CSV_DELIM = ";" SUBPAGE_TMPL_CSS = """ Loading Loading @@ -100,7 +100,15 @@ ARROW_DOWN = '<span class="arrowdown">⬂</span>' # expected columns. actual columns are filtered from the incoming data later, this # is mainly for controlling the order in the output table COLUMNS = ["testcase", "Format", "Category", "Result", "MLD", "MAXIMUM ABS DIFF", "MIN_SSNR"] COLUMNS = [ "testcase", "Format", "Category", "Result", "MLD", "MAXIMUM ABS DIFF", "MIN_SSNR", ] COLUMNS_GLOBAL = COLUMNS[:1] COLUMNS_DIFFERENTIAL = COLUMNS[3:] COLUMNS_DIFFERENTIAL_NOT_MLD = COLUMNS_DIFFERENTIAL[2:] Loading Loading @@ -138,9 +146,27 @@ def create_subpage( tr_from_row(row, id_current, id_previous) for row in merged_reports ) if histogram: images_mld = f"<h2>MLD summary {job_name}</h2>\n" + " ".join([f"<img src=images/summary_{id_current}_MLD_{x}.png>" for x in FORMATS]) + f"\n<br><a href=\"images/summary_{id_current}_MLD.csv\">summary_{id_current}_MLD.csv</a>" images_ssnr = f"<h2>MIN_SSNR summary {job_name}</h2>\n" + " ".join([f"<img src=images/summary_{id_current}_SSNR_{x}.png>" for x in FORMATS]) + f"\n<br><a href=\"images/summary_{id_current}_SSNR.csv\">summary_{id_current}_SSNR.csv</a>" images_diff = f"<h2>MAX ABS DIFFERENCE summary {job_name}</h2>\n" + " ".join([f"<img src=images/summary_{id_current}_DIFF_{x}.png>" for x in FORMATS]) + f"\n<br><a href=\"images/summary_{id_current}_DIFF.csv\">summary_{id_current}_DIFF.csv</a>" images_mld = ( f"<h2>MLD summary {job_name}</h2>\n" + " ".join( [f"<img src=images/summary_{id_current}_MLD_{x}.png>" for x in FORMATS] ) + f'\n<br><a href="images/summary_{id_current}_MLD.csv">summary_{id_current}_MLD.csv</a>' ) images_ssnr = ( f"<h2>MIN_SSNR summary {job_name}</h2>\n" + " ".join( [f"<img src=images/summary_{id_current}_SSNR_{x}.png>" for x in FORMATS] ) + f'\n<br><a href="images/summary_{id_current}_SSNR.csv">summary_{id_current}_SSNR.csv</a>' ) images_diff = ( f"<h2>MAX ABS DIFFERENCE summary {job_name}</h2>\n" + " ".join( [f"<img src=images/summary_{id_current}_DIFF_{x}.png>" for x in FORMATS] ) + f'\n<br><a href="images/summary_{id_current}_DIFF.csv">summary_{id_current}_DIFF.csv</a>' ) else: images_mld = "" images_ssnr = "" Loading Loading @@ -315,11 +341,9 @@ if __name__ == "__main__": parser.add_argument("id_current", type=int) parser.add_argument("id_previous", type=int) parser.add_argument("job_name") parser.add_argument("--histogram", action='store_true') parser.add_argument("--histogram", action="store_true") args = parser.parse_args() create_subpage( args.html_out, args.csv_out, Loading scripts/create_histogram_summary.py +37 −21 Original line number Diff line number Diff line Loading @@ -3,8 +3,10 @@ import argparse import math import numpy as np import matplotlib # These steps are added as a precaution in case the gitlab runner matplotlib.use('Agg') # needs DISPLAY to render the plots, even if they are written to file. # These next three lines are added as a precaution in case the gitlab runner # needs DISPLAY to render the plots, even if they are written to file. import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt import csv import os Loading @@ -15,7 +17,6 @@ Parses a CSV report and creates a summary report. """ # Main routine if __name__ == "__main__": parser = argparse.ArgumentParser( Loading @@ -32,16 +33,16 @@ if __name__ == "__main__": parser.add_argument( "csv_image", type=str, nargs='?', nargs="?", help="Summary image file, e.g. summary.png", default = None default=None, ) parser.add_argument( "--measure", type=str, nargs=1, help="Measure, any of: MLD, DIFF, SSNR, default: MLD", default = ['MLD'] default=["MLD"], ) args = parser.parse_args() csv_report = args.csv_report Loading @@ -49,13 +50,17 @@ if __name__ == "__main__": csv_image = args.csv_image measure = args.measure[0] limits_per_measure = {'MLD':('MLD',[0, 5, 10, math.inf]), 'DIFF':('MAXIMUM ABS DIFF',[0, 1024, 16384, 32769]), 'SSNR':('MIN_SSNR',[-math.inf, 0, 20, 40, 60, 100])} limits_per_measure = { "MLD": ("MLD", [0, 5, 10, math.inf]), "DIFF": ("MAXIMUM ABS DIFF", [0, 1024, 16384, 32769]), "SSNR": ("MIN_SSNR", [-math.inf, 0, 20, 40, 60, 100]), } (measure_label, limits) = limits_per_measure[measure] # Load CSV report results_sorted = {} with open(csv_report,'r') as fp: reader = csv.reader(fp, delimiter=';') with open(csv_report, "r") as fp: reader = csv.reader(fp, delimiter=";") header = next(reader) keys = header[1:] for row in reader: Loading @@ -66,7 +71,9 @@ if __name__ == "__main__": # Output CSV file with open(csv_summary, "w") as fp: limits_labels = [f"{str(a)} --\n {str(b)}" for (a,b) in zip(limits[0:-1],limits[1:])] + ["None"] limits_labels = [ f"{str(a)} --\n {str(b)}" for (a, b) in zip(limits[0:-1], limits[1:]) ] + ["None"] # Zero difference is treated as a special category for MLD and MAXIMUM ABS DIFF if measure_label == "MLD" or measure_label == "MAXIMUM ABS DIFF": limits_labels = ["0"] + limits_labels Loading @@ -77,16 +84,25 @@ if __name__ == "__main__": fig, ax = plt.subplots() bottom = np.zeros(len(limits_labels)) for cat in CATEGORIES: values = [x for x in [m[measure_label] for m in results_sorted.values() if m["Format"] == fmt and m["Category"] == cat]] values = [ x for x in [ m[measure_label] for m in results_sorted.values() if m["Format"] == fmt and m["Category"] == cat ] ] # Zero difference is treated as a special category for MLD and MAXIMUM ABS DIFF if measure_label == "MLD" or measure_label == "MAXIMUM ABS DIFF": val = [float(x) for x in values if x != 'None' and x != '0' and x != ''] zero = [sum([1 for x in values if x == '0'])] none = [sum([1 for x in values if x == 'None' or x == ''])] val = [ float(x) for x in values if x != "None" and x != "0" and x != "" ] zero = [sum([1 for x in values if x == "0"])] none = [sum([1 for x in values if x == "None" or x == ""])] else: val = [float(x) for x in values if x != 'None' and x != ''] val = [float(x) for x in values if x != "None" and x != ""] zero = [] none = [sum([1 for x in values if x == 'None' or x == ''])] none = [sum([1 for x in values if x == "None" or x == ""])] hist, _ = np.histogram(val, limits) data = np.array(zero + list(hist) + none) Loading scripts/parse_xml_report.py +49 −24 Original line number Diff line number Diff line Loading @@ -12,10 +12,24 @@ Parse a junit report and create a summary report. PROPERTIES = ["MLD", "MAXIMUM ABS DIFF", "MIN_SSNR"] FORMATS = {'Stereo':r'stereo', 'ISM':r'ISM', 'Multichannel':r'Multi-channel', 'MASA':r'(?<!O)MASA','SBA':r'(?<!O)SBA', 'OSBA':r'OSBA', 'OMASA':r'OMASA', 'Renderer':r'renderer'} FORMATS = { "Stereo": r"stereo", "ISM": r"ISM", "Multichannel": r"Multi-channel", "MASA": r"(?<!O)MASA", "SBA": r"(?<!O)SBA", "OSBA": r"OSBA", "OMASA": r"OMASA", "Renderer": r"renderer", } CATEGORIES = {'Normal operation':r'.*', 'DTX':r'DTX', 'PLC':r'%', 'Bitrate switching':r'br sw|bitrate switching', 'JBM':r'JBM' } CATEGORIES = { "Normal operation": r".*", "DTX": r"DTX", "PLC": r"%", "Bitrate switching": r"br sw|bitrate switching", "JBM": r"JBM", } # Main routine if __name__ == "__main__": Loading @@ -27,11 +41,7 @@ if __name__ == "__main__": type=str, help="XML junit report input file, e.g. report-junit.xml", ) parser.add_argument( "csv_file", type=str, help="Output CSV file, e.g. report.csv" ) parser.add_argument("csv_file", type=str, help="Output CSV file, e.g. report.csv") args = parser.parse_args() xml_report = args.xml_report csv_file = args.csv_file Loading @@ -47,7 +57,7 @@ if __name__ == "__main__": results[fmt] = {} for cat in CATEGORIES: results[fmt][cat] = {} count = {'PASS':0,'FAIL':0,'ERROR':0} count = {"PASS": 0, "FAIL": 0, "ERROR": 0} for testcase in testcases: if testcase.find(".//skipped") is None: Loading @@ -61,29 +71,39 @@ if __name__ == "__main__": fulltestname = testcase.get("file") + "::" + testcase.get("name") 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 testcase.find('failure') is not None: testresult = 'FAIL' elif testcase.find('error') is not None: testresult = 'ERROR' if testcase.find("failure") is not None: testresult = "FAIL" elif testcase.find("error") is not None: testresult = "ERROR" else: testresult = 'PASS' testresult = "PASS" 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 = min([(f, re.search(FORMATS[f], fulltestname, re.IGNORECASE).end()) for f in FORMATS if re.search(FORMATS[f], fulltestname, re.IGNORECASE)] , key=lambda x: x[1])[0] fmt = min( [ (f, re.search(FORMATS[f], fulltestname, re.IGNORECASE).end()) for f in FORMATS if re.search(FORMATS[f], fulltestname, re.IGNORECASE) ], key=lambda x: x[1], )[0] # Note that only one category is selected, even though several may match, e.g. bitrate switching + JBM. Here the last match is picked. cat = [c for c in CATEGORIES if re.search(CATEGORIES[c], fulltestname, re.IGNORECASE)][-1] cat = [ c for c in CATEGORIES if re.search(CATEGORIES[c], fulltestname, re.IGNORECASE) ][-1] # 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. results[fmt][cat][fulltestname] = {'Result':testresult} results[fmt][cat][fulltestname] = {"Result": testresult} for propertyname, propertyvalue in zip(PROPERTIES, properties_values): results[fmt][cat][fulltestname][propertyname] = propertyvalue Loading @@ -98,7 +118,12 @@ if __name__ == "__main__": results[fmt][cat] = dict(sorted(results[fmt][cat].items())) for test in results[fmt][cat]: count[results[fmt][cat][test]["Result"]] += 1 line = ";".join([test, fmt, cat] + list(results[fmt][cat][test].values())) + "\n" line = ( ";".join( [test, fmt, cat] + list(results[fmt][cat][test].values()) ) + "\n" ) outfile.write(line) print( Loading Loading
ci/basop-pages/create_report_pages.py +33 −9 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ import pathlib import argparse from functools import partial FORMATS = ['Stereo', 'ISM', 'Multichannel','MASA','SBA', 'OSBA', 'OMASA', 'Renderer'] FORMATS = ["Stereo", "ISM", "Multichannel", "MASA", "SBA", "OSBA", "OMASA", "Renderer"] CSV_DELIM = ";" SUBPAGE_TMPL_CSS = """ Loading Loading @@ -100,7 +100,15 @@ ARROW_DOWN = '<span class="arrowdown">⬂</span>' # expected columns. actual columns are filtered from the incoming data later, this # is mainly for controlling the order in the output table COLUMNS = ["testcase", "Format", "Category", "Result", "MLD", "MAXIMUM ABS DIFF", "MIN_SSNR"] COLUMNS = [ "testcase", "Format", "Category", "Result", "MLD", "MAXIMUM ABS DIFF", "MIN_SSNR", ] COLUMNS_GLOBAL = COLUMNS[:1] COLUMNS_DIFFERENTIAL = COLUMNS[3:] COLUMNS_DIFFERENTIAL_NOT_MLD = COLUMNS_DIFFERENTIAL[2:] Loading Loading @@ -138,9 +146,27 @@ def create_subpage( tr_from_row(row, id_current, id_previous) for row in merged_reports ) if histogram: images_mld = f"<h2>MLD summary {job_name}</h2>\n" + " ".join([f"<img src=images/summary_{id_current}_MLD_{x}.png>" for x in FORMATS]) + f"\n<br><a href=\"images/summary_{id_current}_MLD.csv\">summary_{id_current}_MLD.csv</a>" images_ssnr = f"<h2>MIN_SSNR summary {job_name}</h2>\n" + " ".join([f"<img src=images/summary_{id_current}_SSNR_{x}.png>" for x in FORMATS]) + f"\n<br><a href=\"images/summary_{id_current}_SSNR.csv\">summary_{id_current}_SSNR.csv</a>" images_diff = f"<h2>MAX ABS DIFFERENCE summary {job_name}</h2>\n" + " ".join([f"<img src=images/summary_{id_current}_DIFF_{x}.png>" for x in FORMATS]) + f"\n<br><a href=\"images/summary_{id_current}_DIFF.csv\">summary_{id_current}_DIFF.csv</a>" images_mld = ( f"<h2>MLD summary {job_name}</h2>\n" + " ".join( [f"<img src=images/summary_{id_current}_MLD_{x}.png>" for x in FORMATS] ) + f'\n<br><a href="images/summary_{id_current}_MLD.csv">summary_{id_current}_MLD.csv</a>' ) images_ssnr = ( f"<h2>MIN_SSNR summary {job_name}</h2>\n" + " ".join( [f"<img src=images/summary_{id_current}_SSNR_{x}.png>" for x in FORMATS] ) + f'\n<br><a href="images/summary_{id_current}_SSNR.csv">summary_{id_current}_SSNR.csv</a>' ) images_diff = ( f"<h2>MAX ABS DIFFERENCE summary {job_name}</h2>\n" + " ".join( [f"<img src=images/summary_{id_current}_DIFF_{x}.png>" for x in FORMATS] ) + f'\n<br><a href="images/summary_{id_current}_DIFF.csv">summary_{id_current}_DIFF.csv</a>' ) else: images_mld = "" images_ssnr = "" Loading Loading @@ -315,11 +341,9 @@ if __name__ == "__main__": parser.add_argument("id_current", type=int) parser.add_argument("id_previous", type=int) parser.add_argument("job_name") parser.add_argument("--histogram", action='store_true') parser.add_argument("--histogram", action="store_true") args = parser.parse_args() create_subpage( args.html_out, args.csv_out, Loading
scripts/create_histogram_summary.py +37 −21 Original line number Diff line number Diff line Loading @@ -3,8 +3,10 @@ import argparse import math import numpy as np import matplotlib # These steps are added as a precaution in case the gitlab runner matplotlib.use('Agg') # needs DISPLAY to render the plots, even if they are written to file. # These next three lines are added as a precaution in case the gitlab runner # needs DISPLAY to render the plots, even if they are written to file. import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt import csv import os Loading @@ -15,7 +17,6 @@ Parses a CSV report and creates a summary report. """ # Main routine if __name__ == "__main__": parser = argparse.ArgumentParser( Loading @@ -32,16 +33,16 @@ if __name__ == "__main__": parser.add_argument( "csv_image", type=str, nargs='?', nargs="?", help="Summary image file, e.g. summary.png", default = None default=None, ) parser.add_argument( "--measure", type=str, nargs=1, help="Measure, any of: MLD, DIFF, SSNR, default: MLD", default = ['MLD'] default=["MLD"], ) args = parser.parse_args() csv_report = args.csv_report Loading @@ -49,13 +50,17 @@ if __name__ == "__main__": csv_image = args.csv_image measure = args.measure[0] limits_per_measure = {'MLD':('MLD',[0, 5, 10, math.inf]), 'DIFF':('MAXIMUM ABS DIFF',[0, 1024, 16384, 32769]), 'SSNR':('MIN_SSNR',[-math.inf, 0, 20, 40, 60, 100])} limits_per_measure = { "MLD": ("MLD", [0, 5, 10, math.inf]), "DIFF": ("MAXIMUM ABS DIFF", [0, 1024, 16384, 32769]), "SSNR": ("MIN_SSNR", [-math.inf, 0, 20, 40, 60, 100]), } (measure_label, limits) = limits_per_measure[measure] # Load CSV report results_sorted = {} with open(csv_report,'r') as fp: reader = csv.reader(fp, delimiter=';') with open(csv_report, "r") as fp: reader = csv.reader(fp, delimiter=";") header = next(reader) keys = header[1:] for row in reader: Loading @@ -66,7 +71,9 @@ if __name__ == "__main__": # Output CSV file with open(csv_summary, "w") as fp: limits_labels = [f"{str(a)} --\n {str(b)}" for (a,b) in zip(limits[0:-1],limits[1:])] + ["None"] limits_labels = [ f"{str(a)} --\n {str(b)}" for (a, b) in zip(limits[0:-1], limits[1:]) ] + ["None"] # Zero difference is treated as a special category for MLD and MAXIMUM ABS DIFF if measure_label == "MLD" or measure_label == "MAXIMUM ABS DIFF": limits_labels = ["0"] + limits_labels Loading @@ -77,16 +84,25 @@ if __name__ == "__main__": fig, ax = plt.subplots() bottom = np.zeros(len(limits_labels)) for cat in CATEGORIES: values = [x for x in [m[measure_label] for m in results_sorted.values() if m["Format"] == fmt and m["Category"] == cat]] values = [ x for x in [ m[measure_label] for m in results_sorted.values() if m["Format"] == fmt and m["Category"] == cat ] ] # Zero difference is treated as a special category for MLD and MAXIMUM ABS DIFF if measure_label == "MLD" or measure_label == "MAXIMUM ABS DIFF": val = [float(x) for x in values if x != 'None' and x != '0' and x != ''] zero = [sum([1 for x in values if x == '0'])] none = [sum([1 for x in values if x == 'None' or x == ''])] val = [ float(x) for x in values if x != "None" and x != "0" and x != "" ] zero = [sum([1 for x in values if x == "0"])] none = [sum([1 for x in values if x == "None" or x == ""])] else: val = [float(x) for x in values if x != 'None' and x != ''] val = [float(x) for x in values if x != "None" and x != ""] zero = [] none = [sum([1 for x in values if x == 'None' or x == ''])] none = [sum([1 for x in values if x == "None" or x == ""])] hist, _ = np.histogram(val, limits) data = np.array(zero + list(hist) + none) Loading
scripts/parse_xml_report.py +49 −24 Original line number Diff line number Diff line Loading @@ -12,10 +12,24 @@ Parse a junit report and create a summary report. PROPERTIES = ["MLD", "MAXIMUM ABS DIFF", "MIN_SSNR"] FORMATS = {'Stereo':r'stereo', 'ISM':r'ISM', 'Multichannel':r'Multi-channel', 'MASA':r'(?<!O)MASA','SBA':r'(?<!O)SBA', 'OSBA':r'OSBA', 'OMASA':r'OMASA', 'Renderer':r'renderer'} FORMATS = { "Stereo": r"stereo", "ISM": r"ISM", "Multichannel": r"Multi-channel", "MASA": r"(?<!O)MASA", "SBA": r"(?<!O)SBA", "OSBA": r"OSBA", "OMASA": r"OMASA", "Renderer": r"renderer", } CATEGORIES = {'Normal operation':r'.*', 'DTX':r'DTX', 'PLC':r'%', 'Bitrate switching':r'br sw|bitrate switching', 'JBM':r'JBM' } CATEGORIES = { "Normal operation": r".*", "DTX": r"DTX", "PLC": r"%", "Bitrate switching": r"br sw|bitrate switching", "JBM": r"JBM", } # Main routine if __name__ == "__main__": Loading @@ -27,11 +41,7 @@ if __name__ == "__main__": type=str, help="XML junit report input file, e.g. report-junit.xml", ) parser.add_argument( "csv_file", type=str, help="Output CSV file, e.g. report.csv" ) parser.add_argument("csv_file", type=str, help="Output CSV file, e.g. report.csv") args = parser.parse_args() xml_report = args.xml_report csv_file = args.csv_file Loading @@ -47,7 +57,7 @@ if __name__ == "__main__": results[fmt] = {} for cat in CATEGORIES: results[fmt][cat] = {} count = {'PASS':0,'FAIL':0,'ERROR':0} count = {"PASS": 0, "FAIL": 0, "ERROR": 0} for testcase in testcases: if testcase.find(".//skipped") is None: Loading @@ -61,29 +71,39 @@ if __name__ == "__main__": fulltestname = testcase.get("file") + "::" + testcase.get("name") 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 testcase.find('failure') is not None: testresult = 'FAIL' elif testcase.find('error') is not None: testresult = 'ERROR' if testcase.find("failure") is not None: testresult = "FAIL" elif testcase.find("error") is not None: testresult = "ERROR" else: testresult = 'PASS' testresult = "PASS" 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 = min([(f, re.search(FORMATS[f], fulltestname, re.IGNORECASE).end()) for f in FORMATS if re.search(FORMATS[f], fulltestname, re.IGNORECASE)] , key=lambda x: x[1])[0] fmt = min( [ (f, re.search(FORMATS[f], fulltestname, re.IGNORECASE).end()) for f in FORMATS if re.search(FORMATS[f], fulltestname, re.IGNORECASE) ], key=lambda x: x[1], )[0] # Note that only one category is selected, even though several may match, e.g. bitrate switching + JBM. Here the last match is picked. cat = [c for c in CATEGORIES if re.search(CATEGORIES[c], fulltestname, re.IGNORECASE)][-1] cat = [ c for c in CATEGORIES if re.search(CATEGORIES[c], fulltestname, re.IGNORECASE) ][-1] # 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. results[fmt][cat][fulltestname] = {'Result':testresult} results[fmt][cat][fulltestname] = {"Result": testresult} for propertyname, propertyvalue in zip(PROPERTIES, properties_values): results[fmt][cat][fulltestname][propertyname] = propertyvalue Loading @@ -98,7 +118,12 @@ if __name__ == "__main__": results[fmt][cat] = dict(sorted(results[fmt][cat].items())) for test in results[fmt][cat]: count[results[fmt][cat][test]["Result"]] += 1 line = ";".join([test, fmt, cat] + list(results[fmt][cat][test].values())) + "\n" line = ( ";".join( [test, fmt, cat] + list(results[fmt][cat][test].values()) ) + "\n" ) outfile.write(line) print( Loading