This patch series adds a couple of negative unit tests in order to make sure
we fail in case of invalid conf options.
* [PATCH 1/2] conf/test: add a negative unit test for invalid pci
Above patch makes sure we fail if invalid pci specific global feature is specified.
* [PATCH 2/2] conf/test: add a negative test for invalid
Above patch makes sure we fail if invalid config arrtinute for acpi-bridge-hotplug is
specified.
Show replies by date
This change adds a negative unit test to make sure that invalid or unknown pci
related features specified in the input domain xml file will result in an
error.
Signed-off-by: Ani Sinha <ani(a)anisinha.ca>
---
.../pci-feature-invalid.x86_64-latest.err | 1 +
.../qemuxml2argvdata/pci-feature-invalid.xml | 25 +++++++++++++++++++
tests/qemuxml2argvtest.c | 2 ++
3 files changed, 28 insertions(+)
create mode 100644 tests/qemuxml2argvdata/pci-feature-invalid.x86_64-latest.err
create mode 100644 tests/qemuxml2argvdata/pci-feature-invalid.xml
diff --git a/tests/qemuxml2argvdata/pci-feature-invalid.x86_64-latest.err
b/tests/qemuxml2argvdata/pci-feature-invalid.x86_64-latest.err
new file mode 100644
index 0000000000..9e66d37192
--- /dev/null
+++ b/tests/qemuxml2argvdata/pci-feature-invalid.x86_64-latest.err
@@ -0,0 +1 @@
+unsupported configuration: unsupported PCI feature: 'test-feature'
diff --git a/tests/qemuxml2argvdata/pci-feature-invalid.xml
b/tests/qemuxml2argvdata/pci-feature-invalid.xml
new file mode 100644
index 0000000000..3aec36d14f
--- /dev/null
+++ b/tests/qemuxml2argvdata/pci-feature-invalid.xml
@@ -0,0 +1,25 @@
+<domain type='qemu'>
+ <name>test</name>
+ <uuid>56f5055c-1b8d-490c-844a-ad646a1caaaa</uuid>
+ <memory unit='KiB'>1048576</memory>
+ <currentMemory unit='KiB'>1048576</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='x86_64' machine='pc-q35-2.5'>hvm</type>
+ <boot dev='network'/>
+ </os>
+ <features>
+ <pci>
+ <test-feature state='off'/>
+ </pci>
+ </features>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <controller type='pci' index='0' model='pcie-root'/>
+ <controller type='pci' index='3'
model='pcie-root-port'>
+ <model name='ioh3420'/>
+ <target chassis='3' port='0x8'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x01' function='0x0'/>
+ </controller>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index a0ee5f9943..ee5f65f378 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2576,6 +2576,8 @@ mymain(void)
* archs other than x86
*/
DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR("aarch64-acpi-hotplug-bridge-disable",
"aarch64");
+ /* verify that invalid pci feature speicification in xml would fail */
+ DO_TEST_CAPS_LATEST_PARSE_ERROR("pci-feature-invalid");
DO_TEST("q35-usb2",
QEMU_CAPS_DEVICE_PCI_BRIDGE,
QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
--
2.25.1
'acpi-bridge-hotplug' global config only supports 'state=off|on'
attribute. Any
other attributes are invalid. Added a unit test to make sure we fail in case an
invalid config option is specified.
Signed-off-by: Ani Sinha <ani(a)anisinha.ca>
---
...i-bridge-hotplug-invalid.x86_64-latest.err | 1 +
.../pci-acpi-bridge-hotplug-invalid.xml | 25 +++++++++++++++++++
tests/qemuxml2argvtest.c | 2 ++
3 files changed, 28 insertions(+)
create mode 100644
tests/qemuxml2argvdata/pci-acpi-bridge-hotplug-invalid.x86_64-latest.err
create mode 100644 tests/qemuxml2argvdata/pci-acpi-bridge-hotplug-invalid.xml
diff --git a/tests/qemuxml2argvdata/pci-acpi-bridge-hotplug-invalid.x86_64-latest.err
b/tests/qemuxml2argvdata/pci-acpi-bridge-hotplug-invalid.x86_64-latest.err
new file mode 100644
index 0000000000..c037dd7567
--- /dev/null
+++ b/tests/qemuxml2argvdata/pci-acpi-bridge-hotplug-invalid.x86_64-latest.err
@@ -0,0 +1 @@
+XML error: Missing required attribute 'state' in element
'acpi-bridge-hotplug'
diff --git a/tests/qemuxml2argvdata/pci-acpi-bridge-hotplug-invalid.xml
b/tests/qemuxml2argvdata/pci-acpi-bridge-hotplug-invalid.xml
new file mode 100644
index 0000000000..ba8372663b
--- /dev/null
+++ b/tests/qemuxml2argvdata/pci-acpi-bridge-hotplug-invalid.xml
@@ -0,0 +1,25 @@
+<domain type='qemu'>
+ <name>test</name>
+ <uuid>56f5055c-1b8d-490c-844a-ad646a1caaaa</uuid>
+ <memory unit='KiB'>1048576</memory>
+ <currentMemory unit='KiB'>1048576</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='x86_64' machine='pc-q35-2.5'>hvm</type>
+ <boot dev='network'/>
+ </os>
+ <features>
+ <pci>
+ <acpi-bridge-hotplug enabled='off'/>
+ </pci>
+ </features>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <controller type='pci' index='0' model='pcie-root'/>
+ <controller type='pci' index='3'
model='pcie-root-port'>
+ <model name='ioh3420'/>
+ <target chassis='3' port='0x8'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x01' function='0x0'/>
+ </controller>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index ee5f65f378..2521814d24 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2578,6 +2578,8 @@ mymain(void)
DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR("aarch64-acpi-hotplug-bridge-disable",
"aarch64");
/* verify that invalid pci feature speicification in xml would fail */
DO_TEST_CAPS_LATEST_PARSE_ERROR("pci-feature-invalid");
+ /* verify that 'acpi-bridge-hotplug' feature has the correct attributes */
+ DO_TEST_CAPS_LATEST_PARSE_ERROR("pci-acpi-bridge-hotplug-invalid");
DO_TEST("q35-usb2",
QEMU_CAPS_DEVICE_PCI_BRIDGE,
QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
--
2.25.1