提交 4ed727a0 编写于 作者: J Ján Tomko

tests: turn skipLegacyCPUs into a flag

Make it obvious when it is used intentionally and error
out when used in combination with real capabilities.
Signed-off-by: NJán Tomko <jtomko@redhat.com>
上级 c9e5be4e
...@@ -295,6 +295,7 @@ typedef enum { ...@@ -295,6 +295,7 @@ typedef enum {
FLAG_FIPS = 1 << 2, FLAG_FIPS = 1 << 2,
FLAG_STEAL_VM = 1 << 3, FLAG_STEAL_VM = 1 << 3,
FLAG_REAL_CAPS = 1 << 4, FLAG_REAL_CAPS = 1 << 4,
FLAG_SKIP_LEGACY_CPUS = 1 << 5,
} virQemuXML2ArgvTestFlags; } virQemuXML2ArgvTestFlags;
struct testInfo { struct testInfo {
...@@ -305,7 +306,6 @@ struct testInfo { ...@@ -305,7 +306,6 @@ struct testInfo {
int migrateFd; int migrateFd;
unsigned int flags; unsigned int flags;
unsigned int parseFlags; unsigned int parseFlags;
bool skipLegacyCPUs;
virDomainObjPtr vm; virDomainObjPtr vm;
}; };
...@@ -414,7 +414,8 @@ testUpdateQEMUCaps(const struct testInfo *info, ...@@ -414,7 +414,8 @@ testUpdateQEMUCaps(const struct testInfo *info,
virQEMUCapsInitQMPBasicArch(info->qemuCaps); virQEMUCapsInitQMPBasicArch(info->qemuCaps);
if (testAddCPUModels(info->qemuCaps, info->skipLegacyCPUs) < 0) if (testAddCPUModels(info->qemuCaps,
!!(info->flags & FLAG_SKIP_LEGACY_CPUS)) < 0)
goto cleanup; goto cleanup;
virQEMUCapsFreeHostCPUModel(info->qemuCaps, caps->host.arch, virQEMUCapsFreeHostCPUModel(info->qemuCaps, caps->host.arch,
...@@ -472,10 +473,12 @@ testCheckExclusiveFlags(int flags) ...@@ -472,10 +473,12 @@ testCheckExclusiveFlags(int flags)
FLAG_FIPS | FLAG_FIPS |
FLAG_STEAL_VM | FLAG_STEAL_VM |
FLAG_REAL_CAPS | FLAG_REAL_CAPS |
FLAG_SKIP_LEGACY_CPUS |
0, -1); 0, -1);
VIR_EXCLUSIVE_FLAGS_RET(FLAG_STEAL_VM, FLAG_EXPECT_FAILURE, -1); VIR_EXCLUSIVE_FLAGS_RET(FLAG_STEAL_VM, FLAG_EXPECT_FAILURE, -1);
VIR_EXCLUSIVE_FLAGS_RET(FLAG_STEAL_VM, FLAG_EXPECT_PARSE_ERROR, -1); VIR_EXCLUSIVE_FLAGS_RET(FLAG_STEAL_VM, FLAG_EXPECT_PARSE_ERROR, -1);
VIR_EXCLUSIVE_FLAGS_RET(FLAG_REAL_CAPS, FLAG_SKIP_LEGACY_CPUS, -1);
return 0; return 0;
} }
...@@ -672,7 +675,6 @@ mymain(void) ...@@ -672,7 +675,6 @@ mymain(void)
{ {
int ret = 0, i; int ret = 0, i;
char *fakerootdir; char *fakerootdir;
bool skipLegacyCPUs = false;
const char *archs[] = { const char *archs[] = {
"aarch64", "aarch64",
"ppc64", "ppc64",
...@@ -786,9 +788,8 @@ mymain(void) ...@@ -786,9 +788,8 @@ mymain(void)
do { \ do { \
static struct testInfo info = { \ static struct testInfo info = { \
name, "." suffix, NULL, migrateFrom, migrateFrom ? 7 : -1,\ name, "." suffix, NULL, migrateFrom, migrateFrom ? 7 : -1,\
(flags | FLAG_REAL_CAPS), parseFlags, false, NULL \ (flags | FLAG_REAL_CAPS), parseFlags, NULL \
}; \ }; \
info.skipLegacyCPUs = skipLegacyCPUs; \
if (!(info.qemuCaps = qemuTestParseCapabilitiesArch(virArchFromString(arch), \ if (!(info.qemuCaps = qemuTestParseCapabilitiesArch(virArchFromString(arch), \
capsfile))) \ capsfile))) \
return EXIT_FAILURE; \ return EXIT_FAILURE; \
...@@ -835,9 +836,8 @@ mymain(void) ...@@ -835,9 +836,8 @@ mymain(void)
do { \ do { \
static struct testInfo info = { \ static struct testInfo info = { \
name, NULL, NULL, migrateFrom, migrateFd, (flags), parseFlags, \ name, NULL, NULL, migrateFrom, migrateFd, (flags), parseFlags, \
false, NULL \ NULL \
}; \ }; \
info.skipLegacyCPUs = skipLegacyCPUs; \
if (testInitQEMUCaps(&info, gic) < 0) \ if (testInitQEMUCaps(&info, gic) < 0) \
return EXIT_FAILURE; \ return EXIT_FAILURE; \
virQEMUCapsSetList(info.qemuCaps, __VA_ARGS__, QEMU_CAPS_LAST); \ virQEMUCapsSetList(info.qemuCaps, __VA_ARGS__, QEMU_CAPS_LAST); \
...@@ -1749,10 +1749,12 @@ mymain(void) ...@@ -1749,10 +1749,12 @@ mymain(void)
DO_TEST("cpu-numa-memshared", QEMU_CAPS_OBJECT_MEMORY_FILE); DO_TEST("cpu-numa-memshared", QEMU_CAPS_OBJECT_MEMORY_FILE);
DO_TEST("cpu-host-model", NONE); DO_TEST("cpu-host-model", NONE);
DO_TEST("cpu-host-model-vendor", NONE); DO_TEST("cpu-host-model-vendor", NONE);
skipLegacyCPUs = true; DO_TEST_FULL("cpu-host-model-fallback", NULL, -1,
DO_TEST("cpu-host-model-fallback", NONE); FLAG_SKIP_LEGACY_CPUS, 0,
DO_TEST_FAILURE("cpu-host-model-nofallback", NONE); GIC_NONE, NONE);
skipLegacyCPUs = false; DO_TEST_FULL("cpu-host-model-nofallback", NULL, -1,
FLAG_SKIP_LEGACY_CPUS | FLAG_EXPECT_FAILURE,
0, GIC_NONE, NONE);
DO_TEST("cpu-host-passthrough", QEMU_CAPS_KVM); DO_TEST("cpu-host-passthrough", QEMU_CAPS_KVM);
DO_TEST_FAILURE("cpu-qemu-host-passthrough", QEMU_CAPS_KVM); DO_TEST_FAILURE("cpu-qemu-host-passthrough", QEMU_CAPS_KVM);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册