Skip to content

Commit

Permalink
Use different exit codes for different scenarios of rebench exiting
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Marr <git@stefan-marr.de>
  • Loading branch information
smarr committed Jan 26, 2025
1 parent 636c78b commit c5d6693
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions rebench/rebench.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,24 +323,32 @@ def execute_experiment(self, runs, use_nice, use_shielding):
" using the reported settings.")
return executor.execute()

EXIT_CODE_SUCCESS = 0
EXIT_CODE_BENCHMARK_FAILED = 1
EXIT_CODE_ABORTED = 2
EXIT_CODE_UI_ERROR = 3
EXIT_CODE_EXCEPTION = 4

def main_func():
try:
rebench = ReBench()
return 0 if rebench.run() else -1
if rebench.run():
return EXIT_CODE_SUCCESS
else:
return EXIT_CODE_BENCHMARK_FAILED
except KeyboardInterrupt:
ui = UI()
ui.debug_error_info("Aborted by user request\n")
return -1
return EXIT_CODE_ABORTED
except UIError as err:
ui = UI()
ui.error("\n" + err.message)
return -1
return EXIT_CODE_UI_ERROR
except BenchmarkThreadExceptions as exceptions:
ui = UI()
for ex in exceptions.exceptions:
ui.error(str(ex) + "\n")
return -1
return EXIT_CODE_EXCEPTION


if __name__ == "__main__":
Expand Down

0 comments on commit c5d6693

Please sign in to comment.