ci-automation: Let vendor scripts know if this is their first run

I will need it to correctly handle test reruns as we will need to
handle passed test names differently on first runs than on reruns.
This commit is contained in:
Krzesimir Nowak 2022-05-05 12:50:11 +02:00
parent 76abe0d9cb
commit f0765e22c3
2 changed files with 13 additions and 0 deletions

View File

@ -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}" \

View File

@ -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_@}"