From 5a3598c24f276bb510653fc1617e534b7c8ba509 Mon Sep 17 00:00:00 2001 From: Arjun Suresh Date: Fri, 14 Jun 2024 16:37:22 +0530 Subject: [PATCH] Fixes the exit code return in benchmark run --- script/benchmark-program/customize.py | 2 +- script/benchmark-program/run.sh | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/script/benchmark-program/customize.py b/script/benchmark-program/customize.py index dabf88cf8..5fe34ec09 100644 --- a/script/benchmark-program/customize.py +++ b/script/benchmark-program/customize.py @@ -45,7 +45,7 @@ def preprocess(i): if os_info['platform'] != 'windows' and str(env.get('CM_SAVE_CONSOLE_LOG', True)).lower() not in [ "no", "false", "0"]: logs_dir = env.get('CM_LOGS_DIR', env['CM_RUN_DIR']) - env['CM_RUN_CMD'] += " 2>&1 | tee " + q+ os.path.join(logs_dir, "console.out") + q + env['CM_RUN_CMD'] += " 2>&1 ; echo \$? > exitstatus | tee " + q+ os.path.join(logs_dir, "console.out") + q # Print info print ('***************************************************************************') diff --git a/script/benchmark-program/run.sh b/script/benchmark-program/run.sh index 7c240a6c2..0cf45a8da 100644 --- a/script/benchmark-program/run.sh +++ b/script/benchmark-program/run.sh @@ -41,10 +41,19 @@ fi # Check CM_RUN_CMD0 if [[ "${CM_RUN_CMD0}" != "" ]]; then eval ${CM_RUN_CMD0} - test $? -eq 0 || exit $? + exitstatus=$? + if [ -e exitstatus ]; then + exitstatus=$( cat exitstatus ) + fi + test $exitstatus -eq 0 || $exitstatus else + echo "${CM_RUN_CMD}" eval ${CM_RUN_CMD} - test $? -eq 0 || exit $? + exitstatus=$? + if [ -e exitstatus ]; then + exitstatus=$( cat exitstatus ) + fi + test $exitstatus -eq 0 || $exitstatus fi test $? -eq 0 || exit $?