@@ -269,24 +269,29 @@ def generate_system_info(system: SystemInfo):
269269"""
270270
271271
272+ def _handle_crash_report (report : RunResultReport , run_result : EvalResult ):
273+ if run_result .compilation is not None and not run_result .compilation .success :
274+ _generate_compile_report (report , run_result .compilation )
275+ return True
276+
277+ if not run_result .run .success :
278+ _generate_crash_report (report , run_result .run )
279+ return True
280+
281+ return False
282+
283+
272284def generate_report (result : FullResult ) -> RunResultReport : # noqa: C901
273285 runs = result .runs
274286 report = RunResultReport ()
275287 report .add_text (generate_system_info (result .system ))
276288
277289 if "test" in runs :
278290 test_run = runs ["test" ]
279-
280- if test_run .compilation is not None and not test_run .compilation .success :
281- _generate_compile_report (report , test_run .compilation )
291+ if _handle_crash_report (report , test_run ):
282292 return report
283293
284294 test_run = test_run .run
285-
286- if not test_run .success :
287- _generate_crash_report (report , test_run )
288- return report
289-
290295 if not test_run .passed :
291296 _generate_test_report (report , test_run )
292297 return report
@@ -296,47 +301,30 @@ def generate_report(result: FullResult) -> RunResultReport: # noqa: C901
296301
297302 if "benchmark" in runs :
298303 bench_run = runs ["benchmark" ]
299- if bench_run .compilation is not None and not bench_run .compilation .success :
300- _generate_compile_report (report , bench_run .compilation )
301- return report
302-
303- bench_run = bench_run .run
304- if not bench_run .success :
305- _generate_crash_report (report , bench_run )
304+ if _handle_crash_report (report , bench_run ):
306305 return report
307306
308307 report .add_log (
309308 "Benchmarks" ,
310- make_benchmark_log (bench_run ),
309+ make_benchmark_log (bench_run . run ),
311310 )
312311
313312 if "profile" in runs :
314313 prof_run = runs ["profile" ]
315- if prof_run .compilation is not None and not prof_run .compilation .success :
316- _generate_compile_report (report , prof_run .compilation )
317- return report
318-
319- prof_run = prof_run .run
320- if not prof_run .success :
321- _generate_crash_report (report , prof_run )
314+ if _handle_crash_report (report , prof_run ):
322315 return report
323316
324317 report .add_log (
325318 "Profiling" ,
326- make_profile_log (prof_run ),
319+ make_profile_log (prof_run . run ),
327320 )
328321
329322 if "leaderboard" in runs :
330323 bench_run = runs ["leaderboard" ]
331- if bench_run .compilation is not None and not bench_run .compilation .success :
332- _generate_compile_report (report , bench_run .compilation )
324+ if _handle_crash_report (report , bench_run ):
333325 return report
334326
335327 bench_run = bench_run .run
336- if not bench_run .success :
337- _generate_crash_report (report , bench_run )
338- return report
339-
340328 report .add_log (
341329 "Ranked Benchmark" ,
342330 make_benchmark_log (bench_run ),
0 commit comments