[PATCH 3/5] qemuxml2(argv|xml)test: Modernize 'sound-device' case

Peter Krempa pkrempa at redhat.com
Tue May 9 11:45:44 UTC 2023


Drop the unnecessary disk definition and use x86_64 emulator.

For 'qemuxml2argvtest' replace the fake-caps invocation by a 4.2.0
version-locked invocation and  add a '_CAPS_LATEST' invocation.

For 'qemuxml2xmltest' convert to use '_CAPS_LATEST' only.

There are no sound-device relevant changes in the output files.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 ...ce.args => sound-device.x86_64-4.2.0.args} | 11 ++--
 .../sound-device.x86_64-latest.args           | 50 +++++++++++++++++++
 tests/qemuxml2argvdata/sound-device.xml       | 10 +---
 tests/qemuxml2argvtest.c                      |  7 +--
 ...ice.xml => sound-device.x86_64-latest.xml} | 15 +++---
 tests/qemuxml2xmltest.c                       |  7 +--
 6 files changed, 66 insertions(+), 34 deletions(-)
 rename tests/qemuxml2argvdata/{sound-device.args => sound-device.x86_64-4.2.0.args} (82%)
 create mode 100644 tests/qemuxml2argvdata/sound-device.x86_64-latest.args
 rename tests/qemuxml2xmloutdata/{sound-device.xml => sound-device.x86_64-latest.xml} (83%)

diff --git a/tests/qemuxml2argvdata/sound-device.args b/tests/qemuxml2argvdata/sound-device.x86_64-4.2.0.args
similarity index 82%
rename from tests/qemuxml2argvdata/sound-device.args
rename to tests/qemuxml2argvdata/sound-device.x86_64-4.2.0.args
index 0a9a3e5ddb..121b37ff99 100644
--- a/tests/qemuxml2argvdata/sound-device.args
+++ b/tests/qemuxml2argvdata/sound-device.x86_64-4.2.0.args
@@ -6,12 +6,13 @@ LOGNAME=test \
 XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \
 XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \
 XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-/usr/bin/qemu-system-i386 \
+/usr/bin/qemu-system-x86_64 \
 -name guest=QEMUGuest1,debug-threads=on \
 -S \
 -object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes \
--machine pc,usb=off,dump-guest-core=off \
+-machine pc-i440fx-4.2,usb=off,dump-guest-core=off \
 -accel tcg \
+-cpu qemu64 \
 -m 214 \
 -overcommit mem-lock=off \
 -smp 1,sockets=1,cores=1,threads=1 \
@@ -25,10 +26,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
 -no-shutdown \
 -no-acpi \
 -boot strict=on \
--usb \
--blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
--blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \
--device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1 \
+-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -soundhw pcspk \
 -device ES1370,id=sound1,audiodev=audio1,bus=pci.0,addr=0x2 \
@@ -48,4 +46,5 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
 -device hda-output,id=sound7-codec2,bus=sound7.0,cad=2,audiodev=audio1 \
 -device usb-audio,id=sound8,audiodev=audio1,bus=usb.0,port=1 \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x8 \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/sound-device.x86_64-latest.args b/tests/qemuxml2argvdata/sound-device.x86_64-latest.args
new file mode 100644
index 0000000000..3132760fe0
--- /dev/null
+++ b/tests/qemuxml2argvdata/sound-device.x86_64-latest.args
@@ -0,0 +1,50 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
+/usr/bin/qemu-system-x86_64 \
+-name guest=QEMUGuest1,debug-threads=on \
+-S \
+-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \
+-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram,acpi=off \
+-accel tcg \
+-cpu qemu64 \
+-m 214 \
+-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \
+-overcommit mem-lock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-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 \
+-boot strict=on \
+-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
+-audiodev '{"id":"audio1","driver":"none"}' \
+-soundhw pcspk \
+-device '{"driver":"ES1370","id":"sound1","audiodev":"audio1","bus":"pci.0","addr":"0x2"}' \
+-device '{"driver":"sb16","id":"sound2","audiodev":"audio1"}' \
+-device '{"driver":"AC97","id":"sound3","audiodev":"audio1","bus":"pci.0","addr":"0x3"}' \
+-device '{"driver":"intel-hda","id":"sound4","bus":"pci.0","addr":"0x4"}' \
+-device '{"driver":"hda-duplex","id":"sound4-codec0","bus":"sound4.0","cad":0,"audiodev":"audio1"}' \
+-device '{"driver":"intel-hda","id":"sound5","bus":"pci.0","addr":"0x5"}' \
+-device '{"driver":"hda-micro","id":"sound5-codec0","bus":"sound5.0","cad":0,"audiodev":"audio1"}' \
+-device '{"driver":"hda-duplex","id":"sound5-codec1","bus":"sound5.0","cad":1,"audiodev":"audio1"}' \
+-device '{"driver":"hda-output","id":"sound5-codec2","bus":"sound5.0","cad":2,"audiodev":"audio1"}' \
+-device '{"driver":"ich9-intel-hda","id":"sound6","bus":"pci.0","addr":"0x6"}' \
+-device '{"driver":"hda-duplex","id":"sound6-codec0","bus":"sound6.0","cad":0,"audiodev":"audio1"}' \
+-device '{"driver":"ich9-intel-hda","id":"sound7","bus":"pci.0","addr":"0x7"}' \
+-device '{"driver":"hda-micro","id":"sound7-codec0","bus":"sound7.0","cad":0,"audiodev":"audio1"}' \
+-device '{"driver":"hda-duplex","id":"sound7-codec1","bus":"sound7.0","cad":1,"audiodev":"audio1"}' \
+-device '{"driver":"hda-output","id":"sound7-codec2","bus":"sound7.0","cad":2,"audiodev":"audio1"}' \
+-device '{"driver":"usb-audio","id":"sound8","audiodev":"audio1","bus":"usb.0","port":"1"}' \
+-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x8"}' \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/sound-device.xml b/tests/qemuxml2argvdata/sound-device.xml
index b9427f880a..35a60da197 100644
--- a/tests/qemuxml2argvdata/sound-device.xml
+++ b/tests/qemuxml2argvdata/sound-device.xml
@@ -5,20 +5,14 @@
   <currentMemory unit='KiB'>219100</currentMemory>
   <vcpu placement='static'>1</vcpu>
   <os>
-    <type arch='i686' machine='pc'>hvm</type>
-    <boot dev='hd'/>
+    <type arch='x86_64' machine='pc'>hvm</type>
   </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-i386</emulator>
-    <disk type='block' device='disk'>
-      <source dev='/dev/HostVG/QEMUGuest1'/>
-      <target dev='hda' bus='ide'/>
-      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
-    </disk>
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
     <controller type='usb' index='0'/>
     <controller type='ide' index='0'/>
     <controller type='pci' index='0' model='pci-root'/>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 755e8fd664..3100078b54 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1691,11 +1691,8 @@ mymain(void)
             QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE);
     DO_TEST_NOCAPS("balloon-device-auto");
     DO_TEST_NOCAPS("balloon-device-period");
-    DO_TEST("sound-device",
-            QEMU_CAPS_HDA_DUPLEX, QEMU_CAPS_HDA_MICRO,
-            QEMU_CAPS_HDA_OUTPUT,
-            QEMU_CAPS_DEVICE_ICH9_INTEL_HDA,
-            QEMU_CAPS_OBJECT_USB_AUDIO);
+    DO_TEST_CAPS_VER("sound-device", "4.2.0");
+    DO_TEST_CAPS_LATEST("sound-device");
     DO_TEST_CAPS_LATEST("fs9p");
     DO_TEST_CAPS_ARCH_LATEST("fs9p-ccw", "s390x");

diff --git a/tests/qemuxml2xmloutdata/sound-device.xml b/tests/qemuxml2xmloutdata/sound-device.x86_64-latest.xml
similarity index 83%
rename from tests/qemuxml2xmloutdata/sound-device.xml
rename to tests/qemuxml2xmloutdata/sound-device.x86_64-latest.xml
index 87d9a5524c..89f537bb01 100644
--- a/tests/qemuxml2xmloutdata/sound-device.xml
+++ b/tests/qemuxml2xmloutdata/sound-device.x86_64-latest.xml
@@ -5,22 +5,19 @@
   <currentMemory unit='KiB'>219100</currentMemory>
   <vcpu placement='static'>1</vcpu>
   <os>
-    <type arch='i686' machine='pc'>hvm</type>
+    <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>
   <on_crash>destroy</on_crash>
   <devices>
-    <emulator>/usr/bin/qemu-system-i386</emulator>
-    <disk type='block' device='disk'>
-      <driver name='qemu' type='raw'/>
-      <source dev='/dev/HostVG/QEMUGuest1'/>
-      <target dev='hda' bus='ide'/>
-      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
-    </disk>
-    <controller type='usb' index='0'>
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
+    <controller type='usb' index='0' model='piix3-uhci'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
     </controller>
     <controller type='ide' index='0'>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 8e9da95efb..93202e8e18 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -449,12 +449,7 @@ mymain(void)
     DO_TEST("net-hostdev-vfio", QEMU_CAPS_DEVICE_VFIO_PCI);
     DO_TEST_NOCAPS("net-midonet");
     DO_TEST_NOCAPS("net-openvswitch");
-    DO_TEST("sound-device",
-            QEMU_CAPS_DEVICE_ICH9_INTEL_HDA,
-            QEMU_CAPS_OBJECT_USB_AUDIO,
-            QEMU_CAPS_HDA_MICRO,
-            QEMU_CAPS_HDA_DUPLEX,
-            QEMU_CAPS_HDA_OUTPUT);
+    DO_TEST_CAPS_LATEST("sound-device");
     DO_TEST_NOCAPS("watchdog");
     DO_TEST_CAPS_LATEST("watchdog-q35-multiple");
     DO_TEST("net-bandwidth", QEMU_CAPS_DEVICE_VGA, QEMU_CAPS_VNC);
-- 
2.40.0



More information about the libvir-list mailing list