@@ -43,14 +43,22 @@ def run_iterations(
4343 print (f"running { benchmark .name ()} , iteration { iter } ... " , flush = True )
4444 bench_results = benchmark .run (env_vars )
4545 if bench_results is None :
46- failures [benchmark .name ()] = "benchmark produced no results!"
47- break
46+ if options .exit_on_failure :
47+ raise RuntimeError (f"Benchmark { benchmark .name ()} produced no results!" )
48+ else :
49+ failures [benchmark .name ()] = "benchmark produced no results!"
50+ break
4851
4952 for bench_result in bench_results :
5053 if not bench_result .passed :
51- failures [bench_result .label ] = "verification failed"
52- print (f"complete ({ bench_result .label } : verification failed)." )
53- continue
54+ if options .exit_on_failure :
55+ raise RuntimeError (
56+ f"Benchmark { benchmark .name ()} failed: { bench_result .label } verification failed."
57+ )
58+ else :
59+ failures [bench_result .label ] = "verification failed"
60+ print (f"complete ({ bench_result .label } : verification failed)." )
61+ continue
5462
5563 print (
5664 f"{ benchmark .name ()} complete ({ bench_result .label } : { bench_result .value :.3f} { bench_result .unit } )."
@@ -220,7 +228,6 @@ def main(directory, additional_env_vars, save_name, compare_names, filter):
220228 benchmark .setup ()
221229 if options .verbose :
222230 print (f"{ benchmark .name ()} setup complete." )
223-
224231 except Exception as e :
225232 if options .exit_on_failure :
226233 raise e
@@ -405,7 +412,9 @@ def validate_and_parse_env_args(env_args):
405412 "--verbose" , help = "Print output of all the commands." , action = "store_true"
406413 )
407414 parser .add_argument (
408- "--exit-on-failure" , help = "Exit on first failure." , action = "store_true"
415+ "--exit-on-failure" ,
416+ help = "Exit on first benchmark failure." ,
417+ action = "store_true" ,
409418 )
410419 parser .add_argument (
411420 "--compare-type" ,
0 commit comments