1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00
libvirt/tests/bhyveargv2xmlmock.c
Daniel P. Berrangé e90a643c90 tests: avoid probing host CPU from bhyve test
bhyveargv2xmlmock calls virBhyveCapsBuild which in turn
calls virCPUProbeHost, probing the real host CPU. This
causes a test failure if the host CPU happens to contain
the 'arch-capabilities' feature as it triggers a call
to virHostCPUGetMSR() which fails on FreeBSD.

Fortunately we already have convenient code for mocking
the host CPU probing.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-01-09 18:05:17 +00:00

36 lines
711 B
C

#include <config.h>
#include "virnetdev.h"
#include "internal.h"
#include "testutilshostcpus.h"
#include "util/viruuid.h"
#include "cpu/cpu.h"
#define VIR_FROM_THIS VIR_FROM_BHYVE
void
virMacAddrGenerate(const unsigned char prefix[VIR_MAC_PREFIX_BUFLEN],
virMacAddrPtr addr)
{
addr->addr[0] = prefix[0];
addr->addr[1] = prefix[1];
addr->addr[2] = prefix[2];
addr->addr[3] = 0;
addr->addr[4] = 0;
addr->addr[5] = 0;
}
int
virUUIDGenerate(unsigned char *uuid)
{
if (virUUIDParse("c7a5fdbd-edaf-9455-926a-d65c16db1809", uuid) < 0)
return -1;
return 0;
}
virCPUDefPtr
virCPUProbeHost(virArch arch)
{
return testUtilsHostCpusGetDefForArch(arch);
}