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

[PATCH 1/2] automation: Add support for using XTF for arm64 testing


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Thu, 15 Dec 2022 16:25:37 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Y0MT5BBq9QYEYB/tP9cdS7QHAMBvjlEG62WveeU6DQc=; b=aFSDUHef15ztioJL79sfsY0svEhJk/q1GYrQxcTeQof8a7QCHZt1GOXbSsLXyFWUNIJCWhYFJnqVm1/s24lm/EcYq+pbrprKDW9PzNrlwdU+A4JFPc1acoK1jLQmB18gYzkplwIPV1iA320kqqjDdQUIW57Ra9Q8bNb2MW97wION2wC8EEmwvvfoQM/Dgq/wWqLcgFoqtQeY+TULR0GW7/A95NsugEdKyB7VLPWzlkveZZ3fulnb42KYVIGubFpVuJjJrp7mVSqF7En2wUyuAmrvTqD+xJ08gt4ucCwSpkWC2flWXsvbXii3VFY5244n88dqBgZeq1D+b92eLr0vPA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L59GIFICFXtX8v1xb/zrYTvh3drzdvsmiJyhKivPWPZnfxBg5C1mTbDJwVW5V/nBbftolSrkpoJp7GEf5jlhauegiyEJIofWrVLW4u5vU24wvFVv2pJ00F+QfQpvIFOV/r6zEeNO7Xfw9bsQS6ETtNnqcexFJN2smrWVgF1k2JXuXkH25SiRh5TdrpzuBkuFGgwvJqGwHK7ArxeIePD4FGw585mrCcx9HU3JYVlx9JURSIsXafxQJhpdn9CVh3LhI1wdcKQ1Z8O7AdMWBSLpoCjm03vh+F6KnIx6w257L0vTOW+NsgBQgMtbkwvc9+btnIAzd8XSrcQYAQs/2wj3wg==
  • Cc: Michal Orzel <michal.orzel@xxxxxxx>, Doug Goldstein <cardoe@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Delivery-date: Thu, 15 Dec 2022 15:25:55 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Introduce support for using XTF on Arm to perform low-level testing.
For the purpose of the CI testing, let's use the fork [1] from upstream
XTF with implemented support for arm64 (the upstream XTF only supports
x86).

Add a new script under automation/scripts to be used by the CI XTF test
jobs to perform the following tasks:
 - Compiling XTF,
 - Creating dom0 rootfs,
 - Generating u-boot script using ImageBuilder,
 - Running Xen with Linux as dom0 and XTF as a dom0less domU using Qemu,
 - Checking test result.

The script takes the name of the XTF test to run as a first parameter.

[1] https://gitlab.com/xen-project/fusa/xtf.git (branch xtf-arm)

Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
---
 automation/scripts/qemu-xtf-dom0less-arm64.sh | 97 +++++++++++++++++++
 1 file changed, 97 insertions(+)
 create mode 100755 automation/scripts/qemu-xtf-dom0less-arm64.sh

diff --git a/automation/scripts/qemu-xtf-dom0less-arm64.sh 
b/automation/scripts/qemu-xtf-dom0less-arm64.sh
new file mode 100755
index 000000000000..321d1abc543b
--- /dev/null
+++ b/automation/scripts/qemu-xtf-dom0less-arm64.sh
@@ -0,0 +1,97 @@
+#!/bin/bash
+
+set -ex
+
+# 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
+
+# XXX disable pl061 to avoid Linux crash
+fdtput binaries/virt-gicv2.dtb -p -t s /pl061@9030000 status disabled
+
+# 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
+
+# DOM0 rootfs
+mkdir -p rootfs
+cd rootfs
+tar xzf ../binaries/initrd.tar.gz
+mkdir proc
+mkdir run
+mkdir srv
+mkdir sys
+rm var/run
+cp -ar ../binaries/dist/install/* .
+
+echo "#!/bin/bash
+
+export LD_LIBRARY_PATH=/usr/local/lib
+bash /etc/init.d/xencommons start
+
+/usr/local/lib/xen/bin/init-dom0less
+" > etc/local.d/xen.start
+
+chmod +x etc/local.d/xen.start
+echo "rc_verbose=yes" >> etc/rc.conf
+find . | cpio -H newc -o | gzip > ../binaries/dom0-rootfs.cpio.gz
+cd ..
+
+# ImageBuilder
+echo 'MEMORY_START="0x40000000"
+MEMORY_END="0xC0000000"
+
+XEN="xen"
+DEVICE_TREE="virt-gicv2.dtb"
+
+DOM0_KERNEL="Image"
+DOM0_RAMDISK="dom0-rootfs.cpio.gz"
+XEN_CMD="console=dtuart dom0_mem=512M"
+
+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 https://gitlab.com/ViryaOS/imagebuilder
+bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c 
binaries/config
+
+# Run the test
+rm -f smoke.serial
+set +e
+echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
+timeout -k 1 240 \
+./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 |& tee smoke.serial
+
+set -e
+(grep -q "^Welcome to Alpine Linux" smoke.serial && grep -q "${passed}" 
smoke.serial) || exit 1
+exit 0
-- 
2.25.1




 


Rackspace

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