[PATCH 1/2] conf/test: add a negative unit test for invalid pci feature config

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

 



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




[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