mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-01 17:35:17 +00:00
testutils: Write setter for virTestHostArch global variable
As of 47503cc859 we are statically linking libtest_utils.a into qemuhotplugmock.so (see the original commit for reasoning). However, this breaks ASAN on older clang because now qemuhotplugtest has two instances of virTestHostArch global variable. One that comes from the binary itself (which also links with libtest_utils.a) and the other from the mock. Resolve this by making the variable static and introducing getter and setter. Well, the former already exists (as virArchFromHost()) so only the latter is needed. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
29ee8c1d2e
commit
dff4b21585
@ -55,7 +55,7 @@ static size_t testCounter;
|
||||
static virBitmap *testBitmap;
|
||||
static virBitmap *failedTests;
|
||||
|
||||
virArch virTestHostArch = VIR_ARCH_X86_64;
|
||||
static virArch virTestHostArch = VIR_ARCH_X86_64;
|
||||
|
||||
virArch
|
||||
virArchFromHost(void)
|
||||
@ -63,6 +63,11 @@ virArchFromHost(void)
|
||||
return virTestHostArch;
|
||||
}
|
||||
|
||||
void
|
||||
virTestSetHostArch(virArch arch)
|
||||
{
|
||||
virTestHostArch = arch;
|
||||
}
|
||||
|
||||
static int virTestUseTerminalColors(void)
|
||||
{
|
||||
|
@ -35,7 +35,7 @@
|
||||
# error Fix build system
|
||||
#endif
|
||||
|
||||
extern virArch virTestHostArch;
|
||||
void virTestSetHostArch(virArch arch);
|
||||
|
||||
int virTestRun(const char *title,
|
||||
int (*body)(const void *data),
|
||||
|
@ -307,7 +307,7 @@ qemuTestSetHostArch(virQEMUDriver *driver,
|
||||
if (arch == VIR_ARCH_NONE)
|
||||
arch = VIR_ARCH_X86_64;
|
||||
|
||||
virTestHostArch = arch;
|
||||
virTestSetHostArch(arch);
|
||||
driver->hostarch = virArchFromHost();
|
||||
driver->caps->host.arch = virArchFromHost();
|
||||
qemuTestSetHostCPU(driver, arch, NULL);
|
||||
|
Loading…
x
Reference in New Issue
Block a user