]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tests: PCI controller checks
authorJán Tomko <jtomko@redhat.com>
Mon, 22 Jul 2013 06:51:55 +0000 (08:51 +0200)
committerJán Tomko <jtomko@redhat.com>
Thu, 25 Jul 2013 11:16:46 +0000 (13:16 +0200)
Check if PCI bridges with duplicate indexes are rejected.
PCI root controllers with non-zero indexes or addresses should
also be rejected.

tests/qemuxml2argvdata/qemuxml2argv-pci-bridge-duplicate-index.xml [new file with mode: 0644]
tests/qemuxml2argvdata/qemuxml2argv-pci-root-address.xml [new file with mode: 0644]
tests/qemuxml2argvdata/qemuxml2argv-pci-root-nonzero-index.xml [new file with mode: 0644]
tests/qemuxml2argvtest.c

diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pci-bridge-duplicate-index.xml b/tests/qemuxml2argvdata/qemuxml2argv-pci-bridge-duplicate-index.xml
new file mode 100644 (file)
index 0000000..0aea45d
--- /dev/null
@@ -0,0 +1,16 @@
+<domain type='qemu'>
+  <name>fdr-br</name>
+  <memory unit='KiB'>2097152</memory>
+  <currentMemory unit='KiB'>2097152</currentMemory>
+  <vcpu placement='static' cpuset='0-1'>2</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc-1.2'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <devices>
+    <emulator>/usr/libexec/qemu-kvm</emulator>
+    <controller type='pci' index='0' model='pci-root'/>
+    <controller type='pci' index='1' model='pci-bridge'/>
+    <controller type='pci' index='1' model='pci-bridge'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pci-root-address.xml b/tests/qemuxml2argvdata/qemuxml2argv-pci-root-address.xml
new file mode 100644 (file)
index 0000000..7b43246
--- /dev/null
@@ -0,0 +1,16 @@
+<domain type='qemu'>
+  <name>fdr-br</name>
+  <memory unit='KiB'>2097152</memory>
+  <currentMemory unit='KiB'>2097152</currentMemory>
+  <vcpu placement='static' cpuset='0-1'>2</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc-1.2'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <devices>
+    <emulator>/usr/libexec/qemu-kvm</emulator>
+    <controller type='pci' index='0' model='pci-root'>
+      <address type='pci' domain='0' bus='0' slot='0' function='0'/>
+    </controller>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pci-root-nonzero-index.xml b/tests/qemuxml2argvdata/qemuxml2argv-pci-root-nonzero-index.xml
new file mode 100644 (file)
index 0000000..1a21d3b
--- /dev/null
@@ -0,0 +1,14 @@
+<domain type='qemu'>
+  <name>fdr-br</name>
+  <memory unit='KiB'>2097152</memory>
+  <currentMemory unit='KiB'>2097152</currentMemory>
+  <vcpu placement='static' cpuset='0-1'>2</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc-1.2'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <devices>
+    <emulator>/usr/libexec/qemu-kvm</emulator>
+    <controller type='pci' index='7' model='pci-root'/>
+  </devices>
+</domain>
index 8185c541b9dfe525f37df4a1915fe198219cb4a1..b7485fc992a41005172b1419ca519ea090552d57 100644 (file)
@@ -1020,6 +1020,12 @@ mymain(void)
 
     DO_TEST_PARSE_ERROR("pci-bridge-negative-index-invalid",
                         QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_PCI_BRIDGE);
+    DO_TEST_PARSE_ERROR("pci-bridge-duplicate-index",
+                        QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_PCI_BRIDGE);
+    DO_TEST_PARSE_ERROR("pci-root-nonzero-index",
+                        QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_PCI_BRIDGE);
+    DO_TEST_PARSE_ERROR("pci-root-address",
+                        QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_PCI_BRIDGE);
 
     virObjectUnref(driver.config);
     virObjectUnref(driver.caps);