4040
4141 Note that `--extract` will overwrite files in `gungraun-home`.
4242
43- check-regressions [--home iai-home] [--allow-pr-override pr_number]
44- Check `iai-home` (or `iai-home` if unspecified) for `summary.json`
45- files and see if there are any regressions. This is used as a workaround
46- for `iai-callgrind` not exiting with error status; see
47- <https://github.com/iai-callgrind/iai-callgrind/issues/337>.
48-
49- If `--allow-pr-override` is specified, the regression check will not exit
50- with failure if any line in the PR starts with `allow-regressions`.
43+ handle-bench-regressions PR_NUMBER
44+ Exit with success if the pull request contains a line starting with
45+ `ci: allow-regressions`, indicating that regressions in benchmarks should
46+ be accepted. Otherwise, exit 1.
5147 """
5248)
5349
@@ -428,27 +424,22 @@ def locate_baseline(flags: list[str]) -> None:
428424 eprint ("baseline extracted successfully" )
429425
430426
431- def check_iai_regressions (args : list [str ]):
432- """Find regressions in iai summary.json files, exit with failure if any are
433- found.
434- """
427+ def handle_bench_regressions (args : list [str ]):
428+ """Exit with error unless the PR message contains an ignore directive."""
435429
436- iai_home_str = "iai-home"
437- pr_number = None
430+ match args :
431+ case [pr_number ]:
432+ pr_number = pr_number
433+ case _:
434+ eprint (USAGE )
435+ exit (1 )
438436
439437 pr = PrInfo .from_pr (pr_number )
440438 if pr .cfg .allow_regressions :
441439 eprint ("PR allows regressions" )
442440 return
443441
444- eprint ("Found regressions:" , json .dumps (regressions , indent = 4 ))
445-
446- if pr_number is not None :
447- pr = PrInfo .load (pr_number )
448- if pr .contains_directive (REGRESSION_DIRECTIVE ):
449- eprint ("PR allows regressions, returning" )
450- return
451-
442+ eprint ("Regressions were found; benchmark failed" )
452443 exit (1 )
453444
454445
@@ -459,8 +450,8 @@ def main():
459450 ctx .emit_workflow_output ()
460451 case ["locate-baseline" , * flags ]:
461452 locate_baseline (flags )
462- case ["check -regressions" , * args ]:
463- check_iai_regressions (args )
453+ case ["handle-bench -regressions" , * args ]:
454+ handle_bench_regressions (args )
464455 case ["--help" | "-h" ]:
465456 print (USAGE )
466457 exit ()
0 commit comments