mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-08 05:26:58 +02:00
ci-automation testing: address PR review comments
- add cleanup script to test.sh - remove wrapper function from qemu test Signed-off-by: Thilo Fromm <thilo@kinvolk.io>
This commit is contained in:
parent
6c76bfa1cd
commit
3a416fbf32
@ -10,8 +10,12 @@ source ci-automation/ci-config.env
|
||||
: ${PIGZ:=pigz}
|
||||
|
||||
# set up author and email so git does not complain when tagging
|
||||
git -C . config user.name "${CI_GIT_AUTHOR}"
|
||||
git -C . config user.email "${CI_GIT_EMAIL}"
|
||||
if ! git config --get user.name ; then
|
||||
git -C . config user.name "${CI_GIT_AUTHOR}"
|
||||
fi
|
||||
if ! git config --get user.email ; then
|
||||
git -C . config user.email "${CI_GIT_EMAIL}"
|
||||
fi
|
||||
|
||||
function init_submodules() {
|
||||
git submodule init
|
||||
|
@ -24,8 +24,9 @@ function __sqlite3_wrapper() {
|
||||
|
||||
while true; do
|
||||
sqlite3 "${dbfile}" "$@"
|
||||
if [ $? -ne 5 ] ; then
|
||||
return $?
|
||||
local ret="$?"
|
||||
if [ "$ret" -ne 5 ] ; then
|
||||
return $ret
|
||||
fi
|
||||
local sleep="$((1 + $RANDOM % 5))"
|
||||
echo "Retrying in ${sleep} seconds." >&2
|
||||
|
@ -51,13 +51,15 @@ set -euo pipefail
|
||||
|
||||
function test_run() {
|
||||
local arch="$1" ; shift
|
||||
local image="$2"; shift
|
||||
local image="$1"; shift
|
||||
|
||||
# default to all tests
|
||||
if [ $# -le 0 ] ; then
|
||||
set -- *
|
||||
set -- '*'
|
||||
fi
|
||||
|
||||
local retries="${MAX_RETRIES:-999}"
|
||||
|
||||
source ci-automation/tapfile_helper_lib.sh
|
||||
source ci-automation/ci_automation_common.sh
|
||||
init_submodules
|
||||
@ -65,7 +67,7 @@ function test_run() {
|
||||
source sdk_container/.repo/manifests/version.txt
|
||||
local vernum="${FLATCAR_VERSION}"
|
||||
local docker_vernum
|
||||
docker_vernum="$(vernum_to_docker_image_version "${vernum}")"
|
||||
docker_vernum="$(vernum_to_docker_image_version "${vernum}")"
|
||||
|
||||
local packages="flatcar-packages-${arch}"
|
||||
local packages_image="${packages}:${docker_vernum}"
|
||||
@ -74,6 +76,7 @@ function test_run() {
|
||||
|
||||
local tests_dir="__TESTS__/${image}"
|
||||
mkdir -p "${tests_dir}"
|
||||
echo "sudo rm -rf '${tests_dir}'" >> ci-cleanup.sh
|
||||
|
||||
local container_name="flatcar-tests-${arch}-${docker_vernum}-${image}"
|
||||
|
||||
@ -84,8 +87,9 @@ function test_run() {
|
||||
local failfile="failed-run-${retry}."
|
||||
|
||||
set -o noglob
|
||||
./run_sdk_container -n "${container_name}" -C "${packages_image}" -v "${vernum}" \
|
||||
ci-automation/vendor/testing/"${image}".sh \
|
||||
./run_sdk_container -x ./ci-cleanup.sh \
|
||||
-n "${container_name}" -C "${packages_image}" -v "${vernum}" \
|
||||
ci-automation/vendor-testing/"${image}".sh \
|
||||
"${tests_dir}" \
|
||||
"${arch}" \
|
||||
"${vernum}" \
|
||||
@ -93,7 +97,8 @@ function test_run() {
|
||||
$@
|
||||
set +o noglob
|
||||
|
||||
./run_sdk_container -n "${container_name}" -C "${packages_image}" -v "${vernum}" \
|
||||
./run_sdk_container -x ./ci-cleanup.sh \
|
||||
-n "${container_name}" -C "${packages_image}" -v "${vernum}" \
|
||||
ci-automation/test_update_reruns.sh \
|
||||
"${tests_dir}/${tapfile}" "${image}" "${retry}" \
|
||||
"${tests_dir}/failed-run-${retry}.txt"
|
||||
|
46
ci-automation/vendor-testing/qemu.sh
Normal file → Executable file
46
ci-automation/vendor-testing/qemu.sh
Normal file → Executable file
@ -1,38 +1,38 @@
|
||||
#!/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.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Test execution script for the qemu vendor image.
|
||||
# This script is supposed to run in the SDK container.
|
||||
|
||||
function run_testsuite() {
|
||||
local work_dir="$1"; shift
|
||||
local arch="$2"; shift
|
||||
local vernum="$3"; shift
|
||||
local tapfile="$4"; shift
|
||||
work_dir="$1"; shift
|
||||
arch="$1"; shift
|
||||
vernum="$1"; shift
|
||||
tapfile="$1"; shift
|
||||
|
||||
# $@ now contains tests / test patterns to run
|
||||
# $@ now contains tests / test patterns to run
|
||||
|
||||
source ci-automation/ci_automation_common.sh
|
||||
source ci-automation/ci_automation_common.sh
|
||||
|
||||
mkdir -p "${work_dir}"
|
||||
cd "${work_dir}"
|
||||
mkdir -p "${work_dir}"
|
||||
cd "${work_dir}"
|
||||
|
||||
copy_from_buildcache "images/${arch}/${vernum}/${QEMU_IMAGE_NAME}" .
|
||||
echo "++++ QEMU test: downloading ${QEMU_IMAGE_NAME} for ${vernum} (${arch}) ++++"
|
||||
copy_from_buildcache "images/${arch}/${vernum}/${QEMU_IMAGE_NAME}" .
|
||||
|
||||
set -o noglob
|
||||
set -o noglob
|
||||
|
||||
sudo kola run
|
||||
--board="${arch}-usr" \
|
||||
--parallel="${QEMU_PARALLEL}" \
|
||||
--platform=qemu \
|
||||
--qemu-bios=/usr/share/qemu/bios-256k.bin \
|
||||
--qemu-image="${QEMU_IMAGE_NAME}" \
|
||||
--tapfile="${tapfile}" \
|
||||
--torcx-manifest="${CONTAINER_TORCX_ROOT}/${arch}-usr/latest/torcx_manifest.json"
|
||||
$@
|
||||
sudo kola run \
|
||||
--board="${arch}-usr" \
|
||||
--parallel="${QEMU_PARALLEL}" \
|
||||
--platform=qemu \
|
||||
--qemu-bios=/usr/share/qemu/bios-256k.bin \
|
||||
--qemu-image="${QEMU_IMAGE_NAME}" \
|
||||
--tapfile="${tapfile}" \
|
||||
--torcx-manifest="${CONTAINER_TORCX_ROOT}/${arch}-usr/latest/torcx_manifest.json" \
|
||||
$@
|
||||
|
||||
set +o noglob
|
||||
}
|
||||
set +o noglob
|
||||
|
Loading…
Reference in New Issue
Block a user