tests: Improve target index validation coverage

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>
This commit is contained in:
Andrea Bolognani 2017-08-17 16:45:28 +02:00
parent 7726d1581f
commit 9e318ad713
4 changed files with 40 additions and 5 deletions

View File

@ -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>

View File

@ -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>

View File

@ -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>

View 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,