From b34e0820793d9861c406ba719e79be1f257054a1 Mon Sep 17 00:00:00 2001 From: Jiri Denemark Date: Fri, 16 Apr 2010 08:01:59 +0200 Subject: [PATCH] Fake host CPU for qemu tests --- tests/testutilsqemu.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index 8dd26d4829..e0e5e14d5f 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -6,6 +6,7 @@ # include "testutilsqemu.h" # include "testutils.h" # include "memory.h" +# include "cpu_conf.h" static virCapsGuestMachinePtr *testQemuAllocMachines(int *nmachines) { @@ -62,13 +63,40 @@ virCapsPtr testQemuCapsInit(void) { static const char *const xen_machines[] = { "xenner" }; + static virCPUFeatureDef host_cpu_features[] = { + { (char *) "lahf_lm", -1 }, + { (char *) "xtpr", -1 }, + { (char *) "cx16", -1 }, + { (char *) "tm2", -1 }, + { (char *) "est", -1 }, + { (char *) "vmx", -1 }, + { (char *) "ds_cpl", -1 }, + { (char *) "pbe", -1 }, + { (char *) "tm", -1 }, + { (char *) "ht", -1 }, + { (char *) "ss", -1 }, + { (char *) "acpi", -1 }, + { (char *) "ds", -1 } + }; + static virCPUDef host_cpu = { + VIR_CPU_TYPE_HOST, /* type */ + 0, /* match */ + (char *) "x86_64", /* arch */ + (char *) "core2duo", /* model */ + 1, /* sockets */ + 2, /* cores */ + 1, /* threads */ + ARRAY_CARDINALITY(host_cpu_features), /* nfeatures */ + host_cpu_features /* features */ + }; uname (&utsname); if ((caps = virCapabilitiesNew(utsname.machine, 0, 0)) == NULL) return NULL; - if ((machines = testQemuAllocMachines(&nmachines)) == NULL) + if ((caps->host.cpu = virCPUDefCopy(&host_cpu)) == NULL || + (machines = testQemuAllocMachines(&nmachines)) == NULL) goto cleanup; if ((guest = virCapabilitiesAddGuest(caps, "hvm", "i686", 32, -- GitLab