Skip to contentSkip to conversation

CI: updates to XTF CI runners

PATCH Superseded [email protected] 2 participants 13 messages Apr 16, 2025 – Apr 17, 2025

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover CI: updates to XTF CI runners

The series started from adding new argo XTF CI job and ended up with updating all XTF runners and related CI jobs.

It unifies the XTF runner scripts so that it is possible to use one script for executing any XTF test under QEMU. That simplifies running XTFs locally and in CI.

Patch 1 reworks x86 XTF runner.
Patch 2 reworks x86 EFI XTF.
Patch 3 reworks Arm64 XTF runner.
Patch 4 adds new argo x86 XTF CI job.

CI run: https://gitlab.com/xen-project/people/dmukhin/xen/-/pipelines/1770437024

Denis Mukhin (4):
CI: unify x86 XTF test runner
CI: switch x86 EFI smoke test runner to qemu-xtf.sh
CI: switch arm64 XTF test runner to qemu-xtf.sh
CI: add argo x86 XTF test

 automation/gitlab-ci/test.yaml                |  23 ++-
 automation/scripts/.gitignore                 |   9 ++
 .../scripts/include/configs/xtf-arm64-config  |   2 +
 .../scripts/include/configs/xtf-x86-64-config |   0
 .../include/configs/xtf-x86-64-efi-config     |   0
 automation/scripts/include/xtf-arm64          |  81 ++++++++++
 automation/scripts/include/xtf-runner         | 141 ++++++++++++++++++
 automation/scripts/include/xtf-x86-64         |  31 ++++
 automation/scripts/include/xtf-x86-64-efi     |  52 +++++++
 automation/scripts/qemu-smoke-x86-64-efi.sh   |  43 ------
 automation/scripts/qemu-smoke-x86-64.sh       |  26 ----
 automation/scripts/qemu-xtf-dom0less-arm64.sh |  68 ---------
 automation/scripts/qemu-xtf.sh                |  26 ++++
 13 files changed, 358 insertions(+), 144 deletions(-)
 create mode 100644 automation/scripts/.gitignore
 create mode 100644 automation/scripts/include/configs/xtf-arm64-config
 create mode 100644 automation/scripts/include/configs/xtf-x86-64-config
 create mode 100644 automation/scripts/include/configs/xtf-x86-64-efi-config
 create mode 100644 automation/scripts/include/xtf-arm64
 create mode 100644 automation/scripts/include/xtf-runner
 create mode 100644 automation/scripts/include/xtf-x86-64
 create mode 100644 automation/scripts/include/xtf-x86-64-efi
 delete mode 100755 automation/scripts/qemu-smoke-x86-64-efi.sh
 delete mode 100755 automation/scripts/qemu-smoke-x86-64.sh
 delete mode 100755 automation/scripts/qemu-xtf-dom0less-arm64.sh
 create mode 100755 automation/scripts/qemu-xtf.sh
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/4 CI: unify x86 XTF test runner

From: Denis Mukhin <[email protected]>

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.

---
 automation/gitlab-ci/test.yaml                |   8 +-
 automation/scripts/.gitignore                 |   6 +
 .../scripts/include/configs/xtf-x86-64-config |   0
 automation/scripts/include/xtf-runner         | 134 ++++++++++++++++++
 automation/scripts/include/xtf-x86-64         |  31 ++++
 automation/scripts/qemu-smoke-x86-64.sh       |  26 ----
 automation/scripts/qemu-xtf.sh                |  26 ++++
 7 files changed, 201 insertions(+), 30 deletions(-)
 create mode 100644 automation/scripts/.gitignore
 create mode 100644 automation/scripts/include/configs/xtf-x86-64-config
 create mode 100644 automation/scripts/include/xtf-runner
 create mode 100644 automation/scripts/include/xtf-x86-64
 delete mode 100755 automation/scripts/qemu-smoke-x86-64.sh
 create mode 100755 automation/scripts/qemu-xtf.sh
automation/gitlab-ci/test.yaml +4 -4
index 5ce445b78f..3adc841335 100644
@@ -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
 
automation/scripts/.gitignore new file +6 -0
new file mode 100644
index 0000000000..2f2d6e1ebd
@@ -0,0 +1,6 @@
+!include
+
+binaries
+smoke.serial
+xen
+xtf*/
automation/scripts/include/configs/xtf-x86-64-config new file +0 -0
new file mode 100644
index 0000000000..e69de29bb2
automation/scripts/include/xtf-runner new file +134 -0

134 lines not on this page · raw message

automation/scripts/include/xtf-x86-64 new file +31 -0
new file mode 100644
index 0000000000..edddf18b38
@@ -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_CONSOLE="${XEN_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}\" \
+    "
+}
automation/scripts/qemu-smoke-x86-64.sh deleted +0 -26
deleted file mode 100755
index da0c26cc2f..0000000000
@@ -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\+$//'
automation/scripts/qemu-xtf.sh new file +26 -0
new file mode 100755
index 0000000000..2e16d4aece
@@ -0,0 +1,26 @@
+#!/bin/bash
+#
+# XTF test runner (QEMU).
+#
+
+set -e -o pipefail
+
+if [ $# -lt 3 ]; then
+    echo "Usage: $(basename $0) ARCH XTF-VARIANT XTF-NAME"
+    exit 1
+fi
+
+export ARCH="$1"
+shift
+
+export TOP="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
+if [ ! -f "${TOP}/include/xtf-${ARCH}" ]; then
+    echo "unsupported architecture '${ARCH}'" >&2
+    exit 1
+fi
+
+set -x
+source ${TOP}/include/xtf-runner
+source ${TOP}/include/xtf-${ARCH}
+
+xtf_test $@
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH v1 1/4] CI: unify x86 XTF test runner

Quoted 71 lines · On Wed, 16 Apr 2025, [email protected] wrote:

From: Denis Mukhin <[email protected]>

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.

---
 automation/gitlab-ci/test.yaml                |   8 +-
 automation/scripts/.gitignore                 |   6 +
 .../scripts/include/configs/xtf-x86-64-config |   0
 automation/scripts/include/xtf-runner         | 134 ++++++++++++++++++
 automation/scripts/include/xtf-x86-64         |  31 ++++
 automation/scripts/qemu-smoke-x86-64.sh       |  26 ----
 automation/scripts/qemu-xtf.sh                |  26 ++++
 7 files changed, 201 insertions(+), 30 deletions(-)
 create mode 100644 automation/scripts/.gitignore
 create mode 100644 automation/scripts/include/configs/xtf-x86-64-config
 create mode 100644 automation/scripts/include/xtf-runner
 create mode 100644 automation/scripts/include/xtf-x86-64
 delete mode 100755 automation/scripts/qemu-smoke-x86-64.sh
 create mode 100755 automation/scripts/qemu-xtf.sh
automation/gitlab-ci/test.yaml +4 -4
index 5ce445b78f..3adc841335 100644
@@ -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
 
automation/scripts/.gitignore new file +0 -0
new file mode 100644
index 0000000000..2f2d6e1ebd

automation/scripts/.gitignore line 6

Quoted 6 lines
automation/scripts/.gitignore new file +6 -0
@@ -0,0 +1,6 @@
+!include
+
+binaries
+smoke.serial
+xen
+xtf*/

I am not sure this works as intended: I thought the paths are relative to the location of the .gitignore file, but I could be wrong.

Quoted 36 lines
automation/scripts/include/configs/xtf-x86-64-config new file +0 -0
new file mode 100644
index 0000000000..e69de29bb2
automation/scripts/include/xtf-runner new file +27 -0
new file mode 100644
index 0000000000..55b7b34b89
@@ -0,0 +1,134 @@
+#!/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
+
+function die()
+{
+    set +x
+    echo "FATAL: $*" >&2
+    exit 1
+}
+
+[ -z "$TOP" ] && die "\$TOP is not set"
+

automation/scripts/include/xtf-runner line 37

Quoted 10 lines
automation/scripts/include/xtf-runner new file +10 -0
+# Output log file
+TEST_LOG="${TEST_LOG:-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:-binaries}"
+# XTF source code
+XTF_SRC_CONFIG="${XTF_CONFIG:-${TOP}/include/configs/xtf-${ARCH}-config}"

Should this be XTF_SRC_CONFIG="${XTF_SRC_CONFIG:- ?

Quoted 102 lines
automation/scripts/include/xtf-runner new file +96 -0
+# 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}/.git ]; 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+=("loglvl=all noreboot console_timestamps=boot")
+    cmdline+=("console=${XEN_CONSOLE}")
+
+    # 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
+    ${TOP}/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
+}
automation/scripts/include/xtf-x86-64 new file +0 -0
new file mode 100644
index 0000000000..edddf18b38

automation/scripts/include/xtf-x86-64 line 10

Quoted 10 lines
automation/scripts/include/xtf-x86-64 new file +10 -0
@@ -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:-}"

It looks like QEMU_PREFIX is only used within this file (and other similar files in later patches). If so, maybe for the sake of reducing global variables and variables in general we could get rid of QEMU_PREFIX.

automation/scripts/include/xtf-x86-64 line 12

Quoted 2 lines
automation/scripts/include/xtf-x86-64 new file +2 -0
+    export XEN_BINARY="${XEN_BINARY:-${WORKDIR}/xen}"
+    export XEN_CONSOLE="${XEN_CONSOLE:-com1}"

Instead of XEN_CONSOLE, I'd suggest to have an arch-specific variable for Xen command line options where we can put the console as well as other things. However, it is also totally fine as is.

In fact, I think you went above and beyond in terms of generic abstractions, and I think it would have been OK to go with fewer variables, and more ad-hoc custom code.

Quoted 67 lines
automation/scripts/include/xtf-x86-64 new file +19 -0
+    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}\" \
+    "
+}
automation/scripts/qemu-smoke-x86-64.sh deleted +0 -26
deleted file mode 100755
index da0c26cc2f..0000000000
@@ -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\+$//'
automation/scripts/qemu-xtf.sh new file +10 -0
new file mode 100755
index 0000000000..2e16d4aece
@@ -0,0 +1,26 @@
+#!/bin/bash
+#
+# XTF test runner (QEMU).
+#
+
+set -e -o pipefail
+
+if [ $# -lt 3 ]; then
+    echo "Usage: $(basename $0) ARCH XTF-VARIANT XTF-NAME"
+    exit 1

automation/scripts/qemu-xtf.sh line 20

Quoted 10 lines
automation/scripts/qemu-xtf.sh new file +10 -0
+fi
+
+export ARCH="$1"
+shift
+
+export TOP="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
+if [ ! -f "${TOP}/include/xtf-${ARCH}" ]; then
+    echo "unsupported architecture '${ARCH}'" >&2
+    exit 1
+fi

This seems a bit complex.. maybe we can assume that we are in xen.git/ ?

automation/scripts/qemu-xtf.sh line 24

Quoted 3 lines
automation/scripts/qemu-xtf.sh new file +3 -0
+set -x
+source ${TOP}/include/xtf-runner
+source ${TOP}/include/xtf-${ARCH}

So here we could do:

source automation/scripts/include/xtf-runner

? Or is it important to be able to detect and calculate the directory? If so, why not use TOP=$(pwd) or TOP=${PWD} or TOP=$(dirname "$0")? By the way, if we need a variable for the top directory I would call it XEN_ROOT instead of TOP.

I see the patches are using both TOP and WORKDIR, maybe we can get rid of one of them? This is only a matter of taste but I think it would be simpler with fewer variables and most of the others look unavoidable.

Everything else looks OK to me.

Quoted 5 lines
automation/scripts/qemu-xtf.sh new file +1 -0
+xtf_test $@
Signature · 1 line
2.34.1
#3 lore raw

Re: [PATCH v1 1/4] CI: unify x86 XTF test runner

Quoted 66 lines · Stefano Stabellini
Quoted 65 lines · On Wed, 16 Apr 2025, [email protected] wrote:

From: Denis Mukhin <[email protected]>

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.

---
 automation/gitlab-ci/test.yaml                |   8 +-
 automation/scripts/.gitignore                 |   6 +
 .../scripts/include/configs/xtf-x86-64-config |   0
 automation/scripts/include/xtf-runner         | 134 ++++++++++++++++++
 automation/scripts/include/xtf-x86-64         |  31 ++++
 automation/scripts/qemu-smoke-x86-64.sh       |  26 ----
 automation/scripts/qemu-xtf.sh                |  26 ++++
 7 files changed, 201 insertions(+), 30 deletions(-)
 create mode 100644 automation/scripts/.gitignore
 create mode 100644 automation/scripts/include/configs/xtf-x86-64-config
 create mode 100644 automation/scripts/include/xtf-runner
 create mode 100644 automation/scripts/include/xtf-x86-64
 delete mode 100755 automation/scripts/qemu-smoke-x86-64.sh
 create mode 100755 automation/scripts/qemu-xtf.sh
automation/gitlab-ci/test.yaml +4 -4
index 5ce445b78f..3adc841335 100644
@@ -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
 
Quoted 15 lines

automation/scripts/.gitignore line 6

Quoted 12 lines
automation/scripts/.gitignore new file +6 -0
new file mode 100644
index 0000000000..2f2d6e1ebd
@@ -0,0 +1,6 @@
+!include
+
+binaries
+smoke.serial
+xen
+xtf*/

I am not sure this works as intended: I thought the paths are relative to the location of the .gitignore file, but I could be wrong.

git allows .gitignore at any level in the source tree so that lenghty paths could be avoided.

Quoted 42 lines
Quoted 42 lines
automation/scripts/include/configs/xtf-x86-64-config new file +0 -0
new file mode 100644
index 0000000000..e69de29bb2
automation/scripts/include/xtf-runner new file +31 -0
new file mode 100644
index 0000000000..55b7b34b89
@@ -0,0 +1,134 @@
+#!/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
+
+function die()
+{
+    set +x
+    echo "FATAL: $*" >&2
+    exit 1
+}
+
+[ -z "$TOP" ] && die "\$TOP is not set"
+
+# Output log file
+TEST_LOG="${TEST_LOG:-smoke.serial}"
+# XTF test printout in case of a pass
+PASSED="${PASSED:-Test result: SUCCESS}"
Quoted 8 lines

automation/scripts/include/xtf-runner line 37

Quoted 6 lines
automation/scripts/include/xtf-runner new file +6 -0
+# Expected boot message
+BOOT_MSG="${BOOT_MSG:-Latest ChangeSet: }"
+# Test working directory
+WORKDIR="${WORKDIR:-binaries}"
+# XTF source code
+XTF_SRC_CONFIG="${XTF_CONFIG:-${TOP}/include/configs/xtf-${ARCH}-config}"

Should this be XTF_SRC_CONFIG="${XTF_SRC_CONFIG:- ?

Thanks for the catch!

Quoted 111 lines
Quoted 111 lines
automation/scripts/include/xtf-runner new file +96 -0
+# 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}/.git ]; 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+=("loglvl=all noreboot console_timestamps=boot")
+    cmdline+=("console=${XEN_CONSOLE}")
+
+    # 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
+    ${TOP}/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
+}
automation/scripts/include/xtf-x86-64 new file +7 -0
new file mode 100644
index 0000000000..edddf18b38
@@ -0,0 +1,31 @@
+#!/bin/bash
+#
+# XTF test utilities (x86_64).
+#
+
+# Arch-specific environment overrides.
+function xtf_arch_prepare()
Quoted 8 lines

automation/scripts/include/xtf-x86-64 line 10

Quoted 3 lines
automation/scripts/include/xtf-x86-64 new file +3 -0
+{
+    export FW_PREFIX="${FW_PREFIX:-}"
+    export QEMU_PREFIX="${QEMU_PREFIX:-}"

It looks like QEMU_PREFIX is only used within this file (and other similar files in later patches). If so, maybe for the sake of reducing global variables and variables in general we could get rid of QEMU_PREFIX.

Turned out that Arm and x86 CI jobs use different paths to QEMU binaries. dev host may have some other location, that's why I parameterized QEMU location.

Quoted 8 lines

automation/scripts/include/xtf-x86-64 line 12

Quoted 4 lines
automation/scripts/include/xtf-x86-64 new file +2 -0
+    export XEN_BINARY="${XEN_BINARY:-${WORKDIR}/xen}"
+    export XEN_CONSOLE="${XEN_CONSOLE:-com1}"

Instead of XEN_CONSOLE, I'd suggest to have an arch-specific variable for Xen command line options where we can put the console as well as other things. However, it is also totally fine as is.

I initially did that, but then there's a big portion of command line parameters which is shared across all supported architectures, with console= pointing to arch-specific console device.

I will add arch-specific variable and drop XEN_CONSOLE.

Quoted 77 lines

In fact, I think you went above and beyond in terms of generic abstractions, and I think it would have been OK to go with fewer variables, and more ad-hoc custom code.

Quoted 71 lines
automation/scripts/include/xtf-x86-64 new file +19 -0
+    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}\" \
+    "
+}
automation/scripts/qemu-smoke-x86-64.sh deleted +0 -26
deleted file mode 100755
index da0c26cc2f..0000000000
@@ -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\+$//'
automation/scripts/qemu-xtf.sh new file +14 -0
new file mode 100755
index 0000000000..2e16d4aece
@@ -0,0 +1,26 @@
+#!/bin/bash
+#
+# XTF test runner (QEMU).
+#
+
+set -e -o pipefail
+
+if [ $# -lt 3 ]; then
+    echo "Usage: $(basename $0) ARCH XTF-VARIANT XTF-NAME"
+    exit 1
+fi
+
+export ARCH="$1"
+shift
Quoted 8 lines

automation/scripts/qemu-xtf.sh line 20

Quoted 6 lines
automation/scripts/qemu-xtf.sh new file +6 -0
+
+export TOP="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
+if [ ! -f "${TOP}/include/xtf-${ARCH}" ]; then
+    echo "unsupported architecture '${ARCH}'" >&2
+    exit 1
+fi

This seems a bit complex.. maybe we can assume that we are in xen.git/ ?

Will do that.

Quoted 10 lines

automation/scripts/qemu-xtf.sh line 24

Quoted 5 lines
automation/scripts/qemu-xtf.sh new file +3 -0
+set -x
+source ${TOP}/include/xtf-runner
+source ${TOP}/include/xtf-${ARCH}

So here we could do:

source automation/scripts/include/xtf-runner

Quoted 8 lines

? Or is it important to be able to detect and calculate the directory? If so, why not use TOP=$(pwd) or TOP=${PWD} or TOP=$(dirname "$0")? By the way, if we need a variable for the top directory I would call it XEN_ROOT instead of TOP.

I see the patches are using both TOP and WORKDIR, maybe we can get rid of one of them? This is only a matter of taste but I think it would be simpler with fewer variables and most of the others look unavoidable.

I will try to eliminate TOP uses.

Quoted 9 lines

Everything else looks OK to me.

Quoted 5 lines
automation/scripts/qemu-xtf.sh new file +1 -1
+xtf_test $@
--

2.34.1

#4 lore raw

PATCH 2/4 CI: switch x86 EFI smoke test runner to qemu-xtf.sh

In reply to [email protected]

From: Denis Mukhin <[email protected]>

Use qemu-xtf.sh for qemu-smoke-x86-64-gcc-efi job.

Lead time is reduced a bit since not all XTF code base is built, just the required test.

---
 automation/gitlab-ci/test.yaml                |  2 +-
 .../include/configs/xtf-x86-64-efi-config     |  0
 automation/scripts/include/xtf-x86-64-efi     | 52 +++++++++++++++++++
 automation/scripts/qemu-smoke-x86-64-efi.sh   | 43 ---------------
 4 files changed, 53 insertions(+), 44 deletions(-)
 create mode 100644 automation/scripts/include/configs/xtf-x86-64-efi-config
 create mode 100644 automation/scripts/include/xtf-x86-64-efi
 delete mode 100755 automation/scripts/qemu-smoke-x86-64-efi.sh
automation/gitlab-ci/test.yaml +1 -1
index 3adc841335..ca1e4eb528 100644
@@ -687,7 +687,7 @@ qemu-smoke-x86-64-clang-pvh:
 qemu-smoke-x86-64-gcc-efi:
   extends: .qemu-smoke-x86-64
   script:
-    - ./automation/scripts/qemu-smoke-x86-64-efi.sh pv 2>&1 | tee ${LOGFILE}
+    - ./automation/scripts/qemu-xtf.sh x86-64-efi hvm64 example 2>&1 | tee ${LOGFILE}
   needs:
     - debian-12-x86_64-gcc-debug
 
automation/scripts/include/configs/xtf-x86-64-efi-config new file +0 -0
new file mode 100644
index 0000000000..e69de29bb2
automation/scripts/include/xtf-x86-64-efi new file +52 -0

52 lines not on this page · raw message

automation/scripts/qemu-smoke-x86-64-efi.sh deleted +0 -43

43 lines not on this page · raw message

Signature · 1 line
2.34.1
#5 lore raw

Re: [PATCH v1 2/4] CI: switch x86 EFI smoke test runner to qemu-xtf.sh

Quoted 41 lines · On Wed, 16 Apr 2025, [email protected] wrote:

From: Denis Mukhin <[email protected]>

Use qemu-xtf.sh for qemu-smoke-x86-64-gcc-efi job.

Lead time is reduced a bit since not all XTF code base is built, just the required test.

---
 automation/gitlab-ci/test.yaml                |  2 +-
 .../include/configs/xtf-x86-64-efi-config     |  0
 automation/scripts/include/xtf-x86-64-efi     | 52 +++++++++++++++++++
 automation/scripts/qemu-smoke-x86-64-efi.sh   | 43 ---------------
 4 files changed, 53 insertions(+), 44 deletions(-)
 create mode 100644 automation/scripts/include/configs/xtf-x86-64-efi-config
 create mode 100644 automation/scripts/include/xtf-x86-64-efi
 delete mode 100755 automation/scripts/qemu-smoke-x86-64-efi.sh
automation/gitlab-ci/test.yaml +1 -1
index 3adc841335..ca1e4eb528 100644
@@ -687,7 +687,7 @@ qemu-smoke-x86-64-clang-pvh:
 qemu-smoke-x86-64-gcc-efi:
   extends: .qemu-smoke-x86-64
   script:
-    - ./automation/scripts/qemu-smoke-x86-64-efi.sh pv 2>&1 | tee ${LOGFILE}
+    - ./automation/scripts/qemu-xtf.sh x86-64-efi hvm64 example 2>&1 | tee ${LOGFILE}
   needs:
     - debian-12-x86_64-gcc-debug
 
automation/scripts/include/configs/xtf-x86-64-efi-config new file +0 -0
new file mode 100644
index 0000000000..e69de29bb2
automation/scripts/include/xtf-x86-64-efi new file +1 -0
new file mode 100644
index 0000000000..79622d5a6c
@@ -0,0 +1,52 @@
+#!/bin/bash

automation/scripts/include/xtf-x86-64-efi line 11

Quoted 10 lines
automation/scripts/include/xtf-x86-64-efi new file +10 -0
+#
+# XTF test utilities (x86_64, EFI).
+#
+
+# Arch-specific environment overrides.
+function xtf_arch_prepare()
+{
+    export FW_PREFIX="${FW_PREFIX:-/usr/share/OVMF/}"
+    export QEMU_PREFIX="${QEMU_PREFIX:-}"
+    export XEN_BINARY="${XEN_BINARY:-${WORKDIR}/xen.efi}"

Any chance we can avoid using WORKDIR? Or alternatively, we can remove TOP? Or remove both? :-)

Maybe it is best to keep WORKDIR and remove TOP, I am not sure. I am just trying to reduce the amount of variables used and that we depend upon.

I assume you tested the pipeline and it worked, right?

Quoted 94 lines
automation/scripts/include/xtf-x86-64-efi new file +41 -0
+    export XEN_CONSOLE="${XEN_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()
+{
+    local esp_dir="${WORKDIR}/boot-esp"
+    local efi_dir="${esp_dir}/EFI/BOOT"
+
+    # Generate EFI boot environment
+    mkdir -p ${efi_dir}
+    cp ${XEN_BINARY} ${efi_dir}/BOOTX64.EFI
+    cp ${XTF_BINARY} ${efi_dir}/kernel
+
+    cat > ${efi_dir}/BOOTX64.cfg <<EOF
+[global]
+default=test
+
+[test]
+options=${XEN_CMDLINE}
+kernel=kernel
+EOF
+
+    # NB: OVMF_CODE.fd is read-only, no need to copy
+    cp ${FW_PREFIX}OVMF_VARS.fd ${WORKDIR}
+
+    export TEST_CMD="${QEMU_PREFIX}qemu-system-x86_64 \
+        -no-reboot \
+        -nographic \
+        -monitor none \
+        -serial stdio \
+        -m 512 \
+        -M q35,kernel-irqchip=split \
+        -drive if=pflash,format=raw,readonly=on,file=${FW_PREFIX}OVMF_CODE.fd \
+        -drive if=pflash,format=raw,file=${WORKDIR}/OVMF_VARS.fd \
+        -drive file=fat:rw:${esp_dir},media=disk,index=0,format=raw \
+    "
+}
automation/scripts/qemu-smoke-x86-64-efi.sh deleted +0 -43
deleted file mode 100755
index 7572722be6..0000000000
@@ -1,43 +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
-
-mkdir -p boot-esp/EFI/BOOT
-cp binaries/xen.efi boot-esp/EFI/BOOT/BOOTX64.EFI
-cp xtf/tests/example/$k boot-esp/EFI/BOOT/kernel
-
-cat > boot-esp/EFI/BOOT/BOOTX64.cfg <<EOF
-[global]
-default=test
-
-[test]
-options=loglvl=all console=com1 noreboot console_timestamps=boot $extra
-kernel=kernel
-EOF
-
-cp /usr/share/OVMF/OVMF_CODE.fd OVMF_CODE.fd
-cp /usr/share/OVMF/OVMF_VARS.fd OVMF_VARS.fd
-
-rm -f smoke.serial
-export TEST_CMD="qemu-system-x86_64 -nographic -M q35,kernel-irqchip=split \
-        -drive if=pflash,format=raw,readonly=on,file=OVMF_CODE.fd \
-        -drive if=pflash,format=raw,file=OVMF_VARS.fd \
-        -drive file=fat:rw:boot-esp,media=disk,index=0,format=raw \
-        -m 512 -monitor none -serial stdio"
-
-export TEST_LOG="smoke.serial"
-export PASSED="Test result: SUCCESS"
-
-./automation/scripts/console.exp | sed 's/\r\+$//'
Signature · 1 line
2.34.1
#6 lore raw

Re: [PATCH v1 2/4] CI: switch x86 EFI smoke test runner to qemu-xtf.sh

Quoted 47 lines · Stefano Stabellini
Quoted 46 lines · On Wed, 16 Apr 2025, [email protected] wrote:

From: Denis Mukhin <[email protected]>

Use qemu-xtf.sh for qemu-smoke-x86-64-gcc-efi job.

Lead time is reduced a bit since not all XTF code base is built, just the required test.

---
 automation/gitlab-ci/test.yaml                |  2 +-
 .../include/configs/xtf-x86-64-efi-config     |  0
 automation/scripts/include/xtf-x86-64-efi     | 52 +++++++++++++++++++
 automation/scripts/qemu-smoke-x86-64-efi.sh   | 43 ---------------
 4 files changed, 53 insertions(+), 44 deletions(-)
 create mode 100644 automation/scripts/include/configs/xtf-x86-64-efi-config
 create mode 100644 automation/scripts/include/xtf-x86-64-efi
 delete mode 100755 automation/scripts/qemu-smoke-x86-64-efi.sh
automation/gitlab-ci/test.yaml +1 -1
index 3adc841335..ca1e4eb528 100644
@@ -687,7 +687,7 @@ qemu-smoke-x86-64-clang-pvh:
 qemu-smoke-x86-64-gcc-efi:
   extends: .qemu-smoke-x86-64
   script:
-    - ./automation/scripts/qemu-smoke-x86-64-efi.sh pv 2>&1 | tee ${LOGFILE}
+    - ./automation/scripts/qemu-xtf.sh x86-64-efi hvm64 example 2>&1 | tee ${LOGFILE}
   needs:
     - debian-12-x86_64-gcc-debug
 
automation/scripts/include/configs/xtf-x86-64-efi-config new file +0 -0
new file mode 100644
index 0000000000..e69de29bb2
automation/scripts/include/xtf-x86-64-efi new file +6 -0
new file mode 100644
index 0000000000..79622d5a6c
@@ -0,0 +1,52 @@
+#!/bin/bash
+#
+# XTF test utilities (x86_64, EFI).
+#
+
+# Arch-specific environment overrides.
Quoted 8 lines

automation/scripts/include/xtf-x86-64-efi line 11

Quoted 5 lines
automation/scripts/include/xtf-x86-64-efi new file +5 -0
+function xtf_arch_prepare()
+{
+    export FW_PREFIX="${FW_PREFIX:-/usr/share/OVMF/}"
+    export QEMU_PREFIX="${QEMU_PREFIX:-}"
+    export XEN_BINARY="${XEN_BINARY:-${WORKDIR}/xen.efi}"

Any chance we can avoid using WORKDIR? Or alternatively, we can remove TOP? Or remove both? :-)

Yeah, it grew a bit convoluted, but I decided to give it a try to collect opinions.

Thanks for the feedback!

These two variables have different meanings:

- WORKDIR is a scratch location for keeping artifacts like DTB, EFI config, imagebuilder config.

- TOP (looks like at the very least needs a better name) is the helper variable pointint to the location of automation/scripts.

Quoted 4 lines

Maybe it is best to keep WORKDIR and remove TOP, I am not sure. I am just trying to reduce the amount of variables used and that we depend upon.

I think it should be easy to drop TOP.

Quoted 2 lines

I assume you tested the pipeline and it worked, right?

Yes, the pipeline is green:

https://gitlab.com/xen-project/people/dmukhin/xen/-/pipelines/1770437024

Quoted 96 lines
Quoted 96 lines
automation/scripts/include/xtf-x86-64-efi new file +41 -0
+    export XEN_CONSOLE="${XEN_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()
+{
+    local esp_dir="${WORKDIR}/boot-esp"
+    local efi_dir="${esp_dir}/EFI/BOOT"
+
+    # Generate EFI boot environment
+    mkdir -p ${efi_dir}
+    cp ${XEN_BINARY} ${efi_dir}/BOOTX64.EFI
+    cp ${XTF_BINARY} ${efi_dir}/kernel
+
+    cat > ${efi_dir}/BOOTX64.cfg <<EOF
+[global]
+default=test
+
+[test]
+options=${XEN_CMDLINE}
+kernel=kernel
+EOF
+
+    # NB: OVMF_CODE.fd is read-only, no need to copy
+    cp ${FW_PREFIX}OVMF_VARS.fd ${WORKDIR}
+
+    export TEST_CMD="${QEMU_PREFIX}qemu-system-x86_64 \
+        -no-reboot \
+        -nographic \
+        -monitor none \
+        -serial stdio \
+        -m 512 \
+        -M q35,kernel-irqchip=split \
+        -drive if=pflash,format=raw,readonly=on,file=${FW_PREFIX}OVMF_CODE.fd \
+        -drive if=pflash,format=raw,file=${WORKDIR}/OVMF_VARS.fd \
+        -drive file=fat:rw:${esp_dir},media=disk,index=0,format=raw \
+    "
+}
automation/scripts/qemu-smoke-x86-64-efi.sh deleted +0 -44
deleted file mode 100755
index 7572722be6..0000000000
@@ -1,43 +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
-
-mkdir -p boot-esp/EFI/BOOT
-cp binaries/xen.efi boot-esp/EFI/BOOT/BOOTX64.EFI
-cp xtf/tests/example/$k boot-esp/EFI/BOOT/kernel
-
-cat > boot-esp/EFI/BOOT/BOOTX64.cfg <<EOF
-[global]
-default=test
-
-[test]
-options=loglvl=all console=com1 noreboot console_timestamps=boot $extra
-kernel=kernel
-EOF
-
-cp /usr/share/OVMF/OVMF_CODE.fd OVMF_CODE.fd
-cp /usr/share/OVMF/OVMF_VARS.fd OVMF_VARS.fd
-
-rm -f smoke.serial
-export TEST_CMD="qemu-system-x86_64 -nographic -M q35,kernel-irqchip=split \
-        -drive if=pflash,format=raw,readonly=on,file=OVMF_CODE.fd \
-        -drive if=pflash,format=raw,file=OVMF_VARS.fd \
-        -drive file=fat:rw:boot-esp,media=disk,index=0,format=raw \
-        -m 512 -monitor none -serial stdio"
-
-export TEST_LOG="smoke.serial"
-export PASSED="Test result: SUCCESS"
-
-./automation/scripts/console.exp | sed 's/\r\+$//'
--

2.34.1

#7 lore raw

PATCH 3/4 CI: switch arm64 XTF test runner to qemu-xtf.sh

In reply to [email protected]

From: Denis Mukhin <[email protected]>

Hook arm64 QEMU configuration to qemu-xtf.sh and use new script in arm64 CI jobs.

---
 automation/gitlab-ci/test.yaml                |  4 +-
 automation/scripts/.gitignore                 |  3 +
 .../scripts/include/configs/xtf-arm64-config  |  2 +
 automation/scripts/include/xtf-arm64          | 81 +++++++++++++++++++
 automation/scripts/qemu-xtf-dom0less-arm64.sh | 68 ----------------
 5 files changed, 88 insertions(+), 70 deletions(-)
 create mode 100644 automation/scripts/include/configs/xtf-arm64-config
 create mode 100644 automation/scripts/include/xtf-arm64
 delete mode 100755 automation/scripts/qemu-xtf-dom0less-arm64.sh
automation/gitlab-ci/test.yaml +2 -2
index ca1e4eb528..d6e4a0a622 100644
@@ -571,7 +571,7 @@ qemu-smoke-dom0less-arm64-gcc-debug-earlyprintk:
 qemu-xtf-dom0less-arm64-gcc-hyp-xen-version:
   extends: .qemu-arm64
   script:
-    - ./automation/scripts/qemu-xtf-dom0less-arm64.sh hyp-xen-version 2>&1 | tee ${LOGFILE}
+    - ./automation/scripts/qemu-xtf.sh arm64 mmu64le hyp-xen-version 2>&1 | tee ${LOGFILE}
   needs:
     - alpine-3.18-gcc-arm64
     - qemu-system-aarch64-6.0.0-arm64-export
@@ -579,7 +579,7 @@ qemu-xtf-dom0less-arm64-gcc-hyp-xen-version:
 qemu-xtf-dom0less-arm64-gcc-debug-hyp-xen-version:
   extends: .qemu-arm64
   script:
-    - ./automation/scripts/qemu-xtf-dom0less-arm64.sh hyp-xen-version 2>&1 | tee ${LOGFILE}
+    - ./automation/scripts/qemu-xtf.sh arm64 mmu64le hyp-xen-version 2>&1 | tee ${LOGFILE}
   needs:
     - alpine-3.18-gcc-debug-arm64
     - qemu-system-aarch64-6.0.0-arm64-export
automation/scripts/.gitignore +3 -0
index 2f2d6e1ebd..f853da4d89 100644
@@ -1,6 +1,9 @@
 !include
 
 binaries
+imagebuilder
 smoke.serial
 xen
 xtf*/
+
+*.rom
automation/scripts/include/configs/xtf-arm64-config new file +2 -0
new file mode 100644
index 0000000000..9942740927
@@ -0,0 +1,2 @@
+CONFIG_GICV2=y
+CONFIG_SBSA_UART=y
automation/scripts/include/xtf-arm64 new file +81 -0

81 lines not on this page · raw message

automation/scripts/qemu-xtf-dom0less-arm64.sh deleted +0 -68

68 lines not on this page · raw message

Signature · 1 line
2.34.1
Reviewed-by on v1 3/4
#8 lore raw

Re: [PATCH v1 3/4] CI: switch arm64 XTF test runner to qemu-xtf.sh

Quoted 6 lines · On Wed, 16 Apr 2025, [email protected] wrote:

From: Denis Mukhin <[email protected]>

Hook arm64 QEMU configuration to qemu-xtf.sh and use new script in arm64 CI jobs.

Quoted 220 lines
---
 automation/gitlab-ci/test.yaml                |  4 +-
 automation/scripts/.gitignore                 |  3 +
 .../scripts/include/configs/xtf-arm64-config  |  2 +
 automation/scripts/include/xtf-arm64          | 81 +++++++++++++++++++
 automation/scripts/qemu-xtf-dom0less-arm64.sh | 68 ----------------
 5 files changed, 88 insertions(+), 70 deletions(-)
 create mode 100644 automation/scripts/include/configs/xtf-arm64-config
 create mode 100644 automation/scripts/include/xtf-arm64
 delete mode 100755 automation/scripts/qemu-xtf-dom0less-arm64.sh
automation/gitlab-ci/test.yaml +2 -2
index ca1e4eb528..d6e4a0a622 100644
@@ -571,7 +571,7 @@ qemu-smoke-dom0less-arm64-gcc-debug-earlyprintk:
 qemu-xtf-dom0less-arm64-gcc-hyp-xen-version:
   extends: .qemu-arm64
   script:
-    - ./automation/scripts/qemu-xtf-dom0less-arm64.sh hyp-xen-version 2>&1 | tee ${LOGFILE}
+    - ./automation/scripts/qemu-xtf.sh arm64 mmu64le hyp-xen-version 2>&1 | tee ${LOGFILE}
   needs:
     - alpine-3.18-gcc-arm64
     - qemu-system-aarch64-6.0.0-arm64-export
@@ -579,7 +579,7 @@ qemu-xtf-dom0less-arm64-gcc-hyp-xen-version:
 qemu-xtf-dom0less-arm64-gcc-debug-hyp-xen-version:
   extends: .qemu-arm64
   script:
-    - ./automation/scripts/qemu-xtf-dom0less-arm64.sh hyp-xen-version 2>&1 | tee ${LOGFILE}
+    - ./automation/scripts/qemu-xtf.sh arm64 mmu64le hyp-xen-version 2>&1 | tee ${LOGFILE}
   needs:
     - alpine-3.18-gcc-debug-arm64
     - qemu-system-aarch64-6.0.0-arm64-export
automation/scripts/.gitignore +3 -0
index 2f2d6e1ebd..f853da4d89 100644
@@ -1,6 +1,9 @@
 !include
 
 binaries
+imagebuilder
 smoke.serial
 xen
 xtf*/
+
+*.rom
automation/scripts/include/configs/xtf-arm64-config new file +2 -0
new file mode 100644
index 0000000000..9942740927
@@ -0,0 +1,2 @@
+CONFIG_GICV2=y
+CONFIG_SBSA_UART=y
automation/scripts/include/xtf-arm64 new file +81 -0
new file mode 100644
index 0000000000..68487fe617
@@ -0,0 +1,81 @@
+#!/bin/bash
+#
+# XTF test utilities (arm64).
+#
+
+# Arch-specific environment overrides.
+function xtf_arch_prepare()
+{
+    export FW_PREFIX="${FW_PREFIX:-/usr/lib/u-boot/qemu_arm64/}"
+    export QEMU_PREFIX="${QEMU_PREFIX:-${WORKDIR}/}"
+    export XEN_BINARY="${XEN_BINARY:-${WORKDIR}/xen}"
+    export XEN_CONSOLE="${XEN_CONSOLE:-dtuart}"
+    export XTF_SRC_BRANCH="${XTF_SRC_BRANCH:-xtf-arm}"
+    export XTF_SRC_URI="${XTF_SRC_URI:-https://gitlab.com/xen-project/fusa/xtf.git}"
+    export XTF_SRC_VARIANTS="mmu64le"
+}
+
+# Perform arch-specific XTF environment setup.
+function xtf_arch_setup()
+{
+    # QEMU looks for "efi-virtio.rom" even if it is unneeded
+    curl -fsSLO https://github.com/qemu/qemu/raw/v5.2.0/pc-bios/efi-virtio.rom
+
+    # Crude check for local testing
+    if [ ! -d imagebuilder/.git ]; then
+        git clone --depth 1 https://gitlab.com/xen-project/imagebuilder.git
+    fi
+
+    cat > ${WORKDIR}/config <<EOF
+MEMORY_START="0x40000000"
+MEMORY_END="0xC0000000"
+
+XEN="xen"
+DEVICE_TREE="virt-gicv2.dtb"
+
+XEN_CMD="${XEN_CMDLINE}"
+
+DOMU_KERNEL[0]="xtf-test"
+DOMU_MEM[0]="128"
+
+NUM_DOMUS=1
+
+LOAD_CMD="tftpb"
+UBOOT_SOURCE="boot.source"
+UBOOT_SCRIPT="boot.scr"
+EOF
+    cp ${XTF_BINARY} ${WORKDIR}/xtf-test
+
+    # Generate virt-gicv2.dtb
+    ${WORKDIR}/qemu-system-aarch64 \
+        -machine virtualization=true \
+        -cpu cortex-a57 \
+        -machine type=virt \
+        -m 2048 \
+        -smp 2 \
+        -display none \
+        -machine dumpdtb=${WORKDIR}/virt-gicv2.dtb
+
+    # Generate U-Boot environment
+    bash -x imagebuilder/scripts/uboot-script-gen \
+        -t tftp \
+        -d ${WORKDIR}/ \
+        -c ${WORKDIR}/config
+
+    export TEST_CMD="${QEMU_PREFIX}qemu-system-aarch64 \
+        -machine virtualization=true \
+        -cpu cortex-a57 \
+        -machine type=virt \
+        -no-reboot \
+        -nographic \
+        -monitor none \
+        -serial stdio \
+        -m 2048 \
+        -smp 2 \
+        -device virtio-net-pci,netdev=n0 \
+        -netdev user,id=n0,tftp=${WORKDIR} \
+        -bios ${FW_PREFIX}u-boot.bin \
+    "
+
+    export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
+}
automation/scripts/qemu-xtf-dom0less-arm64.sh deleted +0 -68
deleted file mode 100755
index 436f460c3c..0000000000
@@ -1,68 +0,0 @@
-#!/bin/bash
-
-set -ex -o pipefail
-
-# Name of the XTF test
-xtf_test=$1
-
-# Message returned by XTF in case of success
-passed="Test result: SUCCESS"
-
-# XXX QEMU looks for "efi-virtio.rom" even if it is unneeded
-curl -fsSLO https://github.com/qemu/qemu/raw/v5.2.0/pc-bios/efi-virtio.rom
-./binaries/qemu-system-aarch64 \
-   -machine virtualization=true \
-   -cpu cortex-a57 -machine type=virt \
-   -m 2048 -smp 2 -display none \
-   -machine dumpdtb=binaries/virt-gicv2.dtb
-
-# XTF
-# Build a single XTF test passed as a first parameter to the script.
-# Build XTF with GICv2 support to match Qemu configuration and with SBSA UART
-# support, so that the test will use an emulated UART for printing messages.
-# This will allow us to run the test on both debug and non-debug Xen builds.
-rm -rf xtf
-git clone https://gitlab.com/xen-project/fusa/xtf.git -b xtf-arm
-make -C xtf TESTS=tests/${xtf_test} CONFIG_SBSA_UART=y CONFIG_GICV2=y -j$(nproc)
-cp xtf/tests/${xtf_test}/test-mmu64le-${xtf_test} binaries/xtf-test
-
-# ImageBuilder
-echo 'MEMORY_START="0x40000000"
-MEMORY_END="0xC0000000"
-
-XEN="xen"
-DEVICE_TREE="virt-gicv2.dtb"
-
-XEN_CMD="console=dtuart console_timestamps=boot"
-
-DOMU_KERNEL[0]="xtf-test"
-DOMU_MEM[0]="128"
-
-NUM_DOMUS=1
-
-LOAD_CMD="tftpb"
-UBOOT_SOURCE="boot.source"
-UBOOT_SCRIPT="boot.scr"' > binaries/config
-
-rm -rf imagebuilder
-git clone --depth 1 https://gitlab.com/xen-project/imagebuilder.git
-bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/config
-
-# Run the test
-rm -f smoke.serial
-export TEST_CMD="./binaries/qemu-system-aarch64 \
-    -machine virtualization=true \
-    -cpu cortex-a57 -machine type=virt \
-    -m 2048 -monitor none -serial stdio \
-    -smp 2 \
-    -no-reboot \
-    -device virtio-net-pci,netdev=n0 \
-    -netdev user,id=n0,tftp=binaries \
-    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin"
-
-export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
-export BOOT_MSG="Latest ChangeSet: "
-export TEST_LOG="smoke.serial"
-export PASSED="${passed}"
-
-./automation/scripts/console.exp | sed 's/\r\+$//'
Signature · 1 line
2.34.1
#9 lore raw

Re: [PATCH v1 3/4] CI: switch arm64 XTF test runner to qemu-xtf.sh

Quoted 9 lines · Stefano Stabellini
Quoted 6 lines · On Wed, 16 Apr 2025, [email protected] wrote:

From: Denis Mukhin <[email protected]>

Hook arm64 QEMU configuration to qemu-xtf.sh and use new script in arm64 CI jobs.

Thanks!

Quoted 222 lines
Quoted 222 lines

---
 automation/gitlab-ci/test.yaml                |  4 +-
 automation/scripts/.gitignore                 |  3 +
 .../scripts/include/configs/xtf-arm64-config  |  2 +
 automation/scripts/include/xtf-arm64          | 81 +++++++++++++++++++
 automation/scripts/qemu-xtf-dom0less-arm64.sh | 68 ----------------
 5 files changed, 88 insertions(+), 70 deletions(-)
 create mode 100644 automation/scripts/include/configs/xtf-arm64-config
 create mode 100644 automation/scripts/include/xtf-arm64
 delete mode 100755 automation/scripts/qemu-xtf-dom0less-arm64.sh
automation/gitlab-ci/test.yaml +2 -2
index ca1e4eb528..d6e4a0a622 100644
@@ -571,7 +571,7 @@ qemu-smoke-dom0less-arm64-gcc-debug-earlyprintk:
 qemu-xtf-dom0less-arm64-gcc-hyp-xen-version:
   extends: .qemu-arm64
   script:
-    - ./automation/scripts/qemu-xtf-dom0less-arm64.sh hyp-xen-version 2>&1 | tee ${LOGFILE}
+    - ./automation/scripts/qemu-xtf.sh arm64 mmu64le hyp-xen-version 2>&1 | tee ${LOGFILE}
   needs:
     - alpine-3.18-gcc-arm64
     - qemu-system-aarch64-6.0.0-arm64-export
@@ -579,7 +579,7 @@ qemu-xtf-dom0less-arm64-gcc-hyp-xen-version:
 qemu-xtf-dom0less-arm64-gcc-debug-hyp-xen-version:
   extends: .qemu-arm64
   script:
-    - ./automation/scripts/qemu-xtf-dom0less-arm64.sh hyp-xen-version 2>&1 | tee ${LOGFILE}
+    - ./automation/scripts/qemu-xtf.sh arm64 mmu64le hyp-xen-version 2>&1 | tee ${LOGFILE}
   needs:
     - alpine-3.18-gcc-debug-arm64
     - qemu-system-aarch64-6.0.0-arm64-export
automation/scripts/.gitignore +3 -0
index 2f2d6e1ebd..f853da4d89 100644
@@ -1,6 +1,9 @@
 !include
 
 binaries
+imagebuilder
 smoke.serial
 xen
 xtf*/
+
+*.rom
automation/scripts/include/configs/xtf-arm64-config new file +2 -0
new file mode 100644
index 0000000000..9942740927
@@ -0,0 +1,2 @@
+CONFIG_GICV2=y
+CONFIG_SBSA_UART=y
automation/scripts/include/xtf-arm64 new file +81 -0
new file mode 100644
index 0000000000..68487fe617
@@ -0,0 +1,81 @@
+#!/bin/bash
+#
+# XTF test utilities (arm64).
+#
+
+# Arch-specific environment overrides.
+function xtf_arch_prepare()
+{
+    export FW_PREFIX="${FW_PREFIX:-/usr/lib/u-boot/qemu_arm64/}"
+    export QEMU_PREFIX="${QEMU_PREFIX:-${WORKDIR}/}"
+    export XEN_BINARY="${XEN_BINARY:-${WORKDIR}/xen}"
+    export XEN_CONSOLE="${XEN_CONSOLE:-dtuart}"
+    export XTF_SRC_BRANCH="${XTF_SRC_BRANCH:-xtf-arm}"
+    export XTF_SRC_URI="${XTF_SRC_URI:-https://gitlab.com/xen-project/fusa/xtf.git}"
+    export XTF_SRC_VARIANTS="mmu64le"
+}
+
+# Perform arch-specific XTF environment setup.
+function xtf_arch_setup()
+{
+    # QEMU looks for "efi-virtio.rom" even if it is unneeded
+    curl -fsSLO https://github.com/qemu/qemu/raw/v5.2.0/pc-bios/efi-virtio.rom
+
+    # Crude check for local testing
+    if [ ! -d imagebuilder/.git ]; then
+        git clone --depth 1 https://gitlab.com/xen-project/imagebuilder.git
+    fi
+
+    cat > ${WORKDIR}/config <<EOF
+MEMORY_START="0x40000000"
+MEMORY_END="0xC0000000"
+
+XEN="xen"
+DEVICE_TREE="virt-gicv2.dtb"
+
+XEN_CMD="${XEN_CMDLINE}"
+
+DOMU_KERNEL[0]="xtf-test"
+DOMU_MEM[0]="128"
+
+NUM_DOMUS=1
+
+LOAD_CMD="tftpb"
+UBOOT_SOURCE="boot.source"
+UBOOT_SCRIPT="boot.scr"
+EOF
+    cp ${XTF_BINARY} ${WORKDIR}/xtf-test
+
+    # Generate virt-gicv2.dtb
+    ${WORKDIR}/qemu-system-aarch64 \
+        -machine virtualization=true \
+        -cpu cortex-a57 \
+        -machine type=virt \
+        -m 2048 \
+        -smp 2 \
+        -display none \
+        -machine dumpdtb=${WORKDIR}/virt-gicv2.dtb
+
+    # Generate U-Boot environment
+    bash -x imagebuilder/scripts/uboot-script-gen \
+        -t tftp \
+        -d ${WORKDIR}/ \
+        -c ${WORKDIR}/config
+
+    export TEST_CMD="${QEMU_PREFIX}qemu-system-aarch64 \
+        -machine virtualization=true \
+        -cpu cortex-a57 \
+        -machine type=virt \
+        -no-reboot \
+        -nographic \
+        -monitor none \
+        -serial stdio \
+        -m 2048 \
+        -smp 2 \
+        -device virtio-net-pci,netdev=n0 \
+        -netdev user,id=n0,tftp=${WORKDIR} \
+        -bios ${FW_PREFIX}u-boot.bin \
+    "
+
+    export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
+}
automation/scripts/qemu-xtf-dom0less-arm64.sh deleted +0 -69
deleted file mode 100755
index 436f460c3c..0000000000
@@ -1,68 +0,0 @@
-#!/bin/bash
-
-set -ex -o pipefail
-
-# Name of the XTF test
-xtf_test=$1
-
-# Message returned by XTF in case of success
-passed="Test result: SUCCESS"
-
-# XXX QEMU looks for "efi-virtio.rom" even if it is unneeded
-curl -fsSLO https://github.com/qemu/qemu/raw/v5.2.0/pc-bios/efi-virtio.rom
-./binaries/qemu-system-aarch64 \
-   -machine virtualization=true \
-   -cpu cortex-a57 -machine type=virt \
-   -m 2048 -smp 2 -display none \
-   -machine dumpdtb=binaries/virt-gicv2.dtb
-
-# XTF
-# Build a single XTF test passed as a first parameter to the script.
-# Build XTF with GICv2 support to match Qemu configuration and with SBSA UART
-# support, so that the test will use an emulated UART for printing messages.
-# This will allow us to run the test on both debug and non-debug Xen builds.
-rm -rf xtf
-git clone https://gitlab.com/xen-project/fusa/xtf.git -b xtf-arm
-make -C xtf TESTS=tests/${xtf_test} CONFIG_SBSA_UART=y CONFIG_GICV2=y -j$(nproc)
-cp xtf/tests/${xtf_test}/test-mmu64le-${xtf_test} binaries/xtf-test
-
-# ImageBuilder
-echo 'MEMORY_START="0x40000000"
-MEMORY_END="0xC0000000"
-
-XEN="xen"
-DEVICE_TREE="virt-gicv2.dtb"
-
-XEN_CMD="console=dtuart console_timestamps=boot"
-
-DOMU_KERNEL[0]="xtf-test"
-DOMU_MEM[0]="128"
-
-NUM_DOMUS=1
-
-LOAD_CMD="tftpb"
-UBOOT_SOURCE="boot.source"
-UBOOT_SCRIPT="boot.scr"' > binaries/config
-
-rm -rf imagebuilder
-git clone --depth 1 https://gitlab.com/xen-project/imagebuilder.git
-bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/config
-
-# Run the test
-rm -f smoke.serial
-export TEST_CMD="./binaries/qemu-system-aarch64 \
-    -machine virtualization=true \
-    -cpu cortex-a57 -machine type=virt \
-    -m 2048 -monitor none -serial stdio \
-    -smp 2 \
-    -no-reboot \
-    -device virtio-net-pci,netdev=n0 \
-    -netdev user,id=n0,tftp=binaries \
-    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin"
-
-export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
-export BOOT_MSG="Latest ChangeSet: "
-export TEST_LOG="smoke.serial"
-export PASSED="${passed}"
-
-./automation/scripts/console.exp | sed 's/\r\+$//'
--

2.34.1

#10 lore raw

PATCH 4/4 CI: add argo x86 XTF test

In reply to [email protected]

From: Denis Mukhin <[email protected]>

Introduce new CI job to run x86 XTF argo test under QEMU to smoke test argo feature functionality in upstream CI.

The new job lead time is ~30s, limit max job duration to 60s.

---
 automation/gitlab-ci/test.yaml        | 9 +++++++++
 automation/scripts/include/xtf-runner | 7 +++++++
 2 files changed, 16 insertions(+)
automation/gitlab-ci/test.yaml +9 -0
index d6e4a0a622..9001efb45c 100644
@@ -691,6 +691,15 @@ qemu-smoke-x86-64-gcc-efi:
   needs:
     - debian-12-x86_64-gcc-debug
 
+qemu-xtf-argo-x86_64-gcc-debug:
+  extends: .qemu-smoke-x86-64
+  variables:
+    TEST_TIMEOUT_OVERRIDE: 60
+  script:
+    - ./automation/scripts/qemu-xtf.sh x86-64 pv64 argo 2>&1 | tee ${LOGFILE}
+  needs:
+    - alpine-3.18-gcc-debug
+
 qemu-smoke-riscv64-gcc:
   extends: .qemu-riscv64
   script:
automation/scripts/include/xtf-runner +7 -0
index 55b7b34b89..12470b3979 100644
@@ -70,6 +70,9 @@ function xtf_build_cmdline()
     local xtf_variant=$1
     local xtf_name=$2
     declare -a cmdline=()
+    declare -A per_test_args=(
+        [argo]="argo=1 mac-permissive=1"
+    )
 
     cmdline+=("loglvl=all noreboot console_timestamps=boot")
     cmdline+=("console=${XEN_CONSOLE}")
@@ -79,6 +82,10 @@ function xtf_build_cmdline()
         cmdline+=("dom0-iommu=none dom0=pvh")
     fi
 
+    if [[ -v per_test_args[${xtf_name}] ]]; then
+        cmdline+=("${per_test_args[${xtf_name}]}")
+    fi
+
     export XEN_CMDLINE="${cmdline[@]}"
 }
 
Signature · 1 line
2.34.1
#11 lore raw

Re: [PATCH v1 4/4] CI: add argo x86 XTF test

Quoted 48 lines · On Wed, 16 Apr 2025, [email protected] wrote:

From: Denis Mukhin <[email protected]>

Introduce new CI job to run x86 XTF argo test under QEMU to smoke test argo feature functionality in upstream CI.

The new job lead time is ~30s, limit max job duration to 60s.

---
 automation/gitlab-ci/test.yaml        | 9 +++++++++
 automation/scripts/include/xtf-runner | 7 +++++++
 2 files changed, 16 insertions(+)
automation/gitlab-ci/test.yaml +9 -0
index d6e4a0a622..9001efb45c 100644
@@ -691,6 +691,15 @@ qemu-smoke-x86-64-gcc-efi:
   needs:
     - debian-12-x86_64-gcc-debug
 
+qemu-xtf-argo-x86_64-gcc-debug:
+  extends: .qemu-smoke-x86-64
+  variables:
+    TEST_TIMEOUT_OVERRIDE: 60
+  script:
+    - ./automation/scripts/qemu-xtf.sh x86-64 pv64 argo 2>&1 | tee ${LOGFILE}
+  needs:
+    - alpine-3.18-gcc-debug
+
 qemu-smoke-riscv64-gcc:
   extends: .qemu-riscv64
   script:
automation/scripts/include/xtf-runner +4 -0
index 55b7b34b89..12470b3979 100644
@@ -70,6 +70,9 @@ function xtf_build_cmdline()
     local xtf_variant=$1
     local xtf_name=$2
     declare -a cmdline=()
+    declare -A per_test_args=(
+        [argo]="argo=1 mac-permissive=1"
+    )
+
     cmdline+=("loglvl=all noreboot console_timestamps=boot")
     cmdline+=("console=${XEN_CONSOLE}")

automation/scripts/include/xtf-runner function xtf_build_cmdline() · line 88

Quoted 7 lines
automation/scripts/include/xtf-runner +4 -0
@@ -79,6 +82,10 @@ function xtf_build_cmdline()
         cmdline+=("dom0-iommu=none dom0=pvh")
     fi
 
+    if [[ -v per_test_args[${xtf_name}] ]]; then
+        cmdline+=("${per_test_args[${xtf_name}]}")
+    fi
+

This is all within the same bash function so I think we could avoid using the per_test_args array and just do:

if test "$xtf_name"
then

    cmdline+=("argo=1 mac-permissive=1")

fi

The indirection is not required as far as I can tell. I do realize it is a matter of taste and it works either way so I wouldn't insist.

Quoted 7 lines
automation/scripts/include/xtf-runner +0 -0
     export XEN_CMDLINE="${cmdline[@]}"
 }
 
Signature · 1 line
2.34.1
#12 lore raw

Re: [PATCH v1 4/4] CI: add argo x86 XTF test

Quoted 60 lines · Stefano Stabellini
Quoted 48 lines · On Wed, 16 Apr 2025, [email protected] wrote:

From: Denis Mukhin <[email protected]>

Introduce new CI job to run x86 XTF argo test under QEMU to smoke test argo feature functionality in upstream CI.

The new job lead time is ~30s, limit max job duration to 60s.

---
 automation/gitlab-ci/test.yaml        | 9 +++++++++
 automation/scripts/include/xtf-runner | 7 +++++++
 2 files changed, 16 insertions(+)
automation/gitlab-ci/test.yaml +9 -0
index d6e4a0a622..9001efb45c 100644
@@ -691,6 +691,15 @@ qemu-smoke-x86-64-gcc-efi:
   needs:
     - debian-12-x86_64-gcc-debug
 
+qemu-xtf-argo-x86_64-gcc-debug:
+  extends: .qemu-smoke-x86-64
+  variables:
+    TEST_TIMEOUT_OVERRIDE: 60
+  script:
+    - ./automation/scripts/qemu-xtf.sh x86-64 pv64 argo 2>&1 | tee ${LOGFILE}
+  needs:
+    - alpine-3.18-gcc-debug
+
 qemu-smoke-riscv64-gcc:
   extends: .qemu-riscv64
   script:
automation/scripts/include/xtf-runner +4 -0
index 55b7b34b89..12470b3979 100644
@@ -70,6 +70,9 @@ function xtf_build_cmdline()
     local xtf_variant=$1
     local xtf_name=$2
     declare -a cmdline=()
+    declare -A per_test_args=(
+        [argo]="argo=1 mac-permissive=1"
+    )
+
     cmdline+=("loglvl=all noreboot console_timestamps=boot")
     cmdline+=("console=${XEN_CONSOLE}")

automation/scripts/include/xtf-runner function xtf_build_cmdline() · line 88

Quoted 7 lines
automation/scripts/include/xtf-runner +4 -0
@@ -79,6 +82,10 @@ function xtf_build_cmdline()
         cmdline+=("dom0-iommu=none dom0=pvh")
     fi
 
+    if [[ -v per_test_args[${xtf_name}] ]]; then
+        cmdline+=("${per_test_args[${xtf_name}]}")
+    fi
+

This is all within the same bash function so I think we could avoid using the per_test_args array and just do:

Quoted 7 lines

if test "$xtf_name"
then

    cmdline+=("argo=1 mac-permissive=1")

fi

The indirection is not required as far as I can tell. I do realize it is a matter of taste and it works either way so I wouldn't insist.

Some XTFs may need special configuration.
I added this to be a placeholder for test-specific Xen run-time configuration.

Quoted 10 lines
Quoted 10 lines
automation/scripts/include/xtf-runner +0 -1
     export XEN_CMDLINE="${cmdline[@]}"
 }
 
--

2.34.1