From 239a6f695490a9fdb483dc3055ba8afed5712ed9 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Wed, 5 Jan 2022 22:19:40 +0100 Subject: [PATCH] qemuxml2(xml|argv)test: Test real state of things with 'x86-kvm-32-on-64' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As demonstrated by the qemuxml2xmltest DO_TEST_CAPS_LATEST data based on the 'x86-kvm-32-on-64' test case the post parse CPU selection code which fills in the CPU into the definition does not have exactly the same logic as we used to have when the cpu model was picked when formatting the commandline. Change the qemuxml2argv test to use DO_TEST_CAPS_LATEST too as it doesn't really make sense to test this on fake data. In addition to 'latest' versions, this also adds second invocation locked to qemu-4.1.0 which demonstrates the old behaviour. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- ...rgs => x86-kvm-32-on-64.x86_64-4.1.0.args} | 7 ++-- .../x86-kvm-32-on-64.x86_64-latest.args | 32 +++++++++++++++++++ tests/qemuxml2argvtest.c | 3 +- .../x86-kvm-32-on-64.x86_64-4.1.0.xml | 24 ++++++++++++++ .../x86-kvm-32-on-64.x86_64-latest.xml | 27 ++++++++++++++++ tests/qemuxml2xmltest.c | 3 ++ 6 files changed, 92 insertions(+), 4 deletions(-) rename tests/qemuxml2argvdata/{x86-kvm-32-on-64.args => x86-kvm-32-on-64.x86_64-4.1.0.args} (75%) create mode 100644 tests/qemuxml2argvdata/x86-kvm-32-on-64.x86_64-latest.args create mode 100644 tests/qemuxml2xmloutdata/x86-kvm-32-on-64.x86_64-4.1.0.xml create mode 100644 tests/qemuxml2xmloutdata/x86-kvm-32-on-64.x86_64-latest.xml diff --git a/tests/qemuxml2argvdata/x86-kvm-32-on-64.args b/tests/qemuxml2argvdata/x86-kvm-32-on-64.x86_64-4.1.0.args similarity index 75% rename from tests/qemuxml2argvdata/x86-kvm-32-on-64.args rename to tests/qemuxml2argvdata/x86-kvm-32-on-64.x86_64-4.1.0.args index fdfd506495..8e9012e7a8 100644 --- a/tests/qemuxml2argvdata/x86-kvm-32-on-64.args +++ b/tests/qemuxml2argvdata/x86-kvm-32-on-64.x86_64-4.1.0.args @@ -11,20 +11,21 @@ QEMU_AUDIO_DRV=none \ -name guest=kvm,debug-threads=on \ -S \ -object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-kvm/master-key.aes \ --machine pc,usb=off,dump-guest-core=off \ +-machine pc-i440fx-4.1,usb=off,dump-guest-core=off \ -accel kvm \ -cpu qemu32 \ -m 4096 \ --realtime mlock=off \ +-overcommit mem-lock=off \ -smp 1,sockets=1,cores=1,threads=1 \ -uuid d091ea82-29e6-2e34-3005-f02617b36e87 \ -display none \ -no-user-config \ -nodefaults \ --chardev socket,id=charmonitor,path=/tmp/lib/domain--1-kvm/monitor.sock,server=on,wait=off \ +-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ -mon chardev=charmonitor,id=monitor,mode=control \ -rtc base=utc \ -no-shutdown \ -no-acpi \ -boot strict=on \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/x86-kvm-32-on-64.x86_64-latest.args b/tests/qemuxml2argvdata/x86-kvm-32-on-64.x86_64-latest.args new file mode 100644 index 0000000000..fe326b6943 --- /dev/null +++ b/tests/qemuxml2argvdata/x86-kvm-32-on-64.x86_64-latest.args @@ -0,0 +1,32 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/tmp/lib/domain--1-kvm \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/tmp/lib/domain--1-kvm/.local/share \ +XDG_CACHE_HOME=/tmp/lib/domain--1-kvm/.cache \ +XDG_CONFIG_HOME=/tmp/lib/domain--1-kvm/.config \ +/usr/bin/qemu-system-x86_64 \ +-name guest=kvm,debug-threads=on \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-kvm/master-key.aes"}' \ +-machine pc-i440fx-6.2,usb=off,dump-guest-core=off,memory-backend=pc.ram \ +-accel kvm \ +-cpu qemu64 \ +-m 4096 \ +-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":4294967296}' \ +-overcommit mem-lock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid d091ea82-29e6-2e34-3005-f02617b36e87 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-boot strict=on \ +-audiodev '{"id":"audio1","driver":"none"}' \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ +-msg timestamp=on diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index b5bd1542cd..2064a45cf3 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1127,7 +1127,8 @@ mymain(void) QEMU_CAPS_MACHINE_VMPORT_OPT); DO_TEST_NOCAPS("default-kvm-host-arch"); DO_TEST_NOCAPS("default-qemu-host-arch"); - DO_TEST_NOCAPS("x86-kvm-32-on-64"); + DO_TEST_CAPS_VER("x86-kvm-32-on-64", "4.1.0"); + DO_TEST_CAPS_LATEST("x86-kvm-32-on-64"); DO_TEST_NOCAPS("boot-cdrom"); DO_TEST_NOCAPS("boot-network"); DO_TEST_NOCAPS("boot-floppy"); diff --git a/tests/qemuxml2xmloutdata/x86-kvm-32-on-64.x86_64-4.1.0.xml b/tests/qemuxml2xmloutdata/x86-kvm-32-on-64.x86_64-4.1.0.xml new file mode 100644 index 0000000000..934ec8ef07 --- /dev/null +++ b/tests/qemuxml2xmloutdata/x86-kvm-32-on-64.x86_64-4.1.0.xml @@ -0,0 +1,24 @@ + + kvm + d091ea82-29e6-2e34-3005-f02617b36e87 + 4194304 + 4194304 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + + + + diff --git a/tests/qemuxml2xmloutdata/x86-kvm-32-on-64.x86_64-latest.xml b/tests/qemuxml2xmloutdata/x86-kvm-32-on-64.x86_64-latest.xml new file mode 100644 index 0000000000..b51fb18788 --- /dev/null +++ b/tests/qemuxml2xmloutdata/x86-kvm-32-on-64.x86_64-latest.xml @@ -0,0 +1,27 @@ + + kvm + d091ea82-29e6-2e34-3005-f02617b36e87 + 4194304 + 4194304 + 1 + + hvm + + + + qemu64 + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + + + + diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 4ea1ee5e0f..fb438269b9 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1332,6 +1332,9 @@ mymain(void) DO_TEST("riscv64-virt-pci", QEMU_CAPS_OBJECT_GPEX); + DO_TEST_CAPS_VER("x86-kvm-32-on-64", "4.1.0"); + DO_TEST_CAPS_LATEST("x86-kvm-32-on-64"); + DO_TEST_CAPS_LATEST("virtio-transitional"); DO_TEST_CAPS_LATEST("virtio-non-transitional");