@@ -43,14 +43,22 @@ def run_iterations(
43
43
print (f"running { benchmark .name ()} , iteration { iter } ... " , flush = True )
44
44
bench_results = benchmark .run (env_vars )
45
45
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
48
51
49
52
for bench_result in bench_results :
50
53
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
54
62
55
63
print (
56
64
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):
220
228
benchmark .setup ()
221
229
if options .verbose :
222
230
print (f"{ benchmark .name ()} setup complete." )
223
-
224
231
except Exception as e :
225
232
if options .exit_on_failure :
226
233
raise e
@@ -405,7 +412,9 @@ def validate_and_parse_env_args(env_args):
405
412
"--verbose" , help = "Print output of all the commands." , action = "store_true"
406
413
)
407
414
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" ,
409
418
)
410
419
parser .add_argument (
411
420
"--compare-type" ,
0 commit comments