Commit ab119114 authored by Alejandro Piñeiro's avatar Alejandro Piñeiro
Browse files

report: add option to only print regressions

parent e77b324a
Pipeline #194631 passed with stages
in 44 seconds
......@@ -34,10 +34,15 @@ def initialize_total_stats(stats):
stats["Regressions"] = 0
stats["Changes"] = 0
def update_total_stats(total_stats, before_value, after_value):
def is_regression(before_value, after_value):
if (before_value == "Pass"):
if (after_value == "Fail" or after_value == "Crash"):
return True
return False
def update_total_stats(total_stats, before_value, after_value):
if is_regression(before_value, after_value):
total_stats["Regressions"] += 1
if (before_value == "Fail" or before_value == "Crash"):
......@@ -52,6 +57,8 @@ def main():
parser.add_argument("--summary-only", "-s", action="store_true", default=False,
help="do not list all the tests")
parser.add_argument("--regressions-only", "-r", action="store_true", default=False,
help="only list the regressions")
parser.add_argument("before", help="the output of the original code")
parser.add_argument("after", help="the output of the new code")
......@@ -76,7 +83,11 @@ def main():
after_value = "Missing"
if not args.summary_only:
print(test, ":" , before_value, after_value)
if not args.regressions_only:
print(test, ":" , before_value, after_value)
else:
if is_regression(before_value, after_value):
print(test)
before_stats[before_value] += 1
after_stats[after_value] += 1
......@@ -97,13 +108,14 @@ def main():
after_stats[after_value] += 1
update_total_stats(total_stats, before_value, after_value)
print()
print("summary comparing", args.before, "and", args.after)
for stat in before_stats:
print(stat, ":", before_stats[stat], after_stats[stat])
print()
for stat in total_stats:
print(stat, ":", total_stats[stat])
if not args.regressions_only:
print()
print("summary comparing", args.before, "and", args.after)
for stat in before_stats:
print(stat, ":", before_stats[stat], after_stats[stat])
print()
for stat in total_stats:
print(stat, ":", total_stats[stat])
if __name__ == "__main__":
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment