[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 1/6] Fake host CPU for qemu tests



---
 tests/testutilsqemu.c |   30 +++++++++++++++++++++++++++++-
 1 files changed, 29 insertions(+), 1 deletions(-)

diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index 8dd26d4..e0e5e14 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,
-- 
1.7.0.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]