]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: Fake host capabilities properly
authorJiri Denemark <jdenemar@redhat.com>
Tue, 15 Feb 2011 14:24:39 +0000 (15:24 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Tue, 15 Feb 2011 21:51:37 +0000 (22:51 +0100)
Since we fake host CPU we should also fake host arch instead of taking
the real architecture tests are running on.

tests/testutilsqemu.c

index bfac307284f5ffa4ca3b360b09ce0495ab428fbd..e3f3696ead65bf5ee40f40ed17c21749991cd7a2 100644 (file)
@@ -1,6 +1,5 @@
 #include <config.h>
 #ifdef WITH_QEMU
-# include <sys/utsname.h>
 # include <stdlib.h>
 
 # include "testutilsqemu.h"
@@ -57,7 +56,6 @@ static virCapsGuestMachinePtr *testQemuAllocNewerMachines(int *nmachines)
 }
 
 virCapsPtr testQemuCapsInit(void) {
-    struct utsname utsname;
     virCapsPtr caps;
     virCapsGuestPtr guest;
     virCapsGuestMachinePtr *machines = NULL;
@@ -94,8 +92,7 @@ virCapsPtr testQemuCapsInit(void) {
         host_cpu_features       /* features */
     };
 
-    uname (&utsname);
-    if ((caps = virCapabilitiesNew(utsname.machine,
+    if ((caps = virCapabilitiesNew(host_cpu.arch,
                                    0, 0)) == NULL)
         return NULL;
 
@@ -107,7 +104,8 @@ virCapsPtr testQemuCapsInit(void) {
 
     if ((guest = virCapabilitiesAddGuest(caps, "hvm", "i686", 32,
                                          "/usr/bin/qemu", NULL,
-                                         nmachines, machines)) == NULL)
+                                         nmachines, machines)) == NULL ||
+        !virCapabilitiesAddGuestFeature(guest, "cpuselection", 1, 0))
         goto cleanup;
     machines = NULL;
 
@@ -124,7 +122,8 @@ virCapsPtr testQemuCapsInit(void) {
 
     if ((guest = virCapabilitiesAddGuest(caps, "hvm", "x86_64", 64,
                                          "/usr/bin/qemu-system-x86_64", NULL,
-                                         nmachines, machines)) == NULL)
+                                         nmachines, machines)) == NULL ||
+        !virCapabilitiesAddGuestFeature(guest, "cpuselection", 1, 0))
         goto cleanup;
     machines = NULL;