#include <unistd.h>
#include <fcntl.h>
+#include "testutils.h"
+
#define VIR_FROM_THIS VIR_FROM_NONE
long virGetSystemPageSize(void)
int
-qemuBuildTPMOpenBackendFDs(const char *tpmdev G_GNUC_UNUSED,
+qemuBuildTPMOpenBackendFDs(const char *tpmdev,
int *tpmfd,
int *cancelfd)
{
- if (fcntl(1730, F_GETFD) != -1 ||
- fcntl(1731, F_GETFD) != -1)
- abort();
-
- *tpmfd = 1730;
- *cancelfd = 1731;
+ *tpmfd = virTestMakeDummyFD(g_strdup_printf("@tpm-%s-fd@", tpmdev));
+ *cancelfd = virTestMakeDummyFD(g_strdup_printf("@tpm-%s-cancelfd@", tpmdev));
return 0;
}
-no-shutdown \
-boot menu=on,strict=on \
-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
--add-fd set=0,fd=XXXXXXX,opaque=tpm0-tpm \
--add-fd set=1,fd=XXXXXXX,opaque=tpm0-cancel \
+-add-fd set=0,fd=@tpm-/dev/tpm0-fd@,opaque=tpm0-tpm \
+-add-fd set=1,fd=@tpm-/dev/tpm0-cancelfd@,opaque=tpm0-cancel \
-tpmdev passthrough,id=tpm-tpm0,path=/dev/fdset/0,cancel-path=/dev/fdset/1 \
-device '{"driver":"tpm-crb","tpmdev":"tpm-tpm0","id":"tpm0"}' \
-audiodev '{"id":"audio1","driver":"none"}' \
-no-shutdown \
-boot menu=on,strict=on \
-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
--add-fd set=0,fd=XXXXXXX,opaque=tpm0-tpm \
--add-fd set=1,fd=XXXXXXX,opaque=tpm0-cancel \
+-add-fd set=0,fd=@tpm-/dev/tpm0-fd@,opaque=tpm0-tpm \
+-add-fd set=1,fd=@tpm-/dev/tpm0-cancelfd@,opaque=tpm0-cancel \
-tpmdev passthrough,id=tpm-tpm0,path=/dev/fdset/0,cancel-path=/dev/fdset/1 \
-device '{"driver":"tpm-tis","tpmdev":"tpm-tpm0","id":"tpm0"}' \
-audiodev '{"id":"audio1","driver":"none"}' \