]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: Improve target index validation coverage
authorAndrea Bolognani <abologna@redhat.com>
Thu, 17 Aug 2017 14:45:28 +0000 (16:45 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Mon, 21 Aug 2017 11:11:48 +0000 (13:11 +0200)
Split one of the existing tests to ensure both configuration
errors it contained cause a failure, and introduce a new
test case.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-invalid-target-index-1.xml [new file with mode: 0644]
tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-invalid-target-index-2.xml [new file with mode: 0644]
tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-invalid-target-index-3.xml [new file with mode: 0644]
tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-wrong-target-index.xml [deleted file]
tests/qemuxml2argvtest.c

diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-invalid-target-index-1.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-invalid-target-index-1.xml
new file mode 100644 (file)
index 0000000..4de3419
--- /dev/null
@@ -0,0 +1,18 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
+  <memory unit='KiB'>524288</memory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='ppc64' machine='pseries'>hvm</type>
+  </os>
+  <devices>
+    <emulator>/usr/bin/qemu-system-ppc64</emulator>
+    <!-- The default PHB (controller index 0) must have target index 0 -->
+    <controller type='pci' index='0' model='pci-root'>
+      <target index='1'/>
+    </controller>
+    <controller type='usb' model='none'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-invalid-target-index-2.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-invalid-target-index-2.xml
new file mode 100644 (file)
index 0000000..5e4aa26
--- /dev/null
@@ -0,0 +1,18 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
+  <memory unit='KiB'>524288</memory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='ppc64' machine='pseries'>hvm</type>
+  </os>
+  <devices>
+    <emulator>/usr/bin/qemu-system-ppc64</emulator>
+    <!-- PHBs other than the default one can't have target index 0 -->
+    <controller type='pci' index='1' model='pci-root'>
+      <target index='0'/>
+    </controller>
+    <controller type='usb' model='none'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-invalid-target-index-3.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-invalid-target-index-3.xml
new file mode 100644 (file)
index 0000000..864c5d8
--- /dev/null
@@ -0,0 +1,19 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
+  <memory unit='KiB'>524288</memory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='ppc64' machine='pseries'>hvm</type>
+  </os>
+  <devices>
+    <emulator>/usr/bin/qemu-system-ppc64</emulator>
+    <!-- QEMU only supports 32 PHBs with target index in the range 0-31,
+         so attempting to use target index 32 should fail -->
+    <controller type='pci' model='pci-root'>
+      <target index='32'/>
+    </controller>
+    <controller type='usb' model='none'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-wrong-target-index.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-wrong-target-index.xml
deleted file mode 100644 (file)
index 48e3b1f..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<domain type='qemu'>
-  <name>QEMUGuest1</name>
-  <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
-  <memory unit='KiB'>524288</memory>
-  <vcpu placement='static'>1</vcpu>
-  <os>
-    <type arch='ppc64' machine='pseries'>hvm</type>
-  </os>
-  <devices>
-    <emulator>/usr/bin/qemu-system-ppc64</emulator>
-    <!-- The default PHB (controller index 0) must have target index 0 -->
-    <controller type='pci' index='0' model='pci-root'>
-      <target index='1'/>
-    </controller>
-    <!-- Other PHBs can't have target index 0 -->
-    <controller type='pci' index='1' model='pci-root'>
-      <target index='0'/>
-    </controller>
-    <controller type='usb' model='none'/>
-    <memballoon model='none'/>
-  </devices>
-</domain>
index 77cfe8d28fd135cf7d50482d5efc05fa14b1002f..5cdbc78eb808da5a29b6f68ef2b18422b33e4e39 100644 (file)
@@ -1764,13 +1764,15 @@ mymain(void)
     DO_TEST("pseries-phb-default-missing",
             QEMU_CAPS_NODEFCONFIG,
             QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
-    DO_TEST_PARSE_ERROR("pseries-phb-wrong-target-index", NONE);
     DO_TEST("pseries-phb-numa-node",
             QEMU_CAPS_NUMA,
             QEMU_CAPS_OBJECT_MEMORY_RAM,
             QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
             QEMU_CAPS_SPAPR_PCI_HOST_BRIDGE_NUMA_NODE);
     DO_TEST_PARSE_ERROR("pseries-default-phb-numa-node", NONE);
+    DO_TEST_PARSE_ERROR("pseries-phb-invalid-target-index-1", NONE);
+    DO_TEST_PARSE_ERROR("pseries-phb-invalid-target-index-2", NONE);
+    DO_TEST_PARSE_ERROR("pseries-phb-invalid-target-index-3", NONE);
 
     DO_TEST("pseries-many-devices",
             QEMU_CAPS_NODEFCONFIG,