From 9dca74ee6f54cd8ac42acaf08e73c06500386437 Mon Sep 17 00:00:00 2001 From: Pavel Hrdina Date: Tue, 15 Mar 2016 13:54:24 +0100 Subject: [PATCH] qemuxml2argvtest: use driver.config and priv for qemuDomainSetPrivatePaths Update testutilsqemu to overwrite libDir and channelTargetDir and set private paths using domain's privateData. This changes is required for following patch. Signed-off-by: Pavel Hrdina --- .../qemuxml2argv-channel-virtio-unix.xml | 2 +- tests/qemuxml2argvtest.c | 18 +++++++----------- tests/testutilsqemu.c | 7 +++++++ 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-unix.xml b/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-unix.xml index 405dff8389..cef04453d6 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-unix.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-unix.xml @@ -33,7 +33,7 @@ - + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 1000ab7f3b..2f283afe30 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -265,8 +265,7 @@ static int testCompareXMLToArgvFiles(const char *xml, virCommandPtr cmd = NULL; size_t i; virBitmapPtr nodeset = NULL; - char *domainLibDir = NULL; - char *domainChannelTargetDir = NULL; + qemuDomainObjPrivatePtr priv = NULL; if (!(conn = virGetConnect())) goto out; @@ -286,6 +285,7 @@ static int testCompareXMLToArgvFiles(const char *xml, goto ok; goto out; } + priv = vm->privateData; if (!virDomainDefCheckABIStability(vm->def, vm->def)) { VIR_TEST_DEBUG("ABI stability check failed on %s", xml); @@ -294,13 +294,14 @@ static int testCompareXMLToArgvFiles(const char *xml, vm->def->id = -1; - if (qemuDomainSetPrivatePaths(&domainLibDir, &domainChannelTargetDir, - "/tmp/lib", "/tmp/channel", + if (qemuDomainSetPrivatePaths(&priv->libDir, &priv->channelTargetDir, + driver.config->libDir, + driver.config->channelTargetDir, vm->def->name, vm->def->id) < 0) goto out; memset(&monitor_chr, 0, sizeof(monitor_chr)); - if (qemuProcessPrepareMonitorChr(&monitor_chr, domainLibDir) < 0) + if (qemuProcessPrepareMonitorChr(&monitor_chr, priv->libDir) < 0) goto out; virQEMUCapsSetList(extraFlags, @@ -366,7 +367,7 @@ static int testCompareXMLToArgvFiles(const char *xml, &testCallbacks, false, (flags & FLAG_FIPS), nodeset, NULL, NULL, - domainLibDir, domainChannelTargetDir))) { + priv->libDir, priv->channelTargetDir))) { if (flags & FLAG_EXPECT_FAILURE) goto ok; goto out; @@ -407,8 +408,6 @@ static int testCompareXMLToArgvFiles(const char *xml, virObjectUnref(vm); virObjectUnref(conn); virBitmapFree(nodeset); - VIR_FREE(domainLibDir); - VIR_FREE(domainChannelTargetDir); return ret; } @@ -545,9 +544,6 @@ mymain(void) driver.config->spiceTLS = 1; if (VIR_STRDUP_QUIET(driver.config->spicePassword, "123456") < 0) return EXIT_FAILURE; - VIR_FREE(driver.config->channelTargetDir); - if (VIR_STRDUP_QUIET(driver.config->channelTargetDir, "/tmp") < 0) - return EXIT_FAILURE; # define DO_TEST_FULL(name, migrateFrom, migrateFd, flags, \ parseFlags, ...) \ diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index ae69a18f52..1f854f50b5 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -564,6 +564,13 @@ int qemuTestDriverInit(virQEMUDriver *driver) if (!driver->config) goto error; + /* Overwrite some default paths so it's consistent for tests. */ + VIR_FREE(driver->config->libDir); + VIR_FREE(driver->config->channelTargetDir); + if (VIR_STRDUP(driver->config->libDir, "/tmp/lib") < 0 || + VIR_STRDUP(driver->config->channelTargetDir, "/tmp/channel") < 0) + goto error; + driver->caps = testQemuCapsInit(); if (!driver->caps) goto error; -- GitLab