|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 3/3] automation: run tools/tests on arm64 under QEMU
Currently the tests from tools/tests/* are only run on x86 hardware. So,
add jobs running them in dom0 under QEMU on arm64, for both GICv2 and
GICv3.
Like qemu-smoke-dom0-arm64.sh, boot Xen and dom0 via U-Boot and
ImageBuilder, and run them with automation/scripts/run-tools-tests. The
JUnit output is printed on the console and extracted from the log
afterwards, as there is no network access to the guest to get it.
Signed-off-by: Julian Vetter <julian.vetter@xxxxxxxxxx>
---
automation/gitlab-ci/test.yaml | 23 ++++
automation/scripts/qemu-tools-tests-arm64.sh | 105 +++++++++++++++++++
2 files changed, 128 insertions(+)
create mode 100755 automation/scripts/qemu-tools-tests-arm64.sh
diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 96127995d7..f6110f764e 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -581,6 +581,29 @@ qemu-smoke-dom0-arm64-gcc-debug:
- *arm64-test-needs
- alpine-3.24-arm64-gcc-debug
+.qemu-tools-tests-arm64:
+ extends: .qemu-arm64
+ artifacts:
+ paths:
+ - tools-tests.serial
+ - '*.log'
+ - tests-junit.xml
+ reports:
+ junit: tests-junit.xml
+ needs:
+ - *arm64-test-needs
+ - alpine-3.24-arm64-gcc-debug
+
+qemu-tools-tests-arm64-gcc-debug-gicv2:
+ extends: .qemu-tools-tests-arm64
+ script:
+ - ./automation/scripts/qemu-tools-tests-arm64.sh gicv2 2>&1 | tee
${LOGFILE}
+
+qemu-tools-tests-arm64-gcc-debug-gicv3:
+ extends: .qemu-tools-tests-arm64
+ script:
+ - ./automation/scripts/qemu-tools-tests-arm64.sh gicv3 2>&1 | tee
${LOGFILE}
+
qemu-smoke-dom0less-arm64-gcc:
extends: .qemu-arm64
script:
diff --git a/automation/scripts/qemu-tools-tests-arm64.sh
b/automation/scripts/qemu-tools-tests-arm64.sh
new file mode 100755
index 0000000000..0d82c0055a
--- /dev/null
+++ b/automation/scripts/qemu-tools-tests-arm64.sh
@@ -0,0 +1,105 @@
+#!/bin/bash
+
+# Run the tests from tools/tests/* in dom0, under QEMU.
+#
+# Usage: qemu-tools-tests-arm64.sh gicv2|gicv3
+
+set -ex -o pipefail
+
+test_variant=$1
+
+case "${test_variant}" in
+ gicv2) gic_version=2 ;;
+ gicv3) gic_version=3 ;;
+ *)
+ echo "Unrecognised test_variant '${test_variant}'" >&2
+ exit 1
+ ;;
+esac
+
+passed="tools tests passed"
+failed="tools tests failed"
+
+# Dom0 rootfs
+cd binaries
+cp rootfs.cpio.gz dom0-rootfs.cpio.gz
+cat xen-tools.cpio.gz >> dom0-rootfs.cpio.gz
+
+# test-local configuration
+mkdir -p rootfs
+cd rootfs
+mkdir -p etc/local.d root
+cp -a ../../automation/scripts/run-tools-tests root/
+echo "#!/bin/bash
+
+bash /etc/init.d/xencommons start
+
+if /root/run-tools-tests /usr/lib/xen/tests /tmp/tests-junit.xml; then
+ result=\"${passed}\"
+else
+ result=\"${failed}\"
+fi
+
+echo '@@@ JUNIT BEGIN'
+cat /tmp/tests-junit.xml
+echo '@@@ JUNIT END'
+echo \"\${result}\"
+" > etc/local.d/xen.start
+chmod +x etc/local.d/xen.start
+find . | cpio -R 0:0 -H newc -o | gzip >> ../dom0-rootfs.cpio.gz
+cd ../..
+
+qemu-system-aarch64 \
+ -machine virtualization=true \
+ -cpu cortex-a57 -machine type=virt,gic-version=${gic_version} \
+ -m 2048 -smp 2 -display none \
+ -machine dumpdtb=binaries/virt.dtb
+
+# XXX disable pl061 to avoid Linux crash
+fdtput binaries/virt.dtb -p -t s /pl061@9030000 status disabled
+
+# ImageBuilder
+echo 'MEMORY_START="0x40000000"
+MEMORY_END="0xC0000000"
+
+DEVICE_TREE="virt.dtb"
+XEN="xen"
+DOM0_KERNEL="Image"
+DOM0_RAMDISK="dom0-rootfs.cpio.gz"
+XEN_CMD="console=dtuart dom0_mem=1024M console_timestamps=boot"
+
+NUM_DOMUS=0
+
+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 tools-tests.serial
+export TEST_CMD="qemu-system-aarch64 \
+ -machine virtualization=true \
+ -cpu cortex-a57 -machine type=virt,gic-version=${gic_version} \
+ -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="tools-tests.serial"
+export PASSED="${passed}|${failed}"
+
+./automation/scripts/console.exp |& sed 's/\r\+$//'
+
+# Extract the JUnit report from the console, dropping any interleaved Xen
+# messages.
+sed -e 's/\r\+$//' -e '1,/^@@@ JUNIT BEGIN$/d' -e '/^@@@ JUNIT END$/,$d' \
+ tools-tests.serial | grep -v '^(XEN)' > tests-junit.xml
+
+grep -q "^${passed}$" <(sed 's/\r\+$//' tools-tests.serial)
--
2.53.0
--
Julian Vetter | Vates Hypervisor & Kernel Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |