[PATCH v1 5/8] tests: add test for domain XML with TPM Proxy device model

Daniel Henrique Barboza danielhb413 at gmail.com
Fri May 8 12:06:54 UTC 2020


Update qemuxml2xmltest.c to add tests to validate the XML parsing
of the new TPM Proxy device type.

Signed-off-by: Daniel Henrique Barboza <danielhb413 at gmail.com>
---
 tests/qemuxml2argvdata/ppc64-tpmproxy.xml   | 31 +++++++++++++++++
 tests/qemuxml2xmloutdata/ppc64-tpmproxy.xml | 37 +++++++++++++++++++++
 tests/qemuxml2xmltest.c                     |  4 +++
 3 files changed, 72 insertions(+)
 create mode 100644 tests/qemuxml2argvdata/ppc64-tpmproxy.xml
 create mode 100644 tests/qemuxml2xmloutdata/ppc64-tpmproxy.xml

diff --git a/tests/qemuxml2argvdata/ppc64-tpmproxy.xml b/tests/qemuxml2argvdata/ppc64-tpmproxy.xml
new file mode 100644
index 0000000000..fef82bd5c7
--- /dev/null
+++ b/tests/qemuxml2argvdata/ppc64-tpmproxy.xml
@@ -0,0 +1,31 @@
+<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='ppc64' machine='pseries'>hvm</type>
+  </os>
+  <features>
+    <acpi/>
+    <apic/>
+    <pae/>
+  </features>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-ppc64</emulator>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+    </controller>
+    <tpmproxy>
+      <device path='/dev/tpmrm0'/>
+    </tpmproxy>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
+    </memballoon>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/ppc64-tpmproxy.xml b/tests/qemuxml2xmloutdata/ppc64-tpmproxy.xml
new file mode 100644
index 0000000000..9ad1da9434
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/ppc64-tpmproxy.xml
@@ -0,0 +1,37 @@
+<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='ppc64' machine='pseries'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <features>
+    <acpi/>
+    <apic/>
+    <pae/>
+  </features>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-ppc64</emulator>
+    <controller type='usb' index='0' model='pci-ohci'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+    </controller>
+    <controller type='pci' index='0' model='pci-root'>
+      <model name='spapr-pci-host-bridge'/>
+      <target index='0'/>
+    </controller>
+    <tpmproxy model='spapr-tpm-proxy'>
+      <device path='/dev/tpmrm0'/>
+    </tpmproxy>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
+    </memballoon>
+    <panic model='pseries'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 86f3d2c1f3..c9745ae337 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -610,6 +610,10 @@ mymain(void)
     DO_TEST("controller-usb-order",
             QEMU_CAPS_PIIX_DISABLE_S3,
             QEMU_CAPS_PIIX_DISABLE_S4);
+    DO_TEST("ppc64-tpmproxy",
+            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
+            QEMU_CAPS_PCI_OHCI,
+            QEMU_CAPS_DEVICE_SPAPR_TPM_PROXY);
 
     DO_TEST_FULL("seclabel-dynamic-baselabel", WHEN_INACTIVE,
                  ARG_QEMU_CAPS, NONE);
-- 
2.26.2





More information about the libvir-list mailing list