[libvirt] [PATCH 3/8] tests: Add negative test for Intel IOMMU

Andrea Bolognani posted 8 patches 6 years, 8 months ago
[libvirt] [PATCH 3/8] tests: Add negative test for Intel IOMMU
Posted by Andrea Bolognani 6 years, 8 months ago
Make sure validation is working as intended by trying to use
Intel IOMMU with the i440fx machine type, though we know it's
q35 only, and expecting an error to be returned.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
 .../intel-iommu-wrong-machine.xml             | 24 +++++++++++++++++++
 tests/qemuxml2argvtest.c                      |  1 +
 2 files changed, 25 insertions(+)
 create mode 100644 tests/qemuxml2argvdata/intel-iommu-wrong-machine.xml

diff --git a/tests/qemuxml2argvdata/intel-iommu-wrong-machine.xml b/tests/qemuxml2argvdata/intel-iommu-wrong-machine.xml
new file mode 100644
index 0000000000..ab116f83b3
--- /dev/null
+++ b/tests/qemuxml2argvdata/intel-iommu-wrong-machine.xml
@@ -0,0 +1,24 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
+    <controller type='pci' index='0' model='pci-root'/>
+    <controller type='usb' index='0' model='none'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+    <iommu model='intel'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 1c2a2b3905..0e83acac86 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2812,6 +2812,7 @@ mymain(void)
     DO_TEST_CAPS_LATEST("intel-iommu-caching-mode");
     DO_TEST_CAPS_LATEST("intel-iommu-eim");
     DO_TEST_CAPS_LATEST("intel-iommu-device-iotlb");
+    DO_TEST_FAILURE("intel-iommu-wrong-machine", NONE);
 
     DO_TEST("cpu-hotplug-startup", QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS);
     DO_TEST_PARSE_ERROR("cpu-hotplug-granularity",
-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 3/8] tests: Add negative test for Intel IOMMU
Posted by Ján Tomko 6 years, 8 months ago
On Mon, May 20, 2019 at 01:37:48PM +0200, Andrea Bolognani wrote:
>Make sure validation is working as intended by trying to use
>Intel IOMMU with the i440fx machine type, though we know it's
>q35 only, and expecting an error to be returned.
>
>Signed-off-by: Andrea Bolognani <abologna@redhat.com>
>---
> .../intel-iommu-wrong-machine.xml             | 24 +++++++++++++++++++
> tests/qemuxml2argvtest.c                      |  1 +
> 2 files changed, 25 insertions(+)
> create mode 100644 tests/qemuxml2argvdata/intel-iommu-wrong-machine.xml
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list