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

add difference of scores to printout and csv output

parent 8269885a
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@ def main(args):
    )
    df_crashes_introduced.to_csv(OUTFILE_CRASHES, sep=";")

    if len(df_crashes_introduced) > 0:
    if sum(mask_crash_introduced) > 0:
        regressions_found = True
        print("---------------Testcases that introduced new crashes---------------")
        print(df_crashes_introduced)
@@ -102,18 +102,17 @@ def main(args):
    for col in args.columns_to_compare:
        col_curr = f"{col}-curr"
        col_prev = f"{col}-prev"
        diff = df_merged[col_curr] - df_merged[col_prev]
        col_diff = f"{col}-diff"
        df_merged[col_diff] = df_merged[col_curr] - df_merged[col_prev]

        thresh = COLS_2_THRESHOLDS[col]
        # invert sign of difference for "higher is better" metrics
        if thresh < 0:
            diff *= -1

        fac = -1 if thresh < 0 else 1
        thresh = abs(thresh)
        mask_worse = diff > thresh
        mask_better = diff < -thresh
        mask_worse = (df_merged[col_diff] * fac) > thresh
        mask_better = (df_merged[col_diff] * fac) < -thresh

        display_cols = ["testcase", col_curr, col_prev]
        display_cols = ["testcase", col_curr, col_prev, col_diff]
        outfile = OUTFILE_SCORES.format(col.replace(" ", "_"))
        df_worse = df_merged[mask_worse][display_cols].reset_index(drop=True)
        df_worse.to_csv(outfile, sep=";")