diff --git a/ci-automation/test.sh b/ci-automation/test.sh index c66fffeb09..2810ca9faf 100644 --- a/ci-automation/test.sh +++ b/ci-automation/test.sh @@ -146,6 +146,9 @@ function test_run() { local success=false # A job on each worker prunes old mantle images (docker image prune) echo "docker rm -f '${container_name}'" >> ./ci-cleanup.sh + + # Vendor tests may need to know if it is a first run or a rerun + touch "${work_dir}/first_run" for retry in $(seq "${retries}"); do local tapfile="results-run-${retry}.tap" local failfile="failed-run-${retry}.txt" @@ -164,6 +167,7 @@ function test_run() { \"${tapfile}\" \ $@" set -e + rm -f "${work_dir}/first_run" docker run --pull always --rm --name="${container_name}" --privileged --net host -v /dev:/dev \ -w /work -v "$PWD":/work "${mantle_ref}" \ diff --git a/ci-automation/vendor_test.sh b/ci-automation/vendor_test.sh index 0aac38a641..9e8d25a5ea 100644 --- a/ci-automation/vendor_test.sh +++ b/ci-automation/vendor_test.sh @@ -51,6 +51,9 @@ # Path to the Torcx manifest. Usually passed to kola through the # --torcx-manifest parameter. # +# CIA_FIRST_RUN: +# 1 if this is a first run, 0 if it is a rerun of failed tests. +# # # After this script is sourced, the parameters in ${@} specify test # cases / test case patterns to run. @@ -90,6 +93,11 @@ fi ciavts_tapfile="${PWD}/${ciavts_work_dir}/${ciavts_tapfile}" ciavts_torcx_manifest="${PWD}/${ciavts_main_work_dir}/torcx_manifest.json" +ciavts_first_run=0 +if [[ -f "${ciavts_main_work_dir}/first_run" ]]; then + ciavts_first_run=1 +fi + echo "++++ Running ${ciavts_testscript} inside ${ciavts_work_dir} ++++" cd "${ciavts_work_dir}" @@ -102,6 +110,7 @@ CIA_TESTSCRIPT="${ciavts_testscript}" CIA_GIT_VERSION="${ciavts_git_version}" CIA_BUILD_TYPE="${ciavts_type}" CIA_TORCX_MANIFEST="${ciavts_torcx_manifest}" +CIA_FIRST_RUN="${ciavts_first_run}" # Unset all variables with ciavts_ prefix now. unset -v "${!ciavts_@}"