mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-08 13:36: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}
|
: ${PIGZ:=pigz}
|
||||||
|
|
||||||
# set up author and email so git does not complain when tagging
|
# set up author and email so git does not complain when tagging
|
||||||
git -C . config user.name "${CI_GIT_AUTHOR}"
|
if ! git config --get user.name ; then
|
||||||
git -C . config user.email "${CI_GIT_EMAIL}"
|
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() {
|
function init_submodules() {
|
||||||
git submodule init
|
git submodule init
|
||||||
|
@ -24,8 +24,9 @@ function __sqlite3_wrapper() {
|
|||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
sqlite3 "${dbfile}" "$@"
|
sqlite3 "${dbfile}" "$@"
|
||||||
if [ $? -ne 5 ] ; then
|
local ret="$?"
|
||||||
return $?
|
if [ "$ret" -ne 5 ] ; then
|
||||||
|
return $ret
|
||||||
fi
|
fi
|
||||||
local sleep="$((1 + $RANDOM % 5))"
|
local sleep="$((1 + $RANDOM % 5))"
|
||||||
echo "Retrying in ${sleep} seconds." >&2
|
echo "Retrying in ${sleep} seconds." >&2
|
||||||
|
@ -51,13 +51,15 @@ set -euo pipefail
|
|||||||
|
|
||||||
function test_run() {
|
function test_run() {
|
||||||
local arch="$1" ; shift
|
local arch="$1" ; shift
|
||||||
local image="$2"; shift
|
local image="$1"; shift
|
||||||
|
|
||||||
# default to all tests
|
# default to all tests
|
||||||
if [ $# -le 0 ] ; then
|
if [ $# -le 0 ] ; then
|
||||||
set -- *
|
set -- '*'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
local retries="${MAX_RETRIES:-999}"
|
||||||
|
|
||||||
source ci-automation/tapfile_helper_lib.sh
|
source ci-automation/tapfile_helper_lib.sh
|
||||||
source ci-automation/ci_automation_common.sh
|
source ci-automation/ci_automation_common.sh
|
||||||
init_submodules
|
init_submodules
|
||||||
@ -65,7 +67,7 @@ function test_run() {
|
|||||||
source sdk_container/.repo/manifests/version.txt
|
source sdk_container/.repo/manifests/version.txt
|
||||||
local vernum="${FLATCAR_VERSION}"
|
local vernum="${FLATCAR_VERSION}"
|
||||||
local docker_vernum
|
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="flatcar-packages-${arch}"
|
||||||
local packages_image="${packages}:${docker_vernum}"
|
local packages_image="${packages}:${docker_vernum}"
|
||||||
@ -74,6 +76,7 @@ function test_run() {
|
|||||||
|
|
||||||
local tests_dir="__TESTS__/${image}"
|
local tests_dir="__TESTS__/${image}"
|
||||||
mkdir -p "${tests_dir}"
|
mkdir -p "${tests_dir}"
|
||||||
|
echo "sudo rm -rf '${tests_dir}'" >> ci-cleanup.sh
|
||||||
|
|
||||||
local container_name="flatcar-tests-${arch}-${docker_vernum}-${image}"
|
local container_name="flatcar-tests-${arch}-${docker_vernum}-${image}"
|
||||||
|
|
||||||
@ -84,8 +87,9 @@ function test_run() {
|
|||||||
local failfile="failed-run-${retry}."
|
local failfile="failed-run-${retry}."
|
||||||
|
|
||||||
set -o noglob
|
set -o noglob
|
||||||
./run_sdk_container -n "${container_name}" -C "${packages_image}" -v "${vernum}" \
|
./run_sdk_container -x ./ci-cleanup.sh \
|
||||||
ci-automation/vendor/testing/"${image}".sh \
|
-n "${container_name}" -C "${packages_image}" -v "${vernum}" \
|
||||||
|
ci-automation/vendor-testing/"${image}".sh \
|
||||||
"${tests_dir}" \
|
"${tests_dir}" \
|
||||||
"${arch}" \
|
"${arch}" \
|
||||||
"${vernum}" \
|
"${vernum}" \
|
||||||
@ -93,7 +97,8 @@ function test_run() {
|
|||||||
$@
|
$@
|
||||||
set +o noglob
|
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 \
|
ci-automation/test_update_reruns.sh \
|
||||||
"${tests_dir}/${tapfile}" "${image}" "${retry}" \
|
"${tests_dir}/${tapfile}" "${image}" "${retry}" \
|
||||||
"${tests_dir}/failed-run-${retry}.txt"
|
"${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
|
#!/bin/bash
|
||||||
set -euo pipefail
|
|
||||||
# Copyright (c) 2021 The Flatcar Maintainers.
|
# Copyright (c) 2021 The Flatcar Maintainers.
|
||||||
# Use of this source code is governed by a BSD-style license that can be
|
# Use of this source code is governed by a BSD-style license that can be
|
||||||
# found in the LICENSE file.
|
# found in the LICENSE file.
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
# Test execution script for the qemu vendor image.
|
# Test execution script for the qemu vendor image.
|
||||||
# This script is supposed to run in the SDK container.
|
# This script is supposed to run in the SDK container.
|
||||||
|
|
||||||
function run_testsuite() {
|
work_dir="$1"; shift
|
||||||
local work_dir="$1"; shift
|
arch="$1"; shift
|
||||||
local arch="$2"; shift
|
vernum="$1"; shift
|
||||||
local vernum="$3"; shift
|
tapfile="$1"; shift
|
||||||
local tapfile="$4"; 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}"
|
mkdir -p "${work_dir}"
|
||||||
cd "${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
|
sudo kola run \
|
||||||
--board="${arch}-usr" \
|
--board="${arch}-usr" \
|
||||||
--parallel="${QEMU_PARALLEL}" \
|
--parallel="${QEMU_PARALLEL}" \
|
||||||
--platform=qemu \
|
--platform=qemu \
|
||||||
--qemu-bios=/usr/share/qemu/bios-256k.bin \
|
--qemu-bios=/usr/share/qemu/bios-256k.bin \
|
||||||
--qemu-image="${QEMU_IMAGE_NAME}" \
|
--qemu-image="${QEMU_IMAGE_NAME}" \
|
||||||
--tapfile="${tapfile}" \
|
--tapfile="${tapfile}" \
|
||||||
--torcx-manifest="${CONTAINER_TORCX_ROOT}/${arch}-usr/latest/torcx_manifest.json"
|
--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