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 <phrdina@xxxxxxxxxx> --- .../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 405dff8..cef0445 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-unix.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-unix.xml @@ -33,7 +33,7 @@ <target type='virtio' name='ble'/> </channel> <channel type='unix'> - <source path='/tmp/domain-oldname/fdsa'/> + <source path='/tmp/channel/domain-oldname/fdsa'/> <target type='virtio' name='fdsa'/> </channel> <memballoon model='none'/> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 2c9dd1c..43747e7 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 ae69a18..1f854f5 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; -- 2.7.2 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list