diff mbox series

[kvm-unit-tests,2/2] riscv: Introduce MACHINE_OVERRIDE

Message ID 20250221162753.126290-6-andrew.jones@linux.dev (mailing list archive)
State New
Headers show
Series riscv: Run with other QEMU models | expand

Commit Message

Andrew Jones Feb. 21, 2025, 4:27 p.m. UTC
From: Andrew Jones <ajones@ventanamicro.com>

Allow riscv tests to use QEMU machine types other than virt.

Signed-off-by: Andrew Jones <ajones@ventanamicro.com>
---
 riscv/run | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/riscv/run b/riscv/run
index 73f2bf54dc32..e2f5a922728c 100755
--- a/riscv/run
+++ b/riscv/run
@@ -10,10 +10,12 @@  if [ -z "$KUT_STANDALONE" ]; then
 fi
 
 # Allow user overrides of some config.mak variables
+mach=$MACHINE_OVERRIDE
 processor=$PROCESSOR_OVERRIDE
 firmware=$FIRMWARE_OVERRIDE
 
 [ "$PROCESSOR" = "$ARCH" ] && PROCESSOR="max"
+: "${mach:=virt}"
 : "${processor:=$PROCESSOR}"
 : "${firmware:=$FIRMWARE}"
 [ "$firmware" ] && firmware="-bios $firmware"
@@ -23,11 +25,11 @@  set_qemu_accelerator || exit $?
 acc="-accel $ACCEL$ACCEL_PROPS"
 
 qemu=$(search_qemu_binary) || exit $?
-if ! $qemu -machine '?' | grep -q 'RISC-V VirtIO board'; then
+if [ "$mach" = 'virt' ] && ! $qemu -machine '?' | grep -q 'RISC-V VirtIO board'; then
 	echo "$qemu doesn't support mach-virt ('-machine virt'). Exiting."
 	exit 2
 fi
-mach='-machine virt'
+mach="-machine $mach"
 
 command="$qemu -nodefaults -nographic -serial mon:stdio"
 command+=" $mach $acc $firmware -cpu $processor "