diff --git a/.ci/android/cts-runner.sh b/.ci/android/cts-runner.sh index 296ca3f..1ff1f0f 100755 --- a/.ci/android/cts-runner.sh +++ b/.ci/android/cts-runner.sh @@ -17,14 +17,30 @@ INCLUDE_FILE="${CI_PROJECT_DIR}/.ci/android/cts-includes.txt" # shellcheck disable=SC2086 # keep word splitting INCLUDE_FILTERS="$(grep -v -E "(^#|^[[:space:]]*$)" "$INCLUDE_FILE" | sed -e 's/\s*$//g' -e 's/.*/--include-filter "\0" /g')" +set +e # shellcheck disable=SC2086 # keep word splitting eval /android-tools/android-cts/tools/cts-tradefed run commandAndExit cts-dev \ $INCLUDE_FILTERS --log-level-display ASSERT -# Even if there are failed tests, eval will exit with 0, so check for failures manually. -[ "$(grep "^FAILED" /android-tools/android-cts/results/latest/invocation_summary.txt | tr -d ' ' | cut -d ':' -f 2)" = "0" ] -export EXIT_CODE=$? -fdo_log_section_end run_android_cts - cp -r "/android-tools/android-cts/results/latest"/* "${RESULTS_DIR}" cp -r "/android-tools/android-cts/logs/latest"/* "${RESULTS_DIR}" + +# Even if there are failed tests, eval will exit with 0, so check for failures manually. +SUMMARY_FILE="${RESULTS_DIR}"/invocation_summary.txt + +# Parse a line like `1/2 modules completed` to check that all modules completed +COMPLETED_MODULES=$(sed -n -e '/modules completed/s/^\([0-9]\+\)\/\([0-9]\+\) .*$/\1/p' "${SUMMARY_FILE}") +AVAILABLE_MODULES=$(sed -n -e '/modules completed/s/^\([0-9]\+\)\/\([0-9]\+\) .*$/\2/p' "${SUMMARY_FILE}") +[ "${COMPLETED_MODULES}" = "${AVAILABLE_MODULES}" ] +# shellcheck disable=SC2319 # False-positive see https://github.com/koalaman/shellcheck/issues/2937#issuecomment-2660891195 +MODULES_FAILED=$? + +[ "$(grep "^FAILED" "${SUMMARY_FILE}" | tr -d ' ' | cut -d ':' -f 2)" = "0" ] +TESTS_FAILED=$? + +[ "${MODULES_FAILED}" = "0" ] && [ "${TESTS_FAILED}" = "0" ] +# shellcheck disable=SC2034 +EXIT_CODE=$? +set -e + +fdo_log_section_end run_android_cts diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index dc9f0fc..81ac581 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,6 +11,7 @@ variables: CI_TEMPLATES_COMMIT: &ci-templates-commit 32afe5644697e503af18a736587c8619fa036a72 FDO_UPSTREAM_REPO: "drm-hwcomposer/drm-hwcomposer" CUTTLEFISH_TARBALL: "cuttlefish.tar.xz" + RESULTS_DIR: "${CI_PROJECT_DIR}/results" include: - project: 'freedesktop/ci-templates' @@ -73,8 +74,6 @@ android-cts: stage: android extends: .use-ubuntu/x86_64_android - variables: - RESULTS_DIR: "${CI_PROJECT_DIR}/results" script: - "${CI_PROJECT_DIR}/.ci/android/cts-runner.sh" needs: @@ -95,8 +94,6 @@ android-vts: stage: android extends: .use-ubuntu/x86_64_android - variables: - RESULTS_DIR: "${CI_PROJECT_DIR}/results" script: - "${CI_PROJECT_DIR}/.ci/android/vts-runner.sh" needs: