From e6c1ca3d11b4d7528cfd5c27813054af7e3d0b76 Mon Sep 17 00:00:00 2001 From: Andrea Bolognani Date: Mon, 6 Mar 2023 15:25:22 +0100 Subject: [PATCH] tests: Undo recent breakages 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 --- 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.47.2