[PATCH 12/31] tests: Add coverage for PCI use with isapc

Andrea Bolognani via Devel posted 31 patches 2 weeks, 5 days ago
[PATCH 12/31] tests: Add coverage for PCI use with isapc
Posted by Andrea Bolognani via Devel 2 weeks, 5 days ago
The isapc machine type doesn't support PCI, so attempting to
add a PCI controller should fail. It currently doesn't, and
we're going to address that in an upcoming commit.

Note that the domain gets a PCI memballoon device added
automatically. That also shouldn't happen, and will similarly
be fixed.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
 .../isapc-pci.x86_64-latest.args              | 32 +++++++++++++++++++
 .../isapc-pci.x86_64-latest.xml               | 28 ++++++++++++++++
 tests/qemuxmlconfdata/isapc-pci.xml           | 13 ++++++++
 tests/qemuxmlconftest.c                       |  2 ++
 4 files changed, 75 insertions(+)
 create mode 100644 tests/qemuxmlconfdata/isapc-pci.x86_64-latest.args
 create mode 100644 tests/qemuxmlconfdata/isapc-pci.x86_64-latest.xml
 create mode 100644 tests/qemuxmlconfdata/isapc-pci.xml

diff --git a/tests/qemuxmlconfdata/isapc-pci.x86_64-latest.args b/tests/qemuxmlconfdata/isapc-pci.x86_64-latest.args
new file mode 100644
index 0000000000..f1d443a0cc
--- /dev/null
+++ b/tests/qemuxmlconfdata/isapc-pci.x86_64-latest.args
@@ -0,0 +1,32 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/var/lib/libvirt/qemu/domain--1-test \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-test/.local/share \
+XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-test/.cache \
+XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-test/.config \
+/usr/bin/qemu-system-x86_64 \
+-name guest=test,debug-threads=on \
+-S \
+-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-test/master-key.aes"}' \
+-machine isapc,usb=off,dump-guest-core=off,memory-backend=pc.ram,acpi=off \
+-accel tcg \
+-cpu 486 \
+-m size=2097152k \
+-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":2147483648}' \
+-overcommit mem-lock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid 11dbdcdd-4c3b-482b-8903-9bdb8c0a2774 \
+-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 \
+-audiodev '{"id":"audio1","driver":"none"}' \
+-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x1"}' \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxmlconfdata/isapc-pci.x86_64-latest.xml b/tests/qemuxmlconfdata/isapc-pci.x86_64-latest.xml
new file mode 100644
index 0000000000..d4c04045dc
--- /dev/null
+++ b/tests/qemuxmlconfdata/isapc-pci.x86_64-latest.xml
@@ -0,0 +1,28 @@
+<domain type='qemu'>
+  <name>test</name>
+  <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
+  <memory unit='KiB'>2097152</memory>
+  <currentMemory unit='KiB'>2097152</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='x86_64' machine='isapc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <cpu mode='custom' match='exact' check='none'>
+    <model fallback='forbid'>486</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='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <audio id='1' type='none'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+    </memballoon>
+  </devices>
+</domain>
diff --git a/tests/qemuxmlconfdata/isapc-pci.xml b/tests/qemuxmlconfdata/isapc-pci.xml
new file mode 100644
index 0000000000..a31cc54b67
--- /dev/null
+++ b/tests/qemuxmlconfdata/isapc-pci.xml
@@ -0,0 +1,13 @@
+<domain type='qemu'>
+  <name>test</name>
+  <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
+  <memory unit='KiB'>2097152</memory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='x86_64' machine='isapc'>hvm</type>
+  </os>
+  <devices>
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
+    <controller type='pci' model='pci-root' index='0'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c
index 26afdf7a7e..e2f7d3dc83 100644
--- a/tests/qemuxmlconftest.c
+++ b/tests/qemuxmlconftest.c
@@ -1295,6 +1295,8 @@ mymain(void)
 
     DO_TEST_CAPS_LATEST_PARSE_ERROR("no-memory");
 
+    DO_TEST_CAPS_LATEST("isapc-pci");
+
     DO_TEST_CAPS_LATEST("genid");
     DO_TEST_CAPS_LATEST("genid-auto");
 
-- 
2.50.1