mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
qemuxml2argvtest: Setup fake driver only once
Move the setup of the fake driver from testCompareXMLToArgv to 'mymain'. With this we also won't need to reset the fake drivers which was done only partially. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
59d70e3a41
commit
002daa184d
@ -611,7 +611,6 @@ testCompareXMLToArgv(const void *data)
|
||||
int ret = -1;
|
||||
virDomainObj *vm = NULL;
|
||||
virDomainChrSourceDef monitor_chr = { 0 };
|
||||
g_autoptr(virConnect) conn = NULL;
|
||||
virError *err = NULL;
|
||||
g_autofree char *log = NULL;
|
||||
g_autoptr(virCommand) cmd = NULL;
|
||||
@ -646,21 +645,6 @@ testCompareXMLToArgv(const void *data)
|
||||
testUpdateQEMUCapsHostCPUModel(info->qemuCaps, driver.hostarch);
|
||||
}
|
||||
|
||||
if (!(conn = virGetConnect()))
|
||||
goto cleanup;
|
||||
|
||||
conn->secretDriver = &fakeSecretDriver;
|
||||
conn->storageDriver = &fakeStorageDriver;
|
||||
conn->nwfilterDriver = &fakeNWFilterDriver;
|
||||
conn->networkDriver = &fakeNetworkDriver;
|
||||
|
||||
virSetConnectInterface(conn);
|
||||
virSetConnectNetwork(conn);
|
||||
virSetConnectNWFilter(conn);
|
||||
virSetConnectNodeDev(conn);
|
||||
virSetConnectSecret(conn);
|
||||
virSetConnectStorage(conn);
|
||||
|
||||
if (virIdentitySetCurrent(sysident) < 0)
|
||||
goto cleanup;
|
||||
|
||||
@ -788,8 +772,6 @@ testCompareXMLToArgv(const void *data)
|
||||
virDomainChrSourceDefClear(&monitor_chr);
|
||||
virObjectUnref(vm);
|
||||
virIdentitySetCurrent(NULL);
|
||||
virSetConnectSecret(NULL);
|
||||
virSetConnectStorage(NULL);
|
||||
if (info->arch != VIR_ARCH_NONE && info->arch != VIR_ARCH_X86_64)
|
||||
qemuTestSetHostArch(&driver, VIR_ARCH_NONE);
|
||||
|
||||
@ -873,6 +855,7 @@ static int
|
||||
mymain(void)
|
||||
{
|
||||
int ret = 0;
|
||||
g_autoptr(virConnect) conn = NULL;
|
||||
g_autoptr(GHashTable) duplicateTests = virHashNew(NULL);
|
||||
g_autoptr(GHashTable) existingTestCases = virHashNew(NULL);
|
||||
g_autoptr(GHashTable) capslatest = testQemuGetLatestCaps();
|
||||
@ -924,6 +907,21 @@ mymain(void)
|
||||
virFileWrapperAddPrefix("/usr/libexec/qemu/vhost-user",
|
||||
abs_srcdir "/qemuvhostuserdata/usr/libexec/qemu/vhost-user");
|
||||
|
||||
if (!(conn = virGetConnect()))
|
||||
return EXIT_FAILURE;
|
||||
|
||||
conn->secretDriver = &fakeSecretDriver;
|
||||
conn->storageDriver = &fakeStorageDriver;
|
||||
conn->nwfilterDriver = &fakeNWFilterDriver;
|
||||
conn->networkDriver = &fakeNetworkDriver;
|
||||
|
||||
virSetConnectInterface(conn);
|
||||
virSetConnectNetwork(conn);
|
||||
virSetConnectNWFilter(conn);
|
||||
virSetConnectNodeDev(conn);
|
||||
virSetConnectSecret(conn);
|
||||
virSetConnectStorage(conn);
|
||||
|
||||
/**
|
||||
* The following set of macros allows testing of XML -> argv conversion with a
|
||||
* real set of capabilities gathered from a real qemu copy. It is desired to use
|
||||
|
Loading…
Reference in New Issue
Block a user