提交 aa3b2e40 编写于 作者: J Jiri Denemark

tests: Fake host capabilities properly

Since we fake host CPU we should also fake host arch instead of taking
the real architecture tests are running on.
上级 c106a837
#include <config.h> #include <config.h>
#ifdef WITH_QEMU #ifdef WITH_QEMU
# include <sys/utsname.h>
# include <stdlib.h> # include <stdlib.h>
# include "testutilsqemu.h" # include "testutilsqemu.h"
...@@ -57,7 +56,6 @@ static virCapsGuestMachinePtr *testQemuAllocNewerMachines(int *nmachines) ...@@ -57,7 +56,6 @@ static virCapsGuestMachinePtr *testQemuAllocNewerMachines(int *nmachines)
} }
virCapsPtr testQemuCapsInit(void) { virCapsPtr testQemuCapsInit(void) {
struct utsname utsname;
virCapsPtr caps; virCapsPtr caps;
virCapsGuestPtr guest; virCapsGuestPtr guest;
virCapsGuestMachinePtr *machines = NULL; virCapsGuestMachinePtr *machines = NULL;
...@@ -94,8 +92,7 @@ virCapsPtr testQemuCapsInit(void) { ...@@ -94,8 +92,7 @@ virCapsPtr testQemuCapsInit(void) {
host_cpu_features /* features */ host_cpu_features /* features */
}; };
uname (&utsname); if ((caps = virCapabilitiesNew(host_cpu.arch,
if ((caps = virCapabilitiesNew(utsname.machine,
0, 0)) == NULL) 0, 0)) == NULL)
return NULL; return NULL;
...@@ -107,7 +104,8 @@ virCapsPtr testQemuCapsInit(void) { ...@@ -107,7 +104,8 @@ virCapsPtr testQemuCapsInit(void) {
if ((guest = virCapabilitiesAddGuest(caps, "hvm", "i686", 32, if ((guest = virCapabilitiesAddGuest(caps, "hvm", "i686", 32,
"/usr/bin/qemu", NULL, "/usr/bin/qemu", NULL,
nmachines, machines)) == NULL) nmachines, machines)) == NULL ||
!virCapabilitiesAddGuestFeature(guest, "cpuselection", 1, 0))
goto cleanup; goto cleanup;
machines = NULL; machines = NULL;
...@@ -124,7 +122,8 @@ virCapsPtr testQemuCapsInit(void) { ...@@ -124,7 +122,8 @@ virCapsPtr testQemuCapsInit(void) {
if ((guest = virCapabilitiesAddGuest(caps, "hvm", "x86_64", 64, if ((guest = virCapabilitiesAddGuest(caps, "hvm", "x86_64", 64,
"/usr/bin/qemu-system-x86_64", NULL, "/usr/bin/qemu-system-x86_64", NULL,
nmachines, machines)) == NULL) nmachines, machines)) == NULL ||
!virCapabilitiesAddGuestFeature(guest, "cpuselection", 1, 0))
goto cleanup; goto cleanup;
machines = NULL; machines = NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册