Loading ci/basop-pages/create_report_pages.py +40 −18 Original line number Diff line number Diff line Loading @@ -56,7 +56,11 @@ TD_TMPL_INCREASE = "<td class='tincrease'>{}</td>" TD_TMPL_REDUCE = "<td class='treduce'>{}</td>" TR_TMPL = "<tr>{}</tr>" COLUMNS = ["testcase", "MLD", "MAXIMUM ABS DIFF"] # expected columns. actual columns are filtered from the incoming data later, this # is mainly for controlling the order in the output table COLUMNS = ["testcase", "Result", "MLD", "MAXIMUM ABS DIFF"] COLUMNS_GLOBAL = COLUMNS[:1] COLUMNS_DIFFERENTIAL = COLUMNS[1:] def create_subpage( Loading Loading @@ -95,21 +99,38 @@ def write_out_csv(data, col_names, outfile): def tr_from_row(row, id_current, id_previous): tr = list() for c in COLUMNS: try: # this is for the "testcase" column - here we don't compare, just one value is used # pre-filter columns to handle case where new columns are added # only include columns that are there in both data columns_global = [c for c in COLUMNS_GLOBAL if c in row] diff_col_tmpl = "{}-{}" incoming_cols = row.keys() columns_differential = [ c for c in COLUMNS_DIFFERENTIAL if diff_col_tmpl.format(c, id_current) in incoming_cols and diff_col_tmpl.format(c, id_previous) in incoming_cols ] for c in columns_global: # this is currently for the "testcase" column - here we don't compare, just one value is used tr.append(TD_TMPL_NORMAL.format(row[c])) except KeyError: for c in columns_differential: # this is for all columns where we compare between current and previous run prev = row[f"{c}-{id_previous}"] curr = row[f"{c}-{id_current}"] # use red background if increase, green if decrease, white if same td_tmpl = TD_TMPL_NORMAL try: if float(curr) > float(prev): td_tmpl = TD_TMPL_INCREASE if float(curr) < float(prev): td_tmpl = TD_TMPL_REDUCE except ValueError: # if we land here, one of the cells is not a number, this indicates a crash # or some error in the scripts, so mark with red as well td_tmpl = TD_TMPL_INCREASE tr.append(td_tmpl.format(row[f"{c}-{id_previous}"])) tr.append(td_tmpl.format(row[f"{c}-{id_current}"])) Loading Loading @@ -140,11 +161,12 @@ def merge_and_cleanup_mld_reports( # sort based on difference in MLD between current and previous run # put cases with "None" at the top of the list def sort_func(x): return ( float("inf") if x[mld_col_curr] == "None" or x[mld_col_prev] == "None" else float(x[mld_col_curr]) - float(x[mld_col_prev]) ) vals_missing = ["None", ""] if x[mld_col_curr] in vals_missing or x[mld_col_prev] in vals_missing: return float("inf") return float(x[mld_col_curr]) - float(x[mld_col_prev]) merged = sorted(merged, key=sort_func, reverse=True) Loading Loading
ci/basop-pages/create_report_pages.py +40 −18 Original line number Diff line number Diff line Loading @@ -56,7 +56,11 @@ TD_TMPL_INCREASE = "<td class='tincrease'>{}</td>" TD_TMPL_REDUCE = "<td class='treduce'>{}</td>" TR_TMPL = "<tr>{}</tr>" COLUMNS = ["testcase", "MLD", "MAXIMUM ABS DIFF"] # expected columns. actual columns are filtered from the incoming data later, this # is mainly for controlling the order in the output table COLUMNS = ["testcase", "Result", "MLD", "MAXIMUM ABS DIFF"] COLUMNS_GLOBAL = COLUMNS[:1] COLUMNS_DIFFERENTIAL = COLUMNS[1:] def create_subpage( Loading Loading @@ -95,21 +99,38 @@ def write_out_csv(data, col_names, outfile): def tr_from_row(row, id_current, id_previous): tr = list() for c in COLUMNS: try: # this is for the "testcase" column - here we don't compare, just one value is used # pre-filter columns to handle case where new columns are added # only include columns that are there in both data columns_global = [c for c in COLUMNS_GLOBAL if c in row] diff_col_tmpl = "{}-{}" incoming_cols = row.keys() columns_differential = [ c for c in COLUMNS_DIFFERENTIAL if diff_col_tmpl.format(c, id_current) in incoming_cols and diff_col_tmpl.format(c, id_previous) in incoming_cols ] for c in columns_global: # this is currently for the "testcase" column - here we don't compare, just one value is used tr.append(TD_TMPL_NORMAL.format(row[c])) except KeyError: for c in columns_differential: # this is for all columns where we compare between current and previous run prev = row[f"{c}-{id_previous}"] curr = row[f"{c}-{id_current}"] # use red background if increase, green if decrease, white if same td_tmpl = TD_TMPL_NORMAL try: if float(curr) > float(prev): td_tmpl = TD_TMPL_INCREASE if float(curr) < float(prev): td_tmpl = TD_TMPL_REDUCE except ValueError: # if we land here, one of the cells is not a number, this indicates a crash # or some error in the scripts, so mark with red as well td_tmpl = TD_TMPL_INCREASE tr.append(td_tmpl.format(row[f"{c}-{id_previous}"])) tr.append(td_tmpl.format(row[f"{c}-{id_current}"])) Loading Loading @@ -140,11 +161,12 @@ def merge_and_cleanup_mld_reports( # sort based on difference in MLD between current and previous run # put cases with "None" at the top of the list def sort_func(x): return ( float("inf") if x[mld_col_curr] == "None" or x[mld_col_prev] == "None" else float(x[mld_col_curr]) - float(x[mld_col_prev]) ) vals_missing = ["None", ""] if x[mld_col_curr] in vals_missing or x[mld_col_prev] in vals_missing: return float("inf") return float(x[mld_col_curr]) - float(x[mld_col_prev]) merged = sorted(merged, key=sort_func, reverse=True) Loading