[RFC PATCH V1 5/5] tpm: Add test cases for the TPM device XML

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

 



This patch adds several test cases for the parsing and Qemu command
line generation for the previously added TPM support.

Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxxxxxxxxxx>

---
 tests/qemuxml2argvdata/qemuxml2argv-tpm-encrypted-bs.args |    6 ++
 tests/qemuxml2argvdata/qemuxml2argv-tpm-encrypted-bs.xml  |   30 ++++++++++++++
 tests/qemuxml2argvdata/qemuxml2argv-tpm-file.args         |    6 ++
 tests/qemuxml2argvdata/qemuxml2argv-tpm-file.xml          |   26 ++++++++++++
 tests/qemuxml2argvdata/qemuxml2argv-tpm.args              |    6 ++
 tests/qemuxml2argvdata/qemuxml2argv-tpm.xml               |   26 ++++++++++++
 tests/qemuxml2argvtest.c                                  |    3 +
 tests/qemuxml2xmltest.c                                   |    4 +
 8 files changed, 107 insertions(+)

Index: libvirt-acl/tests/qemuxml2argvdata/qemuxml2argv-tpm.xml
===================================================================
--- /dev/null
+++ libvirt-acl/tests/qemuxml2argvdata/qemuxml2argv-tpm.xml
@@ -0,0 +1,26 @@
+<domain type='qemu'>
+  <name>TPM-VM</name>
+  <uuid>a4d7cd22-da89-3094-6212-079a48a309a1</uuid>
+  <memory>2097152</memory>
+  <currentMemory>512288</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc-0.12'>hvm</type>
+    <boot dev='hd'/>
+    <bootmenu enable='yes'/>
+  </os>
+  <features>
+    <acpi/>
+  </features>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <tpm type='built-in'>
+      <storage/>
+    </tpm>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
Index: libvirt-acl/tests/qemuxml2argvtest.c
===================================================================
--- libvirt-acl.orig/tests/qemuxml2argvtest.c
+++ libvirt-acl/tests/qemuxml2argvtest.c
@@ -496,6 +496,9 @@ mymain(int argc, char **argv)
     DO_TEST("blkiotune", false, QEMU_CAPS_NAME);
     DO_TEST("cputune", false, QEMU_CAPS_NAME);
 
+    DO_TEST("tpm", false, QEMU_CAPS_TPM);
+    DO_TEST("tpm-encrypted-bs", false, QEMU_CAPS_TPM);
+
     free(driver.stateDir);
     virCapabilitiesFree(driver.caps);
 
Index: libvirt-acl/tests/qemuxml2xmltest.c
===================================================================
--- libvirt-acl.orig/tests/qemuxml2xmltest.c
+++ libvirt-acl/tests/qemuxml2xmltest.c
@@ -189,6 +189,10 @@ mymain(int argc, char **argv)
 
     DO_TEST("smp");
 
+    DO_TEST("tpm");
+    DO_TEST("tpm-file");
+    DO_TEST("tpm-encrypted-bs");
+
     /* These tests generate different XML */
     DO_TEST_DIFFERENT("balloon-device-auto");
     DO_TEST_DIFFERENT("channel-virtio-auto");
Index: libvirt-acl/tests/qemuxml2argvdata/qemuxml2argv-tpm.args
===================================================================
--- /dev/null
+++ libvirt-acl/tests/qemuxml2argvdata/qemuxml2argv-tpm.args
@@ -0,0 +1,6 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test \
+/usr/bin/qemu -S -M pc-0.12 -m 2048 -smp 1 -nographic \
+-monitor unix:/tmp/test-monitor,server,nowait -boot c -net none \
+-serial none -parallel none \
+-tpm type=builtin,path=/var/lib/libvirt/tpm/a4d7cd22-da89-3094-6212-079a48a309a1.bin \
+-usb
Index: libvirt-acl/tests/qemuxml2argvdata/qemuxml2argv-tpm-encrypted-bs.args
===================================================================
--- /dev/null
+++ libvirt-acl/tests/qemuxml2argvdata/qemuxml2argv-tpm-encrypted-bs.args
@@ -0,0 +1,6 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test \
+/usr/bin/qemu -S -M pc-0.12 -m 2048 -smp 1 -nographic \
+-monitor unix:/tmp/test-monitor,server,nowait -boot c -net none \
+-serial none -parallel none \
+-tpm type=builtin,path=/var/lib/libvirt/tpm/a4d7cd22-da89-3094-6212-079a48a309a1.bin \
+-usb
Index: libvirt-acl/tests/qemuxml2argvdata/qemuxml2argv-tpm-encrypted-bs.xml
===================================================================
--- /dev/null
+++ libvirt-acl/tests/qemuxml2argvdata/qemuxml2argv-tpm-encrypted-bs.xml
@@ -0,0 +1,30 @@
+<domain type='qemu'>
+  <name>TPM-VM</name>
+  <uuid>a4d7cd22-da89-3094-6212-079a48a309a1</uuid>
+  <memory>2097152</memory>
+  <currentMemory>512288</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc-0.12'>hvm</type>
+    <boot dev='hd'/>
+    <bootmenu enable='yes'/>
+  </os>
+  <features>
+    <acpi/>
+  </features>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <tpm type='built-in'>
+      <storage>
+        <encryption format='qcow'>
+          <secret type='passphrase' uuid='13ea49f7-2553-7308-5168-e337ade36232'/>
+        </encryption>
+      </storage>
+    </tpm>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
Index: libvirt-acl/tests/qemuxml2argvdata/qemuxml2argv-tpm-file.args
===================================================================
--- /dev/null
+++ libvirt-acl/tests/qemuxml2argvdata/qemuxml2argv-tpm-file.args
@@ -0,0 +1,6 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test \
+/usr/bin/qemu -S -M pc-0.12 -m 2048 -smp 1 -nographic \
+-monitor unix:/tmp/test-monitor,server,nowait -boot c -net none \
+-serial none -parallel none \
+-tpm type=builtin,path=/tmp/tpmstate.bin \
+-usb
Index: libvirt-acl/tests/qemuxml2argvdata/qemuxml2argv-tpm-file.xml
===================================================================
--- /dev/null
+++ libvirt-acl/tests/qemuxml2argvdata/qemuxml2argv-tpm-file.xml
@@ -0,0 +1,26 @@
+<domain type='qemu'>
+  <name>TPM-VM</name>
+  <uuid>a4d7cd22-da89-3094-6212-079a48a309a1</uuid>
+  <memory>2097152</memory>
+  <currentMemory>512288</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc-0.12'>hvm</type>
+    <boot dev='hd'/>
+    <bootmenu enable='yes'/>
+  </os>
+  <features>
+    <acpi/>
+  </features>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <tpm type='built-in'>
+      <storage file='/tmp/tpmstate.bin'/>
+    </tpm>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>

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


[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]