tests: qemuxml2argv: modernize TPM passthrough tests

All supported qemus support FD passing so modify the tests to test the
proper code path.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
Peter Krempa
2018-08-14 13:50:01 +02:00
parent 09e45e8a9b
commit 3411fd4db4
4 changed files with 25 additions and 5 deletions

View File

@@ -186,7 +186,7 @@ virNetDevRunEthernetScript(const char *ifname ATTRIBUTE_UNUSED,
static void (*real_virCommandPassFD)(virCommandPtr cmd, int fd, unsigned int flags);
static const int testCommandPassSafeFDs[] = { -1 };
static const int testCommandPassSafeFDs[] = { 1730, 1731 };
void
virCommandPassFD(virCommandPtr cmd,
@@ -247,3 +247,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;
}