All supported qemus support FD passing so modify the tests to test the
proper code path.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
tests/qemuxml2argvdata/tpm-passthrough-crb.args | 5 +++--
tests/qemuxml2argvdata/tpm-passthrough.args | 5 +++--
tests/qemuxml2argvmock.c | 16 ++++++++++++++++
tests/qemuxml2argvtest.c | 2 ++
4 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/tests/qemuxml2argvdata/tpm-passthrough-crb.args b/tests/qemuxml2argvdata/tpm-passthrough-crb.args
index 8c73bc6706..4da8be1a73 100644
--- a/tests/qemuxml2argvdata/tpm-passthrough-crb.args
+++ b/tests/qemuxml2argvdata/tpm-passthrough-crb.args
@@ -21,7 +21,8 @@ server,nowait \
-no-shutdown \
-boot menu=on \
-usb \
--tpmdev passthrough,id=tpm-tpm0,path=/dev/tpm0,\
-cancel-path=/sys/class/misc/tpm0/device/cancel \
+-tpmdev passthrough,id=tpm-tpm0,path=/dev/fdset/0,cancel-path=/dev/fdset/1 \
+-add-fd set=0,fd=1730 \
+-add-fd set=1,fd=1731 \
-device tpm-crb,tpmdev=tpm-tpm0,id=tpm0 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/tpm-passthrough.args b/tests/qemuxml2argvdata/tpm-passthrough.args
index d4dd371f06..8ab7693009 100644
--- a/tests/qemuxml2argvdata/tpm-passthrough.args
+++ b/tests/qemuxml2argvdata/tpm-passthrough.args
@@ -21,7 +21,8 @@ server,nowait \
-no-shutdown \
-boot menu=on \
-usb \
--tpmdev passthrough,id=tpm-tpm0,path=/dev/tpm0,\
-cancel-path=/sys/class/misc/tpm0/device/cancel \
+-tpmdev passthrough,id=tpm-tpm0,path=/dev/fdset/0,cancel-path=/dev/fdset/1 \
+-add-fd set=0,fd=1730 \
+-add-fd set=1,fd=1731 \
-device tpm-tis,tpmdev=tpm-tpm0,id=tpm0 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvmock.c b/tests/qemuxml2argvmock.c
index c8a5f186d5..b9ba6c9648 100644
--- a/tests/qemuxml2argvmock.c
+++ b/tests/qemuxml2argvmock.c
@@ -225,3 +225,19 @@ qemuOpenChrChardevUNIXSocket(const virDomainChrSourceDef *dev ATTRIBUTE_UNUSED)
abort();
return 1729;
}
+
+
+int
+qemuBuildTPMOpenBackendFDs(const char *tpmdev ATTRIBUTE_UNUSED,
+ const char *cancel_path ATTRIBUTE_UNUSED,
+ int *tpmfd,
+ int *cancelfd)
+{
+ if (fcntl(1730, F_GETFD) != -1 ||
+ fcntl(1731, F_GETFD) != -1)
+ abort();
+
+ *tpmfd = 1730;
+ *cancelfd = 1731;
+ return 0;
+}
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 8a7b82a1f2..5c01fba6f0 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2061,8 +2061,10 @@ mymain(void)
QEMU_CAPS_KVM);
DO_TEST("tpm-passthrough",
+ QEMU_CAPS_ADD_FD,
QEMU_CAPS_DEVICE_TPM_PASSTHROUGH, QEMU_CAPS_DEVICE_TPM_TIS);
DO_TEST("tpm-passthrough-crb",
+ QEMU_CAPS_ADD_FD,
QEMU_CAPS_DEVICE_TPM_PASSTHROUGH, QEMU_CAPS_DEVICE_TPM_CRB);
DO_TEST_PARSE_ERROR("tpm-no-backend-invalid",
QEMU_CAPS_DEVICE_TPM_PASSTHROUGH, QEMU_CAPS_DEVICE_TPM_TIS);
--
2.16.2
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list