summaryrefslogtreecommitdiff
path: root/tests/qemustatusxml2xmltest.c
diff options
context:
space:
mode:
authorPeter Krempa <pkrempa@redhat.com>2021-08-17 16:26:58 +0200
committerPeter Krempa <pkrempa@redhat.com>2021-08-18 10:20:49 +0200
commit92e0cd2620e7e3cf755468ada11cec8f34df353f (patch)
treedb76c187e556d72362a055db57af9324ea42fbc0 /tests/qemustatusxml2xmltest.c
parent0ceb802ad9b72b0716d51b0ddf6be1cc99c54a98 (diff)
downloadlibvirt-92e0cd2620e7e3cf755468ada11cec8f34df353f.tar.gz
testutilsqemu: Introduce struct to hold data valid for all test runs
We pass multiple caching objects to individual tests which don't change. To prevent always having to pass them individually to 'testQemuInfoSetArgs' introduce 'struct testQemuConf' which will hold all of them and just the struct will be passed to the tests. Additionally this will make the conf available from inside the test run. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
Diffstat (limited to 'tests/qemustatusxml2xmltest.c')
-rw-r--r--tests/qemustatusxml2xmltest.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/qemustatusxml2xmltest.c b/tests/qemustatusxml2xmltest.c
index ac007405a6..995ef68a4c 100644
--- a/tests/qemustatusxml2xmltest.c
+++ b/tests/qemustatusxml2xmltest.c
@@ -72,11 +72,13 @@ mymain(void)
int ret = 0;
g_autofree char *fakerootdir = NULL;
g_autoptr(virQEMUDriverConfig) cfg = NULL;
- g_autoptr(GHashTable) capslatest = NULL;
+ g_autoptr(GHashTable) capslatest = testQemuGetLatestCaps();
g_autoptr(GHashTable) capscache = virHashNew(virObjectFreeHashData);
g_autoptr(virConnect) conn = NULL;
+ struct testQemuConf testConf = { .capslatest = capslatest,
+ .capscache = capscache,
+ .qapiSchemaCache = NULL };
- capslatest = testQemuGetLatestCaps();
if (!capslatest)
return EXIT_FAILURE;
@@ -110,7 +112,7 @@ mymain(void)
static struct testQemuInfo info = { \
.name = _name, \
}; \
- if (testQemuInfoSetArgs(&info, capscache, capslatest, ARG_END) < 0 || \
+ if (testQemuInfoSetArgs(&info, &testConf, ARG_END) < 0 || \
qemuTestCapsCacheInsert(driver.qemuCapsCache, info.qemuCaps) < 0) { \
VIR_TEST_DEBUG("Failed to generate status test data for '%s'", _name); \
return -1; \