[PATCH 3/4] tests: mock swtpm initialization for all qemu tests

Cole Robinson crobinso at redhat.com
Sat Jun 18 18:32:33 UTC 2022


Don't restrict this to domcaps testing only, we will soon
need it for qemu command line validation

Signed-off-by: Cole Robinson <crobinso at redhat.com>
---
 tests/domaincapstest.c | 7 -------
 tests/testutilsqemu.c  | 8 ++++++++
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c
index da5c629fd4..3b8216a8f6 100644
--- a/tests/domaincapstest.c
+++ b/tests/domaincapstest.c
@@ -22,7 +22,6 @@
 #include "domain_capabilities.h"
 #include "virfilewrapper.h"
 #include "configmake.h"
-#include "virtpm.h"
 
 
 #define VIR_FROM_THIS VIR_FROM_NONE
@@ -129,12 +128,6 @@ fillQemuCaps(virDomainCaps *domCaps,
 }
 
 
-/* Enough to tell capabilities code that swtpm is usable */
-bool virTPMHasSwtpm(void)
-{
-    return true;
-}
-
 #endif /* WITH_QEMU */
 
 
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index d26caba5fb..6dabbaf36a 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -11,6 +11,7 @@
 # include "qemu/qemu_capspriv.h"
 # include "virstring.h"
 # include "virfilecache.h"
+# include "virtpm.h"
 
 # include <sys/types.h>
 # include <fcntl.h>
@@ -138,6 +139,13 @@ virFindFileInPath(const char *file)
 }
 
 
+/* Enough to tell capabilities code that swtpm is usable */
+bool virTPMHasSwtpm(void)
+{
+    return true;
+}
+
+
 virCapsHostNUMA *
 virCapabilitiesHostNUMANewHost(void)
 {
-- 
2.36.1



More information about the libvir-list mailing list