From 8f2715c333c8b7b94532a579c049446a16d28642 Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Tue, 22 Jul 2025 13:39:44 +0200 Subject: [PATCH] ci/android: fix exit code from android-cts-runner.sh and android-deqp-runner.sh The android-cts-runner.sh and android-deqp-runner.sh scripts are usually sourced from android-runner.sh which then propagates the EXIT_CODE value set in the scripts. However this scheme does not cover the case where android-cts-runner.sh and android-deqp-runner.sh are called directly, in that case they will not return the previously saved EXIT_CODE appropriately in the last command. Fix that, allowing developers to call the scripts directly with the intended behavior. After this change android-runner.sh does not need to know about the EXIT_CODE variable anymore, which was a slight layering violation, but it can just rely on the exit code of the last executed commands. Part-of: --- .gitlab-ci/android-cts-runner.sh | 2 ++ .gitlab-ci/android-deqp-runner.sh | 2 ++ .gitlab-ci/android-runner.sh | 6 ++---- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci/android-cts-runner.sh b/.gitlab-ci/android-cts-runner.sh index 1acda3fc76b..b891dea95b1 100755 --- a/.gitlab-ci/android-cts-runner.sh +++ b/.gitlab-ci/android-cts-runner.sh @@ -72,3 +72,5 @@ if [ -n "${ARTIFACTS_BASE_URL:-}" ]; then fi section_end android_cts_test + +exit $EXIT_CODE diff --git a/.gitlab-ci/android-deqp-runner.sh b/.gitlab-ci/android-deqp-runner.sh index d03755927de..5714a6a2143 100755 --- a/.gitlab-ci/android-deqp-runner.sh +++ b/.gitlab-ci/android-deqp-runner.sh @@ -108,3 +108,5 @@ $ADB shell "cd ${AOSP_RESULTS}/..; \ $ADB pull "$AOSP_RESULTS/junit.xml" "$RESULTS_DIR" section_end cuttlefish_results + +exit $EXIT_CODE diff --git a/.gitlab-ci/android-runner.sh b/.gitlab-ci/android-runner.sh index a668739910d..3392c759f43 100755 --- a/.gitlab-ci/android-runner.sh +++ b/.gitlab-ci/android-runner.sh @@ -139,12 +139,10 @@ if [ "$OLD_SF_PID" == "$NEW_SF_PID" ]; then exit 1 fi +# These should be the last commands of the script in order to correctly +# propagate the exit code. if [ -n "${ANDROID_CTS_TAG:-}" ]; then - # The script sets EXIT_CODE . "$(dirname "$0")/android-cts-runner.sh" else - # The script sets EXIT_CODE . "$(dirname "$0")/android-deqp-runner.sh" fi - -exit $EXIT_CODE