diff --git a/ci-automation/tapfile_helper_lib.sh b/ci-automation/tapfile_helper_lib.sh index 0cd7f3efa4..35fc12be17 100644 --- a/ci-automation/tapfile_helper_lib.sh +++ b/ci-automation/tapfile_helper_lib.sh @@ -117,7 +117,8 @@ function tap_ingest_tapfile() { fi else test_name="$(echo "${line}" | sed 's/^[^-]* - //')" - local result_string="$(echo "${line}" | sed 's/ - .*//')" + local result_string + result_string="$(echo "${line}" | sed 's/ - .*//')" result=0 if [ "${result_string}" = "ok" ] ; then result=1 @@ -186,8 +187,10 @@ function tap_generate_report() { local dbname="${TAPFILE_HELPER_DBNAME}" - local count="$(__sqlite3_wrapper "${dbname}" 'SELECT count(name) FROM test_case;')" - local vendors="$(__sqlite3_wrapper "${dbname}" 'SELECT name FROM vendor;' | tr '\n' ' ')" + local count + count="$(__sqlite3_wrapper "${dbname}" 'SELECT count(name) FROM test_case;')" + local vendors + vendors="$(__sqlite3_wrapper "${dbname}" 'SELECT name FROM vendor;' | tr '\n' ' ')" echo "1..$((count+1))" echo "ok - Version: ${version}, Architecture: ${arch}" @@ -243,8 +246,10 @@ function tap_generate_report() { END { if (t) print t r ")"; }' } - local succeded="$(list_runs 1)" - local failed="$(list_runs 0)" + local succeded + succeded="$(list_runs 1)" + local failed + failed="$(list_runs 0)" echo "${verdict} - ${test_name}" echo " ---" diff --git a/ci-automation/test.sh b/ci-automation/test.sh index 95197dc736..84e06860ba 100644 --- a/ci-automation/test.sh +++ b/ci-automation/test.sh @@ -47,7 +47,7 @@ # 2. "./ci-cleanup.sh" with commands to clean up temporary build resources, # to be run after this step finishes / when this step is aborted. -set -eu +set -euo pipefail function test_run() { local arch="$1" ; shift @@ -64,7 +64,8 @@ function test_run() { source sdk_container/.repo/manifests/version.txt local vernum="${FLATCAR_VERSION}" - local docker_vernum="$(vernum_to_docker_image_version "${vernum}")" + local docker_vernum + docker_vernum="$(vernum_to_docker_image_version "${vernum}")" local packages="flatcar-packages-${arch}" local packages_image="${packages}:${docker_vernum}" @@ -97,7 +98,8 @@ function test_run() { "${tests_dir}/${tapfile}" "${image}" "${retry}" \ "${tests_dir}/failed-run-${retry}.txt" - local failed_tests="$(cat "${tests_dir}/failed-run-${retry}.txt")" + local failed_tests + failed_tests="$(cat "${tests_dir}/failed-run-${retry}.txt")" if [ -z "$failed_tests" ] ; then echo "########### All tests succeeded. ###########" success=true diff --git a/ci-automation/test_update_reruns.sh b/ci-automation/test_update_reruns.sh index e559158f31..8a3eb078a7 100755 --- a/ci-automation/test_update_reruns.sh +++ b/ci-automation/test_update_reruns.sh @@ -8,7 +8,7 @@ # test.sh uses this to determine which tests need to re-run. # This script is run within the SDK container. -set -eu +set -euo pipefail tapfile="$1" image="$2" diff --git a/ci-automation/vendor-testing/qemu.sh b/ci-automation/vendor-testing/qemu.sh index 3f2dc95cff..852e386899 100644 --- a/ci-automation/vendor-testing/qemu.sh +++ b/ci-automation/vendor-testing/qemu.sh @@ -1,5 +1,5 @@ #!/bin/bash -# +set -euo pipefail # Copyright (c) 2021 The Flatcar Maintainers. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file.