]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuxml2(xml|argv)test: Test real state of things with 'x86-kvm-32-on-64'
authorPeter Krempa <pkrempa@redhat.com>
Wed, 5 Jan 2022 21:19:40 +0000 (22:19 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 7 Jan 2022 08:25:14 +0000 (09:25 +0100)
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>
tests/qemuxml2argvdata/x86-kvm-32-on-64.x86_64-4.1.0.args [moved from tests/qemuxml2argvdata/x86-kvm-32-on-64.args with 75% similarity]
tests/qemuxml2argvdata/x86-kvm-32-on-64.x86_64-latest.args [new file with mode: 0644]
tests/qemuxml2argvtest.c
tests/qemuxml2xmloutdata/x86-kvm-32-on-64.x86_64-4.1.0.xml [new file with mode: 0644]
tests/qemuxml2xmloutdata/x86-kvm-32-on-64.x86_64-latest.xml [new file with mode: 0644]
tests/qemuxml2xmltest.c

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 fdfd50649562538a9634af2e2aa64bbbe0b6d0cf..8e9012e7a85cc8ed20210acf6b926879d8e9275a 100644 (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
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 (file)
index 0000000..fe326b6
--- /dev/null
@@ -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
index b5bd1542cd028ce89c7dcfd2358651d204ba88bf..2064a45cf3a1ad54b5ab764c45c5a61f59394778 100644 (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");
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 (file)
index 0000000..934ec8e
--- /dev/null
@@ -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>
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 (file)
index 0000000..b51fb18
--- /dev/null
@@ -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>
index 4ea1ee5e0f6480bc2d13bccafe036016d286549e..fb438269b94f132a9aa414358b75920af60ca7b6 100644 (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");