qemuxml2(xml|argv)test: Test real state of things with 'x86-kvm-32-on-64'

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 <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2022-01-05 22:19:40 +01:00
parent 42d9807350
commit 239a6f6954
6 changed files with 92 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -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");

View File

@ -0,0 +1,24 @@
<domain type='kvm'>
<name>kvm</name>
<uuid>d091ea82-29e6-2e34-3005-f02617b36e87</uuid>
<memory unit='KiB'>4194304</memory>
<currentMemory unit='KiB'>4194304</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='i686' machine='pc-i440fx-4.1'>hvm</type>
<boot dev='hd'/>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<controller type='usb' index='0' model='none'/>
<controller type='pci' index='0' model='pci-root'/>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<audio id='1' type='none'/>
<memballoon model='none'/>
</devices>
</domain>

View File

@ -0,0 +1,27 @@
<domain type='kvm'>
<name>kvm</name>
<uuid>d091ea82-29e6-2e34-3005-f02617b36e87</uuid>
<memory unit='KiB'>4194304</memory>
<currentMemory unit='KiB'>4194304</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='i686' machine='pc-i440fx-6.2'>hvm</type>
<boot dev='hd'/>
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
</cpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<controller type='usb' index='0' model='none'/>
<controller type='pci' index='0' model='pci-root'/>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<audio id='1' type='none'/>
<memballoon model='none'/>
</devices>
</domain>

View File

@ -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");