Check if PCI bridges with duplicate indexes are rejected.
PCI root controllers with non-zero indexes or addresses should
also be rejected.
---
.../qemuxml2argv-pci-bridge-duplicate-index.xml | 16 ++++++++++++++++
tests/qemuxml2argvdata/qemuxml2argv-pci-root-address.xml | 16 ++++++++++++++++
.../qemuxml2argv-pci-root-nonzero-index.xml | 14 ++++++++++++++
tests/qemuxml2argvtest.c | 6 ++++++
4 files changed, 52 insertions(+)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pci-bridge-duplicate-index.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pci-root-address.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pci-root-nonzero-index.xml
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pci-bridge-duplicate-index.xml
b/tests/qemuxml2argvdata/qemuxml2argv-pci-bridge-duplicate-index.xml
new file mode 100644
index 0000000..0aea45d
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pci-bridge-duplicate-index.xml
@@ -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
index 0000000..7b43246
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pci-root-address.xml
@@ -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
index 0000000..1a21d3b
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pci-root-nonzero-index.xml
@@ -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>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 0f96eef..75f1c4a 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1018,6 +1018,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);
--
1.8.1.5