]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Fake host CPU for qemu tests
authorJiri Denemark <jdenemar@redhat.com>
Fri, 16 Apr 2010 06:01:59 +0000 (08:01 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Thu, 22 Apr 2010 08:21:05 +0000 (10:21 +0200)
tests/testutilsqemu.c

index 8dd26d48297b5662f434d58370e9991be241833e..e0e5e14d5f7f766c15dbe7cb7c40a1506a265e50 100644 (file)
@@ -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,