Turns out that those overrides I recently removed where actually
there for a reason, and there was a motivation behind creating
the driver config as unprivileged too O:-)

Until a solution that can both ensure predictable output and
avoid code duplication is developed, go back to the previous
approach.

Fixes: 2f56f69f7f7e ("tests: Create privileged config for QEMU driver")
Fixes: 0f49b6cc6b81 ("tests: Drop no longer necessary overrides")
Fixes: 0b464cd84ff3 ("tests: Drop more QEMU driver config overrides")
Signed-off-by: Andrea Bolognani <abolo...@redhat.com>
---
Pushed under the build breaker rule.

Pipeline:

  https://gitlab.com/abologna/libvirt/-/pipelines/797459727

Note that the aarch64-macos-12 job is marked as failed, but the
underlying Cirrus CI job

  https://cirrus-ci.com/task/4640605947559936

finished successfully.

 tests/testutilsqemu.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index d3cdbdb4d5..d715252aee 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -631,7 +631,7 @@ int qemuTestDriverInit(virQEMUDriver *driver)
 
     driver->hostarch = virArchFromHost();
 
-    cfg = virQEMUDriverConfigNew(true, NULL);
+    cfg = virQEMUDriverConfigNew(false, NULL);
     if (!cfg)
         goto error;
     driver->config = cfg;
@@ -641,6 +641,24 @@ int qemuTestDriverInit(virQEMUDriver *driver)
     VIR_FREE(cfg->stateDir);
     VIR_FREE(cfg->configDir);
 
+    /* Override paths to ensure predictable output
+     *
+     * FIXME Find a way to achieve the same result while avoiding
+     *       code duplication
+     */
+    VIR_FREE(cfg->libDir);
+    cfg->libDir = g_strdup("/var/lib/libvirt/qemu");
+    VIR_FREE(cfg->channelTargetDir);
+    cfg->channelTargetDir = g_strdup("/var/lib/libvirt/qemu/channel/target");
+    VIR_FREE(cfg->memoryBackingDir);
+    cfg->memoryBackingDir = g_strdup("/var/lib/libvirt/qemu/ram");
+    VIR_FREE(cfg->nvramDir);
+    cfg->nvramDir = g_strdup("/var/lib/libvirt/qemu/nvram");
+    VIR_FREE(cfg->passtStateDir);
+    cfg->passtStateDir = g_strdup("/var/run/libvirt/qemu/passt");
+    VIR_FREE(cfg->dbusStateDir);
+    cfg->dbusStateDir = g_strdup("/var/run/libvirt/qemu/dbus");
+
     if (!g_mkdtemp(statedir)) {
         fprintf(stderr, "Cannot create fake stateDir");
         goto error;
-- 
2.39.2

Reply via email to