mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
CI: unify x86 XTF test runner
Add test runner script qemu-xtf.sh which is allows any XTF x86 test to be easily executed. Test runner is invoked from the qemu-smoke* jobs with the hardcoded parameters. Each x86 XTF job lead time is reduced a bit since only the test-related code is built, not the entire XTF project. Add .gitignore to avoid committing test artifacts by mistake. Signed-off-by: Denis Mukhin <dmukhin@ford.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
This commit is contained in:
1 parent
85663be75e
commit
a22f80e758
7 files changed
+197
-30
No files matched your search
@@ -659,28 +659,28 @@ qemu-alpine-x86_64-gcc:
|
||||
qemu-smoke-x86-64-gcc:
|
||||
extends: .qemu-smoke-x86-64
|
||||
script:
|
||||
- ./automation/scripts/qemu-smoke-x86-64.sh pv 2>&1 | tee ${LOGFILE}
|
||||
- ./automation/scripts/qemu-xtf.sh x86-64 pv64 example 2>&1 | tee ${LOGFILE}
|
||||
needs:
|
||||
- debian-12-x86_64-gcc-debug
|
||||
|
||||
qemu-smoke-x86-64-clang:
|
||||
extends: .qemu-smoke-x86-64
|
||||
script:
|
||||
- ./automation/scripts/qemu-smoke-x86-64.sh pv 2>&1 | tee ${LOGFILE}
|
||||
- ./automation/scripts/qemu-xtf.sh x86-64 pv64 example 2>&1 | tee ${LOGFILE}
|
||||
needs:
|
||||
- debian-12-x86_64-clang-debug
|
||||
|
||||
qemu-smoke-x86-64-gcc-pvh:
|
||||
extends: .qemu-smoke-x86-64
|
||||
script:
|
||||
- ./automation/scripts/qemu-smoke-x86-64.sh pvh 2>&1 | tee ${LOGFILE}
|
||||
- ./automation/scripts/qemu-xtf.sh x86-64 hvm64 example 2>&1 | tee ${LOGFILE}
|
||||
needs:
|
||||
- debian-12-x86_64-gcc-debug
|
||||
|
||||
qemu-smoke-x86-64-clang-pvh:
|
||||
extends: .qemu-smoke-x86-64
|
||||
script:
|
||||
- ./automation/scripts/qemu-smoke-x86-64.sh pvh 2>&1 | tee ${LOGFILE}
|
||||
- ./automation/scripts/qemu-xtf.sh x86-64 hvm64 example 2>&1 | tee ${LOGFILE}
|
||||
needs:
|
||||
- debian-12-x86_64-clang-debug
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
/binaries/
|
||||
/smoke.serial
|
||||
/xtf-*/
|
||||
Whitespace-only changes.
@@ -0,0 +1,131 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# XTF test utilities.
|
||||
#
|
||||
# Environment variables:
|
||||
# BOOT_MSG: Expected boot message
|
||||
# FW_PREFIX: Firmware images path including '/' at the end
|
||||
# PASSED: XTF test printout in case of a pass
|
||||
# QEMU_PREFIX: QEMU path including '/' at the end
|
||||
# TEST_LOG: Output log file
|
||||
# UBOOT_CMD: U-Boot command line
|
||||
# WORKDIR: Test working directory
|
||||
# XEN_BINARY: Xen binary location
|
||||
# XEN_CONSOLE: Xen console device name
|
||||
# XTF_SRC_CONFIG: XTF config file
|
||||
# XTF_SRC_BRANCH: XTF branch
|
||||
# XTF_SRC_URI: XTF source code URI
|
||||
|
||||
# Output log file
|
||||
TEST_LOG="${TEST_LOG:-${XEN_ROOT}/smoke.serial}"
|
||||
# XTF test printout in case of a pass
|
||||
PASSED="${PASSED:-Test result: SUCCESS}"
|
||||
# Expected boot message
|
||||
BOOT_MSG="${BOOT_MSG:-Latest ChangeSet: }"
|
||||
# Test working directory
|
||||
WORKDIR="${WORKDIR:-${XEN_ROOT}/binaries}"
|
||||
# XTF source code
|
||||
XTF_SRC_CONFIG="${XTF_SRC_CONFIG:-include/configs/xtf-${ARCH}-config}"
|
||||
|
||||
function die()
|
||||
{
|
||||
set +x
|
||||
echo "FATAL: $*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Build an XTF test binary.
|
||||
# $1 Test variant.
|
||||
# $2 Test name.
|
||||
function xtf_build_binary()
|
||||
{
|
||||
local xtf_variant=$1
|
||||
local xtf_name=$2
|
||||
local xtf_dir="xtf-${ARCH}"
|
||||
|
||||
# Crude check for local testing
|
||||
if [ ! -d ${xtf_dir} ]; then
|
||||
git clone ${XTF_SRC_URI} ${xtf_dir} -b ${XTF_SRC_BRANCH}
|
||||
fi
|
||||
|
||||
make \
|
||||
-C ${xtf_dir} \
|
||||
-j$(nproc) \
|
||||
$(tr '\n' ' ' < ${XTF_SRC_CONFIG}) \
|
||||
TESTS=tests/${xtf_name}
|
||||
|
||||
export XTF_NAME="${xtf_name}"
|
||||
export XTF_VARIANT="${xtf_variant}"
|
||||
export XTF_WORKDIR="$(readlink -f ${xtf_dir})"
|
||||
export XTF_BINARY="${XTF_WORKDIR}/tests/${xtf_name}/test-${xtf_variant}-${xtf_name}"
|
||||
}
|
||||
|
||||
# Build Xen command line for running an XTF test.
|
||||
# $1 Test variant.
|
||||
# $2 Test name.
|
||||
function xtf_build_cmdline()
|
||||
{
|
||||
local xtf_variant=$1
|
||||
local xtf_name=$2
|
||||
declare -a cmdline=()
|
||||
|
||||
cmdline+=("${XEN_CMDLINE}")
|
||||
|
||||
# NB: OK to have hvm64, which is x86-only variant
|
||||
if [[ $xtf_variant == "hvm64" ]]; then
|
||||
cmdline+=("dom0-iommu=none dom0=pvh")
|
||||
fi
|
||||
|
||||
export XEN_CMDLINE="${cmdline[@]}"
|
||||
}
|
||||
|
||||
# Build an XTF test environment.
|
||||
# $1 Test variant.
|
||||
# $2 Test name.
|
||||
function xtf_build_test()
|
||||
{
|
||||
local v=$1
|
||||
local xtf_name=$2
|
||||
local xtf_variant=""
|
||||
|
||||
for x in ${XTF_SRC_VARIANTS}; do
|
||||
if [[ "${x}" == "${v}" ]]; then
|
||||
xtf_variant=${v}
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [[ -z $xtf_variant ]]; then
|
||||
die "unsupported test variant '$1', supported variants: ${XTF_SRC_VARIANTS}"
|
||||
fi
|
||||
|
||||
xtf_build_binary ${xtf_variant} ${xtf_name}
|
||||
xtf_build_cmdline ${xtf_variant} ${xtf_name}
|
||||
}
|
||||
|
||||
# Execute an XTF test.
|
||||
function xtf_run_test()
|
||||
{
|
||||
rm -f ${TEST_LOG}
|
||||
export BOOT_MSG PASSED TEST_CMD TEST_LOG UBOOT_CMD
|
||||
./console.exp | sed 's/\r\+$//'
|
||||
}
|
||||
|
||||
# Setup environment and run an XTF test.
|
||||
# $1 Test variant.
|
||||
# $2 Test name.
|
||||
function xtf_test()
|
||||
{
|
||||
# Out: FW_*, QEMU_*, XEN_{BINARY,CONSOLE}, XTF_SRC_*
|
||||
xtf_arch_prepare
|
||||
|
||||
# In: XTF_SRC_*
|
||||
# OUt: XTF_{BINARY,NAME,VARIANT,WORKDIR} and XEN_CMDLINE
|
||||
xtf_build_test $@
|
||||
|
||||
# In: FW_*, QEMU_*, XTF_*, XEN_*
|
||||
# Out: BOOT_MSG, PASSED, TEST_{CMD,LOG}, UBOOT_CMD
|
||||
xtf_arch_setup
|
||||
|
||||
# In: BOOT_MSG, PASSED, TEST_{CMD,LOG}, UBOOT_CMD
|
||||
xtf_run_test
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# XTF test utilities (x86_64).
|
||||
#
|
||||
|
||||
# Arch-specific environment overrides.
|
||||
function xtf_arch_prepare()
|
||||
{
|
||||
export FW_PREFIX="${FW_PREFIX:-}"
|
||||
export QEMU_PREFIX="${QEMU_PREFIX:-}"
|
||||
export XEN_BINARY="${XEN_BINARY:-${WORKDIR}/xen}"
|
||||
export XEN_CMDLINE="${XEN_CMDLINE:-loglvl=all noreboot console_timestamps=boot console=com1}"
|
||||
export XTF_SRC_BRANCH="${XTF_SRC_BRANCH:-master}"
|
||||
export XTF_SRC_URI="${XTF_SRC_URI:-https://xenbits.xen.org/git-http/xtf.git}"
|
||||
export XTF_SRC_VARIANTS="hvm64 pv64"
|
||||
}
|
||||
|
||||
# Perform arch-specific XTF environment setup.
|
||||
function xtf_arch_setup()
|
||||
{
|
||||
export TEST_CMD="${QEMU_PREFIX}qemu-system-x86_64 \
|
||||
-no-reboot \
|
||||
-nographic \
|
||||
-monitor none \
|
||||
-serial stdio \
|
||||
-m 512 \
|
||||
-kernel ${XEN_BINARY} \
|
||||
-initrd ${XTF_BINARY} \
|
||||
-append \"${XEN_CMDLINE}\" \
|
||||
"
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -ex -o pipefail
|
||||
|
||||
# variant should be either pv or pvh
|
||||
variant=$1
|
||||
|
||||
# Clone and build XTF
|
||||
git clone https://xenbits.xen.org/git-http/xtf.git
|
||||
cd xtf && make -j$(nproc) && cd -
|
||||
|
||||
case $variant in
|
||||
pvh) k=test-hvm64-example extra="dom0-iommu=none dom0=pvh" ;;
|
||||
*) k=test-pv64-example extra= ;;
|
||||
esac
|
||||
|
||||
rm -f smoke.serial
|
||||
export TEST_CMD="qemu-system-x86_64 -nographic -kernel binaries/xen \
|
||||
-initrd xtf/tests/example/$k \
|
||||
-append \"loglvl=all console=com1 noreboot console_timestamps=boot $extra\" \
|
||||
-m 512 -monitor none -serial stdio"
|
||||
|
||||
export TEST_LOG="smoke.serial"
|
||||
export PASSED="Test result: SUCCESS"
|
||||
|
||||
./automation/scripts/console.exp | sed 's/\r\+$//'
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# XTF test runner (QEMU).
|
||||
#
|
||||
|
||||
set -e -o pipefail
|
||||
|
||||
if [ $# -lt 3 ]; then
|
||||
echo "Usage: $(basename $0) ARCH XTF-VARIANT XTF-NAME"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
export ARCH="$1"
|
||||
shift
|
||||
|
||||
set -x
|
||||
|
||||
export XEN_ROOT="${PWD}"
|
||||
cd $(dirname $0)
|
||||
|
||||
source include/xtf-runner
|
||||
|
||||
if [ ! -f "include/xtf-${ARCH}" ]; then
|
||||
die "unsupported architecture '${ARCH}'"
|
||||
fi
|
||||
source include/xtf-${ARCH}
|
||||
|
||||
xtf_test $@
|
||||