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. Signed-off-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx> --- ...eries-cpu-compat-power9.ppc64-latest.args} | 12 ++++++---- ...series-cpu-compat-power9.ppc64-latest.err} | 0 tests/qemuxml2argvtest.c | 23 +++++++++++-------- 3 files changed, 20 insertions(+), 15 deletions(-) rename tests/qemuxml2argvdata/{pseries-cpu-compat-power9.args => pseries-cpu-compat-power9.ppc64-latest.args} (60%) rename tests/qemuxml2argvdata/{pseries-cpu-compat-power9.err => pseries-cpu-compat-power9.ppc64-latest.err} (100%) diff --git a/tests/qemuxml2argvdata/pseries-cpu-compat-power9.args b/tests/qemuxml2argvdata/pseries-cpu-compat-power9.ppc64-latest.args similarity index 60% rename from tests/qemuxml2argvdata/pseries-cpu-compat-power9.args rename to tests/qemuxml2argvdata/pseries-cpu-compat-power9.ppc64-latest.args index 233e92f206..f458999291 100644 --- a/tests/qemuxml2argvdata/pseries-cpu-compat-power9.args +++ b/tests/qemuxml2argvdata/pseries-cpu-compat-power9.ppc64-latest.args @@ -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 diff --git a/tests/qemuxml2argvdata/pseries-cpu-compat-power9.err b/tests/qemuxml2argvdata/pseries-cpu-compat-power9.ppc64-latest.err similarity index 100% rename from tests/qemuxml2argvdata/pseries-cpu-compat-power9.err rename to tests/qemuxml2argvdata/pseries-cpu-compat-power9.ppc64-latest.err diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 96bc7aadeb..5ae245d254 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -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); -- 2.32.0