[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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



From: Denis Mukhin <dmukhin@xxxxxxxx>

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

Signed-off-by: Denis Mukhin <dmukhin@xxxxxxxx>
---
 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

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index ca1e4eb528..d6e4a0a622 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -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
diff --git a/automation/scripts/.gitignore b/automation/scripts/.gitignore
index 2f2d6e1ebd..f853da4d89 100644
--- a/automation/scripts/.gitignore
+++ b/automation/scripts/.gitignore
@@ -1,6 +1,9 @@
 !include
 
 binaries
+imagebuilder
 smoke.serial
 xen
 xtf*/
+
+*.rom
diff --git a/automation/scripts/include/configs/xtf-arm64-config 
b/automation/scripts/include/configs/xtf-arm64-config
new file mode 100644
index 0000000000..9942740927
--- /dev/null
+++ b/automation/scripts/include/configs/xtf-arm64-config
@@ -0,0 +1,2 @@
+CONFIG_GICV2=y
+CONFIG_SBSA_UART=y
diff --git a/automation/scripts/include/xtf-arm64 
b/automation/scripts/include/xtf-arm64
new file mode 100644
index 0000000000..68487fe617
--- /dev/null
+++ b/automation/scripts/include/xtf-arm64
@@ -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"
+}
diff --git a/automation/scripts/qemu-xtf-dom0less-arm64.sh 
b/automation/scripts/qemu-xtf-dom0less-arm64.sh
deleted file mode 100755
index 436f460c3c..0000000000
--- a/automation/scripts/qemu-xtf-dom0less-arm64.sh
+++ /dev/null
@@ -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





 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.