Apply @pothos' suggestions from code review

Co-authored-by: Kai Lüke <pothos@users.noreply.github.com>
This commit is contained in:
Thilo Fromm 2022-02-17 10:29:05 +01:00
parent e5991bb6a6
commit 08191b99a8
4 changed files with 17 additions and 10 deletions

View File

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

View File

@ -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

View File

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

View File

@ -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.