[libvirt PATCH 1/3] tests: Update smm=on test

Andrea Bolognani abologna at redhat.com
Fri May 13 14:44:03 UTC 2022


Use DO_TEST_CAPS_LATEST() instead of hardcoding capabilities and
add the xml2xml part, which was missing; finally, rename it to
accomodate the complementary smm=off test that we're about to
introduce.

Signed-off-by: Andrea Bolognani <abologna at redhat.com>
---
 ...args => machine-smm-on.x86_64-latest.args} | 16 ++++++----------
 tests/qemuxml2argvdata/machine-smm-on.xml     | 17 +++++++++++++++++
 tests/qemuxml2argvtest.c                      |  7 +------
 .../machine-smm-on.x86_64-latest.xml}         | 19 ++++++++++++-------
 tests/qemuxml2xmltest.c                       |  1 +
 5 files changed, 37 insertions(+), 23 deletions(-)
 rename tests/qemuxml2argvdata/{machine-smm-opt.args => machine-smm-on.x86_64-latest.args} (52%)
 create mode 100644 tests/qemuxml2argvdata/machine-smm-on.xml
 rename tests/{qemuxml2argvdata/machine-smm-opt.xml => qemuxml2xmloutdata/machine-smm-on.x86_64-latest.xml} (53%)

diff --git a/tests/qemuxml2argvdata/machine-smm-opt.args b/tests/qemuxml2argvdata/machine-smm-on.x86_64-latest.args
similarity index 52%
rename from tests/qemuxml2argvdata/machine-smm-opt.args
rename to tests/qemuxml2argvdata/machine-smm-on.x86_64-latest.args
index 39fb447320..6fde375523 100644
--- a/tests/qemuxml2argvdata/machine-smm-opt.args
+++ b/tests/qemuxml2argvdata/machine-smm-on.x86_64-latest.args
@@ -6,14 +6,15 @@ LOGNAME=test \
 XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \
 XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \
 XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
-QEMU_AUDIO_DRV=none \
 /usr/bin/qemu-system-x86_64 \
 -name guest=QEMUGuest1,debug-threads=on \
 -S \
--object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
--machine q35,usb=off,smm=on,dump-guest-core=off \
+-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-QEMUGuest1/master-key.aes"}' \
+-machine q35,usb=off,smm=on,dump-guest-core=off,memory-backend=pc.ram \
 -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 \
@@ -26,11 +27,6 @@ QEMU_AUDIO_DRV=none \
 -no-shutdown \
 -no-acpi \
 -boot strict=on \
--device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1e \
--device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x0 \
--device ioh3420,port=8,chassis=3,id=pci.3,bus=pcie.0,addr=0x1 \
--device virtio-scsi-pci,id=scsi0,bus=pci.2,addr=0x1 \
--drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-scsi0-0-0-0 \
--device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,bootindex=1 \
--device virtio-balloon-pci,id=balloon0,bus=pci.2,addr=0x2 \
+-audiodev '{"id":"audio1","driver":"none"}' \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/machine-smm-on.xml b/tests/qemuxml2argvdata/machine-smm-on.xml
new file mode 100644
index 0000000000..e24608343a
--- /dev/null
+++ b/tests/qemuxml2argvdata/machine-smm-on.xml
@@ -0,0 +1,17 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='x86_64' machine='q35'>hvm</type>
+  </os>
+  <features>
+    <smm state='on'/>
+  </features>
+  <devices>
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
+    <controller type='usb' model='none'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 829550fbfe..c0c18ef1dc 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1061,12 +1061,7 @@ mymain(void)
     driver.config->dumpGuestCore = true;
     DO_TEST_NOCAPS("machine-core-off");
     driver.config->dumpGuestCore = false;
-    DO_TEST("machine-smm-opt",
-            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
-            QEMU_CAPS_DEVICE_PCI_BRIDGE,
-            QEMU_CAPS_DEVICE_IOH3420,
-            QEMU_CAPS_ICH9_AHCI,
-            QEMU_CAPS_VIRTIO_SCSI);
+    DO_TEST_CAPS_LATEST("machine-smm-on");
     DO_TEST("machine-vmport-opt",
             QEMU_CAPS_MACHINE_VMPORT_OPT);
     DO_TEST_NOCAPS("default-kvm-host-arch");
diff --git a/tests/qemuxml2argvdata/machine-smm-opt.xml b/tests/qemuxml2xmloutdata/machine-smm-on.x86_64-latest.xml
similarity index 53%
rename from tests/qemuxml2argvdata/machine-smm-opt.xml
rename to tests/qemuxml2xmloutdata/machine-smm-on.x86_64-latest.xml
index 053bb5c25f..7c7df9e06d 100644
--- a/tests/qemuxml2argvdata/machine-smm-opt.xml
+++ b/tests/qemuxml2xmloutdata/machine-smm-on.x86_64-latest.xml
@@ -11,18 +11,23 @@
   <features>
     <smm state='on'/>
   </features>
+  <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>
-    <disk type='block' device='disk'>
-      <source dev='/dev/HostVG/QEMUGuest1'/>
-      <target dev='sda' bus='scsi'/>
-      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
-    </disk>
-    <controller type='scsi' index='0'/>
-    <memballoon model='virtio'/>
+    <controller type='usb' index='0' model='none'/>
+    <controller type='sata' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
+    </controller>
+    <controller type='pci' index='0' model='pcie-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/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 8b655874d1..02d8a66f3c 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -243,6 +243,7 @@ mymain(void)
     DO_TEST_CAPS_LATEST("genid-auto");
     DO_TEST_NOCAPS("machine-core-on");
     DO_TEST_NOCAPS("machine-core-off");
+    DO_TEST_CAPS_LATEST("machine-smm-on");
     DO_TEST("machine-loadparm-multiple-disks-nets-s390", QEMU_CAPS_CCW);
     DO_TEST_NOCAPS("default-kvm-host-arch");
     DO_TEST_NOCAPS("default-qemu-host-arch");
-- 
2.35.3



More information about the libvir-list mailing list