qemuxml2argvtest.c: use CAPS_ARCH_LATEST() with pseries-cpu-compat-power9

Use the newly added ARG_CAPS_HOST_CPU_MODEL to set which host CPU we
expect the test to use - the test should fail when using a POWER8 host
cpu but complete when using a POWER9 host cpu.

Two new macros were added because we will be adding similar tests in the
near future when adding support for the Power10 chip.

Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
Daniel Henrique Barboza 2022-05-20 15:15:18 -03:00
parent a678430492
commit a46ff97762
3 changed files with 20 additions and 15 deletions

View File

@ -6,15 +6,15 @@ LOGNAME=test \
XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \
XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \
XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
QEMU_AUDIO_DRV=none \
/usr/bin/qemu-system-ppc64 \
-name guest=QEMUGuest1,debug-threads=on \
-S \
-object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
-machine pseries,usb=off,dump-guest-core=off,max-cpu-compat=power9 \
-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-QEMUGuest1/master-key.aes"}' \
-machine pseries,usb=off,dump-guest-core=off,max-cpu-compat=power9,memory-backend=ppc_spapr.ram \
-accel kvm \
-cpu host \
-m 256 \
-object '{"qom-type":"memory-backend-ram","id":"ppc_spapr.ram","size":268435456}' \
-overcommit mem-lock=off \
-smp 4,sockets=4,cores=1,threads=1 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
@ -26,7 +26,9 @@ QEMU_AUDIO_DRV=none \
-rtc base=utc \
-no-shutdown \
-boot strict=on \
-usb \
-device '{"driver":"pci-ohci","id":"usb","bus":"pci.0","addr":"0x1"}' \
-chardev pty,id=charserial0 \
-device spapr-vty,chardev=charserial0,id=serial0,reg=805306368 \
-device '{"driver":"spapr-vty","chardev":"charserial0","id":"serial0","reg":805306368}' \
-audiodev '{"id":"audio1","driver":"none"}' \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
-msg timestamp=on

View File

@ -980,6 +980,15 @@ mymain(void)
# define DO_TEST_CAPS_LATEST_PPC64(name) \
DO_TEST_CAPS_ARCH_LATEST(name, "ppc64")
# define DO_TEST_CAPS_LATEST_PPC64_HOSTCPU(name, hostcpu) \
DO_TEST_CAPS_ARCH_LATEST_FULL(name, "ppc64", \
ARG_CAPS_HOST_CPU_MODEL, hostcpu)
# define DO_TEST_CAPS_LATEST_PPC64_HOSTCPU_FAILURE(name, hostcpu) \
DO_TEST_CAPS_ARCH_LATEST_FULL(name, "ppc64", \
ARG_CAPS_HOST_CPU_MODEL, hostcpu, \
ARG_FLAGS, FLAG_EXPECT_FAILURE)
# define DO_TEST_CAPS_ARCH_LATEST_FAILURE(name, arch) \
DO_TEST_CAPS_ARCH_LATEST_FULL(name, arch, \
ARG_FLAGS, FLAG_EXPECT_FAILURE)
@ -2226,16 +2235,10 @@ mymain(void)
DO_TEST("pseries-cpu-le", QEMU_CAPS_KVM,
QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
QEMU_CAPS_DEVICE_SPAPR_VTY);
DO_TEST_FAILURE("pseries-cpu-compat-power9",
QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
QEMU_CAPS_KVM);
qemuTestSetHostCPU(&driver, driver.hostarch, qemuTestGetCPUDef(QEMU_CPU_DEF_POWER9));
DO_TEST("pseries-cpu-compat-power9",
QEMU_CAPS_KVM,
QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
QEMU_CAPS_DEVICE_SPAPR_VTY);
qemuTestSetHostCPU(&driver, driver.hostarch, NULL);
DO_TEST_CAPS_LATEST_PPC64_HOSTCPU_FAILURE("pseries-cpu-compat-power9",
QEMU_CPU_DEF_POWER8);
DO_TEST_CAPS_LATEST_PPC64_HOSTCPU("pseries-cpu-compat-power9",
QEMU_CPU_DEF_POWER9);
qemuTestSetHostArch(&driver, VIR_ARCH_NONE);