[PATCH 13/24] qemuxml2(argv|xml)test: Sanitize testing of default video type on x86_64

Peter Krempa pkrempa at redhat.com
Thu Aug 17 11:41:33 UTC 2023


Use real capabilities and remove the redundant test case.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 .../default-video-type-x86_64-caps-test-0.err |  1 -
 .../default-video-type-x86_64-caps-test-1.xml | 16 ----------
 ...fault-video-type-x86_64.x86_64-latest.args | 32 +++++++++++++++++++
 ...st-0.xml => default-video-type-x86_64.xml} |  0
 tests/qemuxml2argvtest.c                      |  2 +-
 .../default-video-type-x86_64-caps-test-0.xml | 31 ------------------
 ...fault-video-type-x86_64.x86_64-latest.xml} |  3 ++
 tests/qemuxml2xmltest.c                       |  7 +---
 8 files changed, 37 insertions(+), 55 deletions(-)
 delete mode 100644 tests/qemuxml2argvdata/default-video-type-x86_64-caps-test-0.err
 delete mode 100644 tests/qemuxml2argvdata/default-video-type-x86_64-caps-test-1.xml
 create mode 100644 tests/qemuxml2argvdata/default-video-type-x86_64.x86_64-latest.args
 rename tests/qemuxml2argvdata/{default-video-type-x86_64-caps-test-0.xml => default-video-type-x86_64.xml} (100%)
 delete mode 100644 tests/qemuxml2xmloutdata/default-video-type-x86_64-caps-test-0.xml
 rename tests/qemuxml2xmloutdata/{default-video-type-x86_64-caps-test-1.xml => default-video-type-x86_64.x86_64-latest.xml} (91%)

diff --git a/tests/qemuxml2argvdata/default-video-type-x86_64-caps-test-0.err b/tests/qemuxml2argvdata/default-video-type-x86_64-caps-test-0.err
deleted file mode 100644
index 28ffb0c7a2..0000000000
--- a/tests/qemuxml2argvdata/default-video-type-x86_64-caps-test-0.err
+++ /dev/null
@@ -1 +0,0 @@
-internal error: missing video model and cannot determine default
diff --git a/tests/qemuxml2argvdata/default-video-type-x86_64-caps-test-1.xml b/tests/qemuxml2argvdata/default-video-type-x86_64-caps-test-1.xml
deleted file mode 100644
index 2142db8d1f..0000000000
--- a/tests/qemuxml2argvdata/default-video-type-x86_64-caps-test-1.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<domain type='kvm'>
-  <name>default-video-type-x86_64-test</name>
-  <uuid>6ba410c5-1e5c-4d57-bee7-2228e7ffa32f</uuid>
-  <memory unit='KiB'>1048576</memory>
-  <vcpu placement='static'>1</vcpu>
-  <os>
-    <type arch='x86_64' machine='pc'>hvm</type>
-  </os>
-  <devices>
-    <emulator>/usr/bin/qemu-system-x86_64</emulator>
-    <controller type='usb' index='0' model='none'/>
-    <controller type='pci' index='0' model='pci-root'/>
-    <memballoon model='none'/>
-    <graphics type='spice'/>
-  </devices>
-</domain>
diff --git a/tests/qemuxml2argvdata/default-video-type-x86_64.x86_64-latest.args b/tests/qemuxml2argvdata/default-video-type-x86_64.x86_64-latest.args
new file mode 100644
index 0000000000..247927f7bb
--- /dev/null
+++ b/tests/qemuxml2argvdata/default-video-type-x86_64.x86_64-latest.args
@@ -0,0 +1,32 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/var/lib/libvirt/qemu/domain--1-default-video-type-x \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-default-video-type-x/.local/share \
+XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-default-video-type-x/.cache \
+XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-default-video-type-x/.config \
+/usr/bin/qemu-system-x86_64 \
+-name guest=default-video-type-x86_64-test,debug-threads=on \
+-S \
+-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-default-video-type-x/master-key.aes"}' \
+-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram,acpi=off \
+-accel kvm \
+-cpu qemu64 \
+-m size=1048576k \
+-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":1073741824}' \
+-overcommit mem-lock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid 6ba410c5-1e5c-4d57-bee7-2228e7ffa32f \
+-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 \
+-boot strict=on \
+-audiodev '{"id":"audio1","driver":"spice"}' \
+-spice port=0,seamless-migration=on \
+-device '{"driver":"cirrus-vga","id":"video0","bus":"pci.0","addr":"0x2"}' \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/default-video-type-x86_64-caps-test-0.xml b/tests/qemuxml2argvdata/default-video-type-x86_64.xml
similarity index 100%
rename from tests/qemuxml2argvdata/default-video-type-x86_64-caps-test-0.xml
rename to tests/qemuxml2argvdata/default-video-type-x86_64.xml
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 19ca1c0177..f1f86645f9 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2025,7 +2025,7 @@ mymain(void)
     DO_TEST("video-none-device",
             QEMU_CAPS_VNC);
     DO_TEST_PARSE_ERROR_NOCAPS("video-invalid-multiple-devices");
-    DO_TEST_PARSE_ERROR_NOCAPS("default-video-type-x86_64-caps-test-0");
+    DO_TEST_CAPS_LATEST("default-video-type-x86_64");

     DO_TEST_CAPS_ARCH_LATEST("default-video-type-aarch64", "aarch64");
     DO_TEST_CAPS_ARCH_LATEST("default-video-type-ppc64", "ppc64");
diff --git a/tests/qemuxml2xmloutdata/default-video-type-x86_64-caps-test-0.xml b/tests/qemuxml2xmloutdata/default-video-type-x86_64-caps-test-0.xml
deleted file mode 100644
index 596364f7a2..0000000000
--- a/tests/qemuxml2xmloutdata/default-video-type-x86_64-caps-test-0.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<domain type='kvm'>
-  <name>default-video-type-x86_64-test</name>
-  <uuid>6ba410c5-1e5c-4d57-bee7-2228e7ffa32f</uuid>
-  <memory unit='KiB'>1048576</memory>
-  <currentMemory unit='KiB'>1048576</currentMemory>
-  <vcpu placement='static'>1</vcpu>
-  <os>
-    <type arch='x86_64' machine='pc'>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'/>
-    <graphics type='spice'>
-      <listen type='none'/>
-    </graphics>
-    <audio id='1' type='spice'/>
-    <video>
-      <model type='vga' vram='16384' heads='1' primary='yes'/>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
-    </video>
-    <memballoon model='none'/>
-  </devices>
-</domain>
diff --git a/tests/qemuxml2xmloutdata/default-video-type-x86_64-caps-test-1.xml b/tests/qemuxml2xmloutdata/default-video-type-x86_64.x86_64-latest.xml
similarity index 91%
rename from tests/qemuxml2xmloutdata/default-video-type-x86_64-caps-test-1.xml
rename to tests/qemuxml2xmloutdata/default-video-type-x86_64.x86_64-latest.xml
index a86f785b44..b9b50bae84 100644
--- a/tests/qemuxml2xmloutdata/default-video-type-x86_64-caps-test-1.xml
+++ b/tests/qemuxml2xmloutdata/default-video-type-x86_64.x86_64-latest.xml
@@ -8,6 +8,9 @@
     <type arch='x86_64' machine='pc'>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>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 9063d3c593..20347f33a5 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -375,12 +375,7 @@ mymain(void)
     DO_TEST_CAPS_ARCH_LATEST("default-video-type-ppc64", "ppc64");
     DO_TEST_CAPS_ARCH_LATEST("default-video-type-riscv64", "riscv64");
     DO_TEST_CAPS_ARCH_LATEST("default-video-type-s390x", "s390x");
-    DO_TEST("default-video-type-x86_64-caps-test-0",
-            QEMU_CAPS_DEVICE_VGA,
-            QEMU_CAPS_SPICE);
-    DO_TEST("default-video-type-x86_64-caps-test-1",
-            QEMU_CAPS_DEVICE_CIRRUS_VGA,
-            QEMU_CAPS_SPICE);
+    DO_TEST_CAPS_LATEST("default-video-type-x86_64");

     DO_TEST("graphics-sdl", QEMU_CAPS_DEVICE_VGA, QEMU_CAPS_SDL);
     DO_TEST("graphics-sdl-fullscreen", QEMU_CAPS_DEVICE_CIRRUS_VGA, QEMU_CAPS_SDL);
-- 
2.41.0



More information about the libvir-list mailing list