[PATCH v2 1/3] tests: Improve target index validation coverage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 ...ml => qemuxml2argv-pseries-phb-invalid-target-index-1.xml} |  4 ----
 ...ml => qemuxml2argv-pseries-phb-invalid-target-index-2.xml} |  6 +-----
 ...ml => qemuxml2argv-pseries-phb-invalid-target-index-3.xml} | 11 ++++-------
 tests/qemuxml2argvtest.c                                      |  4 +++-
 4 files changed, 8 insertions(+), 17 deletions(-)
 copy tests/qemuxml2argvdata/{qemuxml2argv-pseries-phb-wrong-target-index.xml => qemuxml2argv-pseries-phb-invalid-target-index-1.xml} (79%)
 copy tests/qemuxml2argvdata/{qemuxml2argv-pseries-phb-wrong-target-index.xml => qemuxml2argv-pseries-phb-invalid-target-index-2.xml} (68%)
 rename tests/qemuxml2argvdata/{qemuxml2argv-pseries-phb-wrong-target-index.xml => qemuxml2argv-pseries-phb-invalid-target-index-3.xml} (57%)

diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-wrong-target-index.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-invalid-target-index-1.xml
similarity index 79%
copy from tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-wrong-target-index.xml
copy to tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-invalid-target-index-1.xml
index 48e3b1f80..4de341978 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-wrong-target-index.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-invalid-target-index-1.xml
@@ -12,10 +12,6 @@
     <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>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-wrong-target-index.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-invalid-target-index-2.xml
similarity index 68%
copy from tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-wrong-target-index.xml
copy to tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-invalid-target-index-2.xml
index 48e3b1f80..5e4aa2635 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-wrong-target-index.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-invalid-target-index-2.xml
@@ -8,11 +8,7 @@
   </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 -->
+    <!-- PHBs other than the default one can't have target index 0 -->
     <controller type='pci' index='1' model='pci-root'>
       <target index='0'/>
     </controller>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-wrong-target-index.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-invalid-target-index-3.xml
similarity index 57%
rename from tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-wrong-target-index.xml
rename to tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-invalid-target-index-3.xml
index 48e3b1f80..864c5d875 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-wrong-target-index.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-invalid-target-index-3.xml
@@ -8,13 +8,10 @@
   </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'/>
+    <!-- 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'/>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 77cfe8d28..5cdbc78eb 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -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,
-- 
2.13.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux