From 09ac9e6d3cc63f37f2524900baa4b9a71442b1bc Mon Sep 17 00:00:00 2001 From: Andrea Bolognani Date: Thu, 2 Mar 2023 18:31:00 +0100 Subject: [PATCH] tests: Move more QEMU driver settings to common code None of these settings is specific to the xml2argv test. Moving them to the common code ensures the behavior of the QEMU driver is consistent across all QEMU tests. Signed-off-by: Andrea Bolognani Reviewed-by: Martin Kletzander --- tests/qemuxml2argvtest.c | 26 -------------------------- tests/testutilsqemu.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 4393578d1e..3932a5d28c 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -830,32 +830,6 @@ mymain(void) linuxCaps = driver.caps; macOSCaps = testQemuCapsInitMacOS(); - VIR_FREE(driver.config->vncTLSx509certdir); - driver.config->vncTLSx509certdir = g_strdup("/etc/pki/libvirt-vnc"); - VIR_FREE(driver.config->spiceTLSx509certdir); - driver.config->spiceTLSx509certdir = g_strdup("/etc/pki/libvirt-spice"); - VIR_FREE(driver.config->chardevTLSx509certdir); - driver.config->chardevTLSx509certdir = g_strdup("/etc/pki/libvirt-chardev"); - VIR_FREE(driver.config->vxhsTLSx509certdir); - driver.config->vxhsTLSx509certdir = g_strdup("/etc/pki/libvirt-vxhs/dummy,path"); - VIR_FREE(driver.config->nbdTLSx509certdir); - driver.config->nbdTLSx509certdir = g_strdup("/etc/pki/libvirt-nbd/dummy,path"); - - VIR_FREE(driver.config->vncSASLdir); - driver.config->vncSASLdir = g_strdup("/root/.sasl2"); - VIR_FREE(driver.config->spiceSASLdir); - driver.config->spiceSASLdir = g_strdup("/root/.sasl2"); - - VIR_FREE(driver.config->hugetlbfs); - driver.config->hugetlbfs = g_new0(virHugeTLBFS, 2); - driver.config->nhugetlbfs = 2; - driver.config->hugetlbfs[0].mnt_dir = g_strdup("/dev/hugepages2M"); - driver.config->hugetlbfs[1].mnt_dir = g_strdup("/dev/hugepages1G"); - driver.config->hugetlbfs[0].size = 2048; - driver.config->hugetlbfs[0].deflt = true; - driver.config->hugetlbfs[1].size = 1048576; - driver.config->spicePassword = g_strdup("123456"); - virFileWrapperAddPrefix(SYSCONFDIR "/qemu/firmware", abs_srcdir "/qemufirmwaredata/etc/qemu/firmware"); virFileWrapperAddPrefix(PREFIX "/share/qemu/firmware", diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index 113cbdc3dc..b093df8d9e 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -686,6 +686,34 @@ int qemuTestDriverInit(virQEMUDriver *driver) qemuTestSetHostCPU(driver, driver->hostarch, NULL); + VIR_FREE(cfg->vncTLSx509certdir); + cfg->vncTLSx509certdir = g_strdup("/etc/pki/libvirt-vnc"); + VIR_FREE(cfg->spiceTLSx509certdir); + cfg->spiceTLSx509certdir = g_strdup("/etc/pki/libvirt-spice"); + VIR_FREE(cfg->chardevTLSx509certdir); + cfg->chardevTLSx509certdir = g_strdup("/etc/pki/libvirt-chardev"); + VIR_FREE(cfg->vxhsTLSx509certdir); + cfg->vxhsTLSx509certdir = g_strdup("/etc/pki/libvirt-vxhs/dummy,path"); + VIR_FREE(cfg->nbdTLSx509certdir); + cfg->nbdTLSx509certdir = g_strdup("/etc/pki/libvirt-nbd/dummy,path"); + + VIR_FREE(cfg->vncSASLdir); + cfg->vncSASLdir = g_strdup("/root/.sasl2"); + VIR_FREE(cfg->spiceSASLdir); + cfg->spiceSASLdir = g_strdup("/root/.sasl2"); + + VIR_FREE(cfg->spicePassword); + cfg->spicePassword = g_strdup("123456"); + + VIR_FREE(cfg->hugetlbfs); + cfg->hugetlbfs = g_new0(virHugeTLBFS, 2); + cfg->nhugetlbfs = 2; + cfg->hugetlbfs[0].mnt_dir = g_strdup("/dev/hugepages2M"); + cfg->hugetlbfs[1].mnt_dir = g_strdup("/dev/hugepages1G"); + cfg->hugetlbfs[0].size = 2048; + cfg->hugetlbfs[0].deflt = true; + cfg->hugetlbfs[1].size = 1048576; + driver->privileged = true; return 0;