[PATCH 2/2] conf/test: add a negative test for invalid 'acpi-bridge-hotplug' configuration

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

 



'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@xxxxxxxxxxx>
---
 ...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




[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