[PATCH v2 00/23] tests: qemu: Don't crash when capability file can't be parsed

The original patch was replaced. A nice side effect of this series is substantial improvement of compile times for: qemuxml2xmltest 15.8s -> 1.3s qemuxml2argvtest 6.4s -> 1.8s In addition this also cleans up the messy parsing of fake caps and removes the somewhat ambiguous NONE macro. Peter Krempa (23): qemu: capabilities: Remove virQEMUCapsSetList qemuxml2argvtest: Add 'ARG_END' from higher level macros qemuxml2argvtest: Fix broken invocation of "pseries-spaprvio-invalid" qemuxml2argvtest: Fix broken invocation of "aarch64-tpm-wrong-model" testQemuInfoSetArgs: Always allocate 'info->qemuCaps' qemustatusxml2xmltest: Remove hack for qemuCaps allocation qemuxml2argvtest: Add QEMU_CAPS_LAST in places where ARG_QEMU_CAPS is used qemuxml2argvtest: Rename DO_TEST_INTERNAL to DO_TEST_FULL and fix users qemuxml2argvtest: Add 'DO_TEST_NOCAPS' to replace 'DO_TEST("blah", NONE);' qemuxml2argvtest: Add 'DO_TEST_PARSE_ERROR_NOCAPS' to replace 'DO_TEST_PARSE_ERROR("blah", NONE);' qemuxml2argvtest: Add 'DO_TEST_FAILURE_NOCAPS' to replace 'DO_TEST_FAILURE("blah", NONE);' qemuxml2xmltest: Add 'ARG_END' from higher level macros qemuxml2xmltest: Rename DO_TEST_INTERNAL to DO_TEST_FULL and fix users qemuxml2xmltest: Remove hack for qemuCaps allocation qemuxml2xmltest: Add 'DO_TEST_NOCAPS' to replace 'DO_TEST("blah", NONE);' qemuxml2xmltest: Remove 'NONE' macro testutilsqemu: Ensure that ARG_* macros are out of range of QEMU_CAPS_* testQemuInfoSetArgs: Remove hack for double QEMU_CAPS_LAST in caps list testQemuInfoSetArgs: Move argument fetching to the loop testutilsqemu: Introduce struct to hold data valid for all test runs testutilsqemu: Improve error propagation from 'testQemuInfoSetArgs' qemuxml2argvtest: Avoid conditions in test macro qemuxml2xmltesttest: Avoid conditions in test macro src/qemu/qemu_capabilities.c | 13 - src/qemu/qemu_capabilities.h | 2 - tests/qemustatusxml2xmltest.c | 21 +- tests/qemuxml2argvtest.c | 666 +++++++++++++++++----------------- tests/qemuxml2xmltest.c | 578 ++++++++++++++--------------- tests/testutilsqemu.c | 140 ++++--- tests/testutilsqemu.h | 30 +- 7 files changed, 706 insertions(+), 744 deletions(-) -- 2.31.1

Unused since 90540a37bee647d4f94d263a3ba1b39f2407880d Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_capabilities.c | 13 ------------- src/qemu/qemu_capabilities.h | 2 -- 2 files changed, 15 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 9558938866..537c460286 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2043,19 +2043,6 @@ virQEMUCapsSet(virQEMUCaps *qemuCaps, } -void -virQEMUCapsSetList(virQEMUCaps *qemuCaps, ...) -{ - va_list list; - int flag; - - va_start(list, qemuCaps); - while ((flag = va_arg(list, int)) < QEMU_CAPS_LAST) - virQEMUCapsSet(qemuCaps, flag); - va_end(list); -} - - void virQEMUCapsClear(virQEMUCaps *qemuCaps, virQEMUCapsFlags flag) diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 2b1bb57a49..511379db18 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -631,8 +631,6 @@ virQEMUCaps *virQEMUCapsNewBinary(const char *binary); void virQEMUCapsSet(virQEMUCaps *qemuCaps, virQEMUCapsFlags flag) ATTRIBUTE_NONNULL(1); -void virQEMUCapsSetList(virQEMUCaps *qemuCaps, ...) ATTRIBUTE_NONNULL(1); - void virQEMUCapsClear(virQEMUCaps *qemuCaps, virQEMUCapsFlags flag) ATTRIBUTE_NONNULL(1); -- 2.31.1

Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/qemuxml2argvtest.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 2754a8a780..85973a2298 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -943,7 +943,7 @@ mymain(void) }; \ info.qapiSchemaCache = qapiSchemaCache; \ if (testQemuInfoSetArgs(&info, capscache, capslatest, \ - __VA_ARGS__, ARG_END) < 0) \ + __VA_ARGS__) < 0) \ ret = -1; \ testInfoSetPaths(&info, _suffix); \ if (virTestRun("QEMU XML-2-ARGV " _name _suffix, \ @@ -956,7 +956,8 @@ mymain(void) DO_TEST_INTERNAL(name, "." arch "-" ver, \ ARG_CAPS_ARCH, arch, \ ARG_CAPS_VER, ver, \ - __VA_ARGS__) + __VA_ARGS__, \ + ARG_END) # define DO_TEST_CAPS_ARCH_LATEST_FULL(name, arch, ...) \ DO_TEST_CAPS_INTERNAL(name, arch, "latest", __VA_ARGS__) @@ -1009,7 +1010,7 @@ mymain(void) # define DO_TEST_FULL(name, ...) \ DO_TEST_INTERNAL(name, "", \ - __VA_ARGS__, QEMU_CAPS_LAST) + __VA_ARGS__, QEMU_CAPS_LAST, ARG_END) /* All the following macros require an explicit QEMU_CAPS_* list * at the end of the argument list, or the NONE placeholder. -- 2.31.1

The string "ppc64" is passed in place of capability flags. We were lucky that the pointer was always more than QEMU_CAPS_LAST. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/qemuxml2argvtest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 85973a2298..5977f77b86 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2412,7 +2412,7 @@ mymain(void) DO_TEST("pseries-console-virtio", QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE); DO_TEST_PARSE_ERROR("pseries-serial-invalid-machine", NONE); - DO_TEST_PARSE_ERROR("pseries-spaprvio-invalid", "ppc64"); + DO_TEST_PARSE_ERROR("pseries-spaprvio-invalid", NONE); DO_TEST("mach-virt-serial-native", QEMU_CAPS_DEVICE_PL011); -- 2.31.1

The string "aarch64" is passed in place of capability flags. We were lucky that the pointer was always more than QEMU_CAPS_LAST. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/qemuxml2argvtest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 5977f77b86..6a3fa4c152 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2571,7 +2571,7 @@ mymain(void) DO_TEST_CAPS_LATEST("tpm-emulator-tpm2-pstate"); DO_TEST_CAPS_LATEST_PPC64("tpm-emulator-spapr"); DO_TEST_CAPS_ARCH_LATEST("aarch64-tpm", "aarch64"); - DO_TEST_PARSE_ERROR("aarch64-tpm-wrong-model", "aarch64"); + DO_TEST_PARSE_ERROR("aarch64-tpm-wrong-model", NONE); DO_TEST_PARSE_ERROR("pci-domain-invalid", NONE); DO_TEST_PARSE_ERROR("pci-bus-invalid", NONE); -- 2.31.1

Modify the logic so that 'info->qemuCaps' is populated, but empty even when ARG_QEMU_CAPS was not used. The function still retains the interlocking of fake caps with real caps. A lot of the internal code expects qemuCaps to be populated and many tests work this around by using ARG_QEMU_CAPS with no caps. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/testutilsqemu.c | 44 ++++++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index 9a0666724a..32119e30c2 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -684,7 +684,8 @@ testQemuInfoSetArgs(struct testQemuInfo *info, { va_list argptr; testQemuInfoArgName argname; - virQEMUCaps *qemuCaps = NULL; + g_autoptr(virQEMUCaps) fakeCaps = virQEMUCapsNew(); + bool fakeCapsUsed = false; int gic = GIC_NONE; char *capsarch = NULL; char *capsver = NULL; @@ -692,16 +693,18 @@ testQemuInfoSetArgs(struct testQemuInfo *info, int flag; int ret = -1; + if (!fakeCaps) + abort(); + va_start(argptr, capslatest); argname = va_arg(argptr, testQemuInfoArgName); while (argname != ARG_END) { switch (argname) { case ARG_QEMU_CAPS: - if (qemuCaps || !(qemuCaps = virQEMUCapsNew())) - goto cleanup; + fakeCapsUsed = true; while ((flag = va_arg(argptr, int)) < QEMU_CAPS_LAST) - virQEMUCapsSet(qemuCaps, flag); + virQEMUCapsSet(fakeCaps, flag); /* Some tests are run with NONE capabilities, which is just * another name for QEMU_CAPS_LAST. If that is the case the @@ -764,16 +767,16 @@ testQemuInfoSetArgs(struct testQemuInfo *info, goto cleanup; } - if (qemuCaps && (capsarch || capsver)) { - fprintf(stderr, "ARG_QEMU_CAPS can not be combined with ARG_CAPS_ARCH " - "or ARG_CAPS_VER\n"); - goto cleanup; - } - - if (!qemuCaps && capsarch && capsver) { + if (capsarch && capsver) { bool stripmachinealiases = false; virQEMUCaps *cachedcaps = NULL; + if (fakeCapsUsed) { + fprintf(stderr, "ARG_QEMU_CAPS can not be combined with ARG_CAPS_ARCH " + "or ARG_CAPS_VER\n"); + goto cleanup; + } + info->arch = virArchFromString(capsarch); if (STREQ(capsver, "latest")) { @@ -785,40 +788,33 @@ testQemuInfoSetArgs(struct testQemuInfo *info, } if (!g_hash_table_lookup_extended(capscache, capsfile, NULL, (void **) &cachedcaps)) { - if (!(qemuCaps = qemuTestParseCapabilitiesArch(info->arch, capsfile))) + if (!(cachedcaps = qemuTestParseCapabilitiesArch(info->arch, capsfile))) goto cleanup; - cachedcaps = qemuCaps; - - g_hash_table_insert(capscache, g_strdup(capsfile), g_steal_pointer(&qemuCaps)); + g_hash_table_insert(capscache, g_strdup(capsfile), cachedcaps); } - if (!(qemuCaps = virQEMUCapsNewCopy(cachedcaps))) + if (!(info->qemuCaps = virQEMUCapsNewCopy(cachedcaps))) goto cleanup; if (stripmachinealiases) - virQEMUCapsStripMachineAliases(qemuCaps); + virQEMUCapsStripMachineAliases(info->qemuCaps); info->flags |= FLAG_REAL_CAPS; /* provide path to the replies file for schema testing */ capsfile[strlen(capsfile) - 3] = '\0'; info->schemafile = g_strdup_printf("%sreplies", capsfile); + } else { + info->qemuCaps = g_steal_pointer(&fakeCaps); } - if (!qemuCaps) { - fprintf(stderr, "No qemuCaps generated\n"); - goto cleanup; - } - info->qemuCaps = g_steal_pointer(&qemuCaps); - if (gic != GIC_NONE && testQemuCapsSetGIC(info->qemuCaps, gic) < 0) goto cleanup; ret = 0; cleanup: - virObjectUnref(qemuCaps); va_end(argptr); return ret; -- 2.31.1

Since qemuCaps are now always allocated we don't need the hack. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/qemustatusxml2xmltest.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/qemustatusxml2xmltest.c b/tests/qemustatusxml2xmltest.c index 63fbaa0ddb..ac007405a6 100644 --- a/tests/qemustatusxml2xmltest.c +++ b/tests/qemustatusxml2xmltest.c @@ -110,9 +110,7 @@ mymain(void) static struct testQemuInfo info = { \ .name = _name, \ }; \ - if (testQemuInfoSetArgs(&info, capscache, capslatest, \ - ARG_QEMU_CAPS, QEMU_CAPS_LAST, \ - ARG_END) < 0 || \ + if (testQemuInfoSetArgs(&info, capscache, capslatest, ARG_END) < 0 || \ qemuTestCapsCacheInsert(driver.qemuCapsCache, info.qemuCaps) < 0) { \ VIR_TEST_DEBUG("Failed to generate status test data for '%s'", _name); \ return -1; \ -- 2.31.1

The 'DO_TEST_FULL' macro was ending the argument list which was being started in other macros. Move it so that 'ARG_QEMU_CAPS' and 'QEMU_CAPS_LAST' are always used in the same macro. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/qemuxml2argvtest.c | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 6a3fa4c152..6162ebf3bb 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1010,29 +1010,29 @@ mymain(void) # define DO_TEST_FULL(name, ...) \ DO_TEST_INTERNAL(name, "", \ - __VA_ARGS__, QEMU_CAPS_LAST, ARG_END) + __VA_ARGS__, ARG_END) /* All the following macros require an explicit QEMU_CAPS_* list * at the end of the argument list, or the NONE placeholder. * */ # define DO_TEST(name, ...) \ DO_TEST_FULL(name, \ - ARG_QEMU_CAPS, __VA_ARGS__) + ARG_QEMU_CAPS, __VA_ARGS__, QEMU_CAPS_LAST) # define DO_TEST_GIC(name, gic, ...) \ DO_TEST_FULL(name, \ ARG_GIC, gic, \ - ARG_QEMU_CAPS, __VA_ARGS__) + ARG_QEMU_CAPS, __VA_ARGS__, QEMU_CAPS_LAST) # define DO_TEST_FAILURE(name, ...) \ DO_TEST_FULL(name, \ ARG_FLAGS, FLAG_EXPECT_FAILURE, \ - ARG_QEMU_CAPS, __VA_ARGS__) + ARG_QEMU_CAPS, __VA_ARGS__, QEMU_CAPS_LAST) # define DO_TEST_PARSE_ERROR(name, ...) \ DO_TEST_FULL(name, \ ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR | FLAG_EXPECT_FAILURE, \ - ARG_QEMU_CAPS, __VA_ARGS__) + ARG_QEMU_CAPS, __VA_ARGS__, QEMU_CAPS_LAST) # define NONE QEMU_CAPS_LAST @@ -2016,26 +2016,23 @@ mymain(void) DO_TEST_FULL("restore-v2", ARG_MIGRATE_FROM, "exec:cat", - ARG_MIGRATE_FD, 7, - ARG_QEMU_CAPS, NONE); + ARG_MIGRATE_FD, 7); DO_TEST_FULL("restore-v2-fd", ARG_MIGRATE_FROM, "stdio", - ARG_MIGRATE_FD, 7, - ARG_QEMU_CAPS, NONE); + ARG_MIGRATE_FD, 7); DO_TEST_FULL("restore-v2-fd", ARG_MIGRATE_FROM, "fd:7", - ARG_MIGRATE_FD, 7, - ARG_QEMU_CAPS, NONE); + ARG_MIGRATE_FD, 7); DO_TEST_FULL("migrate", - ARG_MIGRATE_FROM, "tcp:10.0.0.1:5000", - ARG_QEMU_CAPS, NONE); + ARG_MIGRATE_FROM, "tcp:10.0.0.1:5000"); DO_TEST_FULL("migrate-numa-unaligned", ARG_MIGRATE_FROM, "stdio", ARG_MIGRATE_FD, 7, ARG_QEMU_CAPS, QEMU_CAPS_NUMA, - QEMU_CAPS_OBJECT_MEMORY_RAM); + QEMU_CAPS_OBJECT_MEMORY_RAM, + QEMU_CAPS_LAST); DO_TEST_CAPS_VER("qemu-ns", "4.0.0"); DO_TEST_CAPS_LATEST("qemu-ns"); @@ -2080,11 +2077,9 @@ mymain(void) DO_TEST("cpu-host-model", NONE); DO_TEST("cpu-host-model-vendor", NONE); DO_TEST_FULL("cpu-host-model-fallback", - ARG_FLAGS, FLAG_SKIP_LEGACY_CPUS, - ARG_QEMU_CAPS, NONE); + ARG_FLAGS, FLAG_SKIP_LEGACY_CPUS); DO_TEST_FULL("cpu-host-model-nofallback", - ARG_FLAGS, FLAG_SKIP_LEGACY_CPUS | FLAG_EXPECT_FAILURE, - ARG_QEMU_CAPS, NONE); + ARG_FLAGS, FLAG_SKIP_LEGACY_CPUS | FLAG_EXPECT_FAILURE); DO_TEST("cpu-host-passthrough", QEMU_CAPS_KVM); DO_TEST_FAILURE("cpu-qemu-host-passthrough", QEMU_CAPS_KVM); @@ -3111,7 +3106,8 @@ mymain(void) QEMU_CAPS_KVM, QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA, QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, QEMU_CAPS_OBJECT_MEMORY_RAM, - QEMU_CAPS_OBJECT_MEMORY_FILE); + QEMU_CAPS_OBJECT_MEMORY_FILE, + QEMU_CAPS_LAST); DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm"); DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm-access"); DO_TEST_CAPS_VER("memory-hotplug-nvdimm-label", "5.2.0"); @@ -3248,7 +3244,8 @@ mymain(void) ARG_QEMU_CAPS, QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, QEMU_CAPS_NEC_USB_XHCI, - QEMU_CAPS_DEVICE_QEMU_XHCI); + QEMU_CAPS_DEVICE_QEMU_XHCI, + QEMU_CAPS_LAST); DO_TEST_PARSE_ERROR("ppc64-tpmproxy-double", QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, @@ -3285,8 +3282,7 @@ mymain(void) */ DO_TEST_FULL("missing-machine", ARG_FLAGS, FLAG_EXPECT_FAILURE, - ARG_PARSEFLAGS, VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE, - ARG_QEMU_CAPS, NONE); + ARG_PARSEFLAGS, VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE); DO_TEST("name-escape", QEMU_CAPS_NAME_DEBUG_THREADS, -- 2.31.1

'DO_TEST_FULL' isn't a useful wrapper any more. Use the better name for the main macro and replace all uses. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/qemuxml2argvtest.c | 83 +++++++++++++++++++++------------------- 1 file changed, 43 insertions(+), 40 deletions(-) diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 6162ebf3bb..6869eb6d86 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -936,7 +936,7 @@ mymain(void) * the test cases should be forked using DO_TEST_CAPS_VER with the appropriate * version. */ -# define DO_TEST_INTERNAL(_name, _suffix, ...) \ +# define DO_TEST_FULL(_name, _suffix, ...) \ do { \ static struct testQemuInfo info = { \ .name = _name, \ @@ -953,11 +953,11 @@ mymain(void) } while (0) # define DO_TEST_CAPS_INTERNAL(name, arch, ver, ...) \ - DO_TEST_INTERNAL(name, "." arch "-" ver, \ - ARG_CAPS_ARCH, arch, \ - ARG_CAPS_VER, ver, \ - __VA_ARGS__, \ - ARG_END) + DO_TEST_FULL(name, "." arch "-" ver, \ + ARG_CAPS_ARCH, arch, \ + ARG_CAPS_VER, ver, \ + __VA_ARGS__, \ + ARG_END) # define DO_TEST_CAPS_ARCH_LATEST_FULL(name, arch, ...) \ DO_TEST_CAPS_INTERNAL(name, arch, "latest", __VA_ARGS__) @@ -1008,31 +1008,26 @@ mymain(void) # define DO_TEST_CAPS_VER_PARSE_ERROR(name, ver) \ DO_TEST_CAPS_ARCH_VER_PARSE_ERROR(name, "x86_64", ver) -# define DO_TEST_FULL(name, ...) \ - DO_TEST_INTERNAL(name, "", \ - __VA_ARGS__, ARG_END) - /* All the following macros require an explicit QEMU_CAPS_* list * at the end of the argument list, or the NONE placeholder. * */ # define DO_TEST(name, ...) \ - DO_TEST_FULL(name, \ - ARG_QEMU_CAPS, __VA_ARGS__, QEMU_CAPS_LAST) + DO_TEST_FULL(name, "", ARG_QEMU_CAPS, __VA_ARGS__, QEMU_CAPS_LAST, ARG_END) # define DO_TEST_GIC(name, gic, ...) \ - DO_TEST_FULL(name, \ + DO_TEST_FULL(name, "", \ ARG_GIC, gic, \ - ARG_QEMU_CAPS, __VA_ARGS__, QEMU_CAPS_LAST) + ARG_QEMU_CAPS, __VA_ARGS__, QEMU_CAPS_LAST, ARG_END) # define DO_TEST_FAILURE(name, ...) \ - DO_TEST_FULL(name, \ + DO_TEST_FULL(name, "", \ ARG_FLAGS, FLAG_EXPECT_FAILURE, \ - ARG_QEMU_CAPS, __VA_ARGS__, QEMU_CAPS_LAST) + ARG_QEMU_CAPS, __VA_ARGS__, QEMU_CAPS_LAST, ARG_END) # define DO_TEST_PARSE_ERROR(name, ...) \ - DO_TEST_FULL(name, \ + DO_TEST_FULL(name, "", \ ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR | FLAG_EXPECT_FAILURE, \ - ARG_QEMU_CAPS, __VA_ARGS__, QEMU_CAPS_LAST) + ARG_QEMU_CAPS, __VA_ARGS__, QEMU_CAPS_LAST, ARG_END) # define NONE QEMU_CAPS_LAST @@ -2014,25 +2009,28 @@ mymain(void) DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR("hostdev-subsys-mdev-vfio-ap-boot-fail", "s390x"); - DO_TEST_FULL("restore-v2", + DO_TEST_FULL("restore-v2", "", ARG_MIGRATE_FROM, "exec:cat", - ARG_MIGRATE_FD, 7); - DO_TEST_FULL("restore-v2-fd", + ARG_MIGRATE_FD, 7, + ARG_END); + DO_TEST_FULL("restore-v2-fd", "", ARG_MIGRATE_FROM, "stdio", - ARG_MIGRATE_FD, 7); - DO_TEST_FULL("restore-v2-fd", + ARG_MIGRATE_FD, 7, + ARG_END); + DO_TEST_FULL("restore-v2-fd", "", ARG_MIGRATE_FROM, "fd:7", - ARG_MIGRATE_FD, 7); - DO_TEST_FULL("migrate", - ARG_MIGRATE_FROM, "tcp:10.0.0.1:5000"); + ARG_MIGRATE_FD, 7, ARG_END); + DO_TEST_FULL("migrate", "", + ARG_MIGRATE_FROM, "tcp:10.0.0.1:5000", ARG_END); - DO_TEST_FULL("migrate-numa-unaligned", + DO_TEST_FULL("migrate-numa-unaligned", "", ARG_MIGRATE_FROM, "stdio", ARG_MIGRATE_FD, 7, ARG_QEMU_CAPS, QEMU_CAPS_NUMA, QEMU_CAPS_OBJECT_MEMORY_RAM, - QEMU_CAPS_LAST); + QEMU_CAPS_LAST, + ARG_END); DO_TEST_CAPS_VER("qemu-ns", "4.0.0"); DO_TEST_CAPS_LATEST("qemu-ns"); @@ -2076,10 +2074,11 @@ mymain(void) DO_TEST("cpu-numa-memshared", QEMU_CAPS_OBJECT_MEMORY_FILE); DO_TEST("cpu-host-model", NONE); DO_TEST("cpu-host-model-vendor", NONE); - DO_TEST_FULL("cpu-host-model-fallback", - ARG_FLAGS, FLAG_SKIP_LEGACY_CPUS); - DO_TEST_FULL("cpu-host-model-nofallback", - ARG_FLAGS, FLAG_SKIP_LEGACY_CPUS | FLAG_EXPECT_FAILURE); + DO_TEST_FULL("cpu-host-model-fallback", "", + ARG_FLAGS, FLAG_SKIP_LEGACY_CPUS, ARG_END); + DO_TEST_FULL("cpu-host-model-nofallback", "", + ARG_FLAGS, FLAG_SKIP_LEGACY_CPUS | FLAG_EXPECT_FAILURE, + ARG_END); DO_TEST("cpu-host-passthrough", QEMU_CAPS_KVM); DO_TEST_FAILURE("cpu-qemu-host-passthrough", QEMU_CAPS_KVM); @@ -3100,14 +3099,15 @@ mymain(void) DO_TEST("memory-hotplug-ppc64-nonuma", QEMU_CAPS_KVM, QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA, QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE); - DO_TEST_FULL("memory-hotplug-ppc64-nonuma-abi-update", + DO_TEST_FULL("memory-hotplug-ppc64-nonuma-abi-update", "", ARG_PARSEFLAGS, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE, ARG_QEMU_CAPS, QEMU_CAPS_KVM, QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA, QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE, - QEMU_CAPS_LAST); + QEMU_CAPS_LAST, + ARG_END); DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm"); DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm-access"); DO_TEST_CAPS_VER("memory-hotplug-nvdimm-label", "5.2.0"); @@ -3121,13 +3121,14 @@ mymain(void) DO_TEST("memory-hotplug-nvdimm-ppc64", QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_DEVICE_NVDIMM); - DO_TEST_FULL("memory-hotplug-nvdimm-ppc64-abi-update", + DO_TEST_FULL("memory-hotplug-nvdimm-ppc64-abi-update", "", ARG_PARSEFLAGS, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE, ARG_QEMU_CAPS, QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_DEVICE_NVDIMM, - QEMU_CAPS_LAST); + QEMU_CAPS_LAST, + ARG_END); DO_TEST_CAPS_VER("memory-hotplug-virtio-pmem", "5.2.0"); DO_TEST_CAPS_LATEST("memory-hotplug-virtio-pmem"); @@ -3239,13 +3240,14 @@ mymain(void) DO_TEST("ppc64-usb-controller-legacy", QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, QEMU_CAPS_PIIX3_USB_UHCI); - DO_TEST_FULL("ppc64-usb-controller-qemu-xhci", + DO_TEST_FULL("ppc64-usb-controller-qemu-xhci", "", ARG_PARSEFLAGS, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE, ARG_QEMU_CAPS, QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, QEMU_CAPS_NEC_USB_XHCI, QEMU_CAPS_DEVICE_QEMU_XHCI, - QEMU_CAPS_LAST); + QEMU_CAPS_LAST, + ARG_END); DO_TEST_PARSE_ERROR("ppc64-tpmproxy-double", QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, @@ -3280,9 +3282,10 @@ mymain(void) * the wrong binary for the arch. We expect to get a failure about * bad arch later when creating the pretend command. */ - DO_TEST_FULL("missing-machine", + DO_TEST_FULL("missing-machine", "", ARG_FLAGS, FLAG_EXPECT_FAILURE, - ARG_PARSEFLAGS, VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE); + ARG_PARSEFLAGS, VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE, + ARG_END); DO_TEST("name-escape", QEMU_CAPS_NAME_DEBUG_THREADS, -- 2.31.1

Add a explicit version of our test invocation macro for tests which use no capabilities. This reduces the usage of the somewhat anonymous 'NONE' macro and will lead to simplification of the code later. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/qemuxml2argvtest.c | 350 ++++++++++++++++++++------------------- 1 file changed, 176 insertions(+), 174 deletions(-) diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 6869eb6d86..bb2534ffc9 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1013,6 +1013,8 @@ mymain(void) * */ # define DO_TEST(name, ...) \ DO_TEST_FULL(name, "", ARG_QEMU_CAPS, __VA_ARGS__, QEMU_CAPS_LAST, ARG_END) +# define DO_TEST_NOCAPS(name) \ + DO_TEST_FULL(name, "", ARG_END) # define DO_TEST_GIC(name, gic, ...) \ DO_TEST_FULL(name, "", \ @@ -1045,7 +1047,7 @@ mymain(void) g_unsetenv("QEMU_AUDIO_DRV"); g_unsetenv("SDL_AUDIODRIVER"); - DO_TEST("minimal", NONE); + DO_TEST_NOCAPS("minimal"); DO_TEST("minimal-sandbox", QEMU_CAPS_SECCOMP_BLACKLIST); DO_TEST_PARSE_ERROR("minimal-no-memory", NONE); @@ -1054,11 +1056,11 @@ mymain(void) DO_TEST_CAPS_LATEST("genid"); DO_TEST_CAPS_LATEST("genid-auto"); - DO_TEST("machine-aliases1", NONE); + DO_TEST_NOCAPS("machine-aliases1"); DO_TEST("machine-aliases2", QEMU_CAPS_KVM); - DO_TEST("machine-core-on", NONE); + DO_TEST_NOCAPS("machine-core-on"); driver.config->dumpGuestCore = true; - DO_TEST("machine-core-off", NONE); + DO_TEST_NOCAPS("machine-core-off"); driver.config->dumpGuestCore = false; DO_TEST("machine-smm-opt", QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, @@ -1068,24 +1070,24 @@ mymain(void) QEMU_CAPS_VIRTIO_SCSI); DO_TEST("machine-vmport-opt", QEMU_CAPS_MACHINE_VMPORT_OPT); - DO_TEST("default-kvm-host-arch", NONE); - DO_TEST("default-qemu-host-arch", NONE); - DO_TEST("x86-kvm-32-on-64", NONE); - DO_TEST("boot-cdrom", NONE); - DO_TEST("boot-network", NONE); - DO_TEST("boot-floppy", NONE); + DO_TEST_NOCAPS("default-kvm-host-arch"); + DO_TEST_NOCAPS("default-qemu-host-arch"); + DO_TEST_NOCAPS("x86-kvm-32-on-64"); + DO_TEST_NOCAPS("boot-cdrom"); + DO_TEST_NOCAPS("boot-network"); + DO_TEST_NOCAPS("boot-floppy"); DO_TEST("boot-floppy-q35", QEMU_CAPS_DEVICE_IOH3420, QEMU_CAPS_ICH9_AHCI); - DO_TEST("boot-multi", NONE); - DO_TEST("boot-menu-enable", NONE); + DO_TEST_NOCAPS("boot-multi"); + DO_TEST_NOCAPS("boot-menu-enable"); DO_TEST("boot-menu-enable-with-timeout", QEMU_CAPS_SPLASH_TIMEOUT); DO_TEST_PARSE_ERROR("boot-menu-enable-with-timeout", NONE); DO_TEST_PARSE_ERROR("boot-menu-enable-with-timeout-invalid", QEMU_CAPS_SPLASH_TIMEOUT); - DO_TEST("boot-menu-disable", NONE); - DO_TEST("boot-menu-disable-drive", NONE); + DO_TEST_NOCAPS("boot-menu-disable"); + DO_TEST_NOCAPS("boot-menu-disable-drive"); DO_TEST_PARSE_ERROR("boot-dev+order", QEMU_CAPS_VIRTIO_BLK_SCSI); DO_TEST("boot-order", @@ -1097,15 +1099,15 @@ mymain(void) QEMU_CAPS_VIRTIO_BLK_SCSI); /* Simplest possible <audio>, all supported with ENV */ - DO_TEST("audio-none-minimal", NONE); - DO_TEST("audio-alsa-minimal", NONE); - DO_TEST("audio-coreaudio-minimal", NONE); + DO_TEST_NOCAPS("audio-none-minimal"); + DO_TEST_NOCAPS("audio-alsa-minimal"); + DO_TEST_NOCAPS("audio-coreaudio-minimal"); DO_TEST_PARSE_ERROR("audio-jack-minimal", NONE); - DO_TEST("audio-oss-minimal", NONE); - DO_TEST("audio-pulseaudio-minimal", NONE); - DO_TEST("audio-sdl-minimal", NONE); - DO_TEST("audio-spice-minimal", NONE); - DO_TEST("audio-file-minimal", NONE); + DO_TEST_NOCAPS("audio-oss-minimal"); + DO_TEST_NOCAPS("audio-pulseaudio-minimal"); + DO_TEST_NOCAPS("audio-sdl-minimal"); + DO_TEST_NOCAPS("audio-spice-minimal"); + DO_TEST_NOCAPS("audio-file-minimal"); DO_TEST_CAPS_LATEST("audio-none-minimal"); DO_TEST_CAPS_LATEST("audio-alsa-minimal"); @@ -1118,14 +1120,14 @@ mymain(void) DO_TEST_CAPS_LATEST("audio-file-minimal"); /* Best <audio> still compat with old ENV */ - DO_TEST("audio-none-best", NONE); - DO_TEST("audio-alsa-best", NONE); - DO_TEST("audio-coreaudio-best", NONE); - DO_TEST("audio-oss-best", NONE); - DO_TEST("audio-pulseaudio-best", NONE); - DO_TEST("audio-sdl-best", NONE); - DO_TEST("audio-spice-best", NONE); - DO_TEST("audio-file-best", NONE); + DO_TEST_NOCAPS("audio-none-best"); + DO_TEST_NOCAPS("audio-alsa-best"); + DO_TEST_NOCAPS("audio-coreaudio-best"); + DO_TEST_NOCAPS("audio-oss-best"); + DO_TEST_NOCAPS("audio-pulseaudio-best"); + DO_TEST_NOCAPS("audio-sdl-best"); + DO_TEST_NOCAPS("audio-spice-best"); + DO_TEST_NOCAPS("audio-file-best"); DO_TEST_CAPS_LATEST("audio-none-best"); DO_TEST_CAPS_LATEST("audio-alsa-best"); @@ -1181,7 +1183,7 @@ mymain(void) g_setenv("QEMU_AUDIO_DRV", "alsa", TRUE); driver.config->nogfxAllowHostAudio = true; - DO_TEST("audio-default-nographics", NONE); + DO_TEST_NOCAPS("audio-default-nographics"); DO_TEST_CAPS_LATEST("audio-default-nographics"); driver.config->nogfxAllowHostAudio = false; g_unsetenv("QEMU_AUDIO_DRV"); @@ -1193,7 +1195,7 @@ mymain(void) DO_TEST("bios", QEMU_CAPS_DEVICE_ISA_SERIAL, QEMU_CAPS_SGA); - DO_TEST("bios-nvram", NONE); + DO_TEST_NOCAPS("bios-nvram"); DO_TEST("bios-nvram-secure", QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_DEVICE_PCI_BRIDGE, @@ -1202,26 +1204,26 @@ mymain(void) QEMU_CAPS_VIRTIO_SCSI); /* Make sure all combinations of ACPI and UEFI behave as expected */ - DO_TEST("q35-acpi-uefi", NONE); + DO_TEST_NOCAPS("q35-acpi-uefi"); DO_TEST_PARSE_ERROR("q35-noacpi-uefi", NONE); - DO_TEST("q35-noacpi-nouefi", NONE); - DO_TEST("q35-acpi-nouefi", NONE); - - DO_TEST("clock-utc", NONE); - DO_TEST("clock-localtime", NONE); - DO_TEST("clock-localtime-basis-localtime", NONE); - DO_TEST("clock-variable", NONE); - DO_TEST("clock-france", NONE); - DO_TEST("clock-hpet-off", NONE); + DO_TEST_NOCAPS("q35-noacpi-nouefi"); + DO_TEST_NOCAPS("q35-acpi-nouefi"); + + DO_TEST_NOCAPS("clock-utc"); + DO_TEST_NOCAPS("clock-localtime"); + DO_TEST_NOCAPS("clock-localtime-basis-localtime"); + DO_TEST_NOCAPS("clock-variable"); + DO_TEST_NOCAPS("clock-france"); + DO_TEST_NOCAPS("clock-hpet-off"); DO_TEST("clock-catchup", QEMU_CAPS_KVM_PIT_TICK_POLICY); - DO_TEST("cpu-kvmclock", NONE); - DO_TEST("cpu-host-kvmclock", NONE); + DO_TEST_NOCAPS("cpu-kvmclock"); + DO_TEST_NOCAPS("cpu-host-kvmclock"); DO_TEST("kvmclock", QEMU_CAPS_KVM); DO_TEST("clock-timer-hyperv-rtc", QEMU_CAPS_KVM); - DO_TEST("clock-realtime", NONE); + DO_TEST_NOCAPS("clock-realtime"); - DO_TEST("cpu-eoi-disabled", NONE); - DO_TEST("cpu-eoi-enabled", NONE); + DO_TEST_NOCAPS("cpu-eoi-disabled"); + DO_TEST_NOCAPS("cpu-eoi-enabled"); DO_TEST("controller-order", QEMU_CAPS_KVM, QEMU_CAPS_PIIX3_USB_UHCI, @@ -1250,11 +1252,11 @@ mymain(void) DO_TEST_CAPS_LATEST("hyperv-panic"); DO_TEST_CAPS_LATEST("hyperv-stimer-direct"); - DO_TEST("kvm-features", NONE); - DO_TEST("kvm-features-off", NONE); + DO_TEST_NOCAPS("kvm-features"); + DO_TEST_NOCAPS("kvm-features-off"); - DO_TEST("pmu-feature", NONE); - DO_TEST("pmu-feature-off", NONE); + DO_TEST_NOCAPS("pmu-feature"); + DO_TEST_NOCAPS("pmu-feature-off"); DO_TEST("pages-discard", QEMU_CAPS_OBJECT_MEMORY_FILE, @@ -1309,12 +1311,12 @@ mymain(void) DO_TEST_CAPS_LATEST("hugepages-memaccess3"); DO_TEST_CAPS_LATEST("hugepages-nvdimm"); DO_TEST("nosharepages", QEMU_CAPS_MEM_MERGE); - DO_TEST("disk-cdrom", NONE); + DO_TEST_NOCAPS("disk-cdrom"); DO_TEST_CAPS_VER("disk-cdrom", "2.12.0"); DO_TEST_CAPS_LATEST("disk-cdrom"); DO_TEST_CAPS_LATEST("disk-cdrom-empty-network-invalid"); DO_TEST_CAPS_LATEST("disk-cdrom-bus-other"); - DO_TEST("disk-iscsi", NONE); + DO_TEST_NOCAPS("disk-iscsi"); DO_TEST("disk-cdrom-network", QEMU_CAPS_KVM); DO_TEST_CAPS_VER("disk-cdrom-network", "2.12.0"); DO_TEST_CAPS_LATEST("disk-cdrom-network"); @@ -1322,7 +1324,7 @@ mymain(void) QEMU_CAPS_VIRTIO_TX_ALG); DO_TEST_CAPS_VER("disk-cdrom-tray", "2.12.0"); DO_TEST_CAPS_LATEST("disk-cdrom-tray"); - DO_TEST("disk-floppy", NONE); + DO_TEST_NOCAPS("disk-floppy"); DO_TEST_CAPS_VER("disk-floppy", "2.12.0"); DO_TEST_CAPS_LATEST("disk-floppy"); DO_TEST_CAPS_VER("disk-floppy-q35-2_9", "2.12.0"); @@ -1331,8 +1333,8 @@ mymain(void) DO_TEST_CAPS_LATEST("disk-floppy-q35-2_11"); DO_TEST_FAILURE("disk-floppy-pseries", QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE); - DO_TEST("disk-floppy-tray", NONE); - DO_TEST("disk-virtio", NONE); + DO_TEST_NOCAPS("disk-floppy-tray"); + DO_TEST_NOCAPS("disk-virtio"); DO_TEST("disk-virtio-ccw", QEMU_CAPS_CCW); DO_TEST("disk-virtio-ccw-many", QEMU_CAPS_CCW); DO_TEST("disk-virtio-s390-zpci", QEMU_CAPS_DEVICE_ZPCI, QEMU_CAPS_CCW); @@ -1340,22 +1342,22 @@ mymain(void) DO_TEST("disk-order", QEMU_CAPS_VIRTIO_BLK_SCSI); DO_TEST("disk-virtio-queues", QEMU_CAPS_VIRTIO_BLK_NUM_QUEUES); - DO_TEST("disk-boot-disk", NONE); - DO_TEST("disk-boot-cdrom", NONE); - DO_TEST("floppy-drive-fat", NONE); + DO_TEST_NOCAPS("disk-boot-disk"); + DO_TEST_NOCAPS("disk-boot-cdrom"); + DO_TEST_NOCAPS("floppy-drive-fat"); DO_TEST_CAPS_VER("floppy-drive-fat", "2.12.0"); DO_TEST_CAPS_LATEST("floppy-drive-fat"); - DO_TEST("disk-readonly-disk", NONE); + DO_TEST_NOCAPS("disk-readonly-disk"); DO_TEST_CAPS_VER("disk-readonly-disk", "2.12.0"); DO_TEST_CAPS_LATEST("disk-readonly-disk"); - DO_TEST("disk-fmt-qcow", NONE); + DO_TEST_NOCAPS("disk-fmt-qcow"); DO_TEST_PARSE_ERROR("disk-fmt-cow", NONE); DO_TEST_PARSE_ERROR("disk-fmt-dir", NONE); DO_TEST_PARSE_ERROR("disk-fmt-iso", NONE); DO_TEST_CAPS_VER("disk-shared", "2.12.0"); DO_TEST_CAPS_LATEST("disk-shared"); DO_TEST_PARSE_ERROR("disk-shared-qcow", NONE); - DO_TEST("disk-error-policy", NONE); + DO_TEST_NOCAPS("disk-error-policy"); DO_TEST_CAPS_VER("disk-error-policy", "2.12.0"); DO_TEST_CAPS_LATEST("disk-error-policy"); DO_TEST_CAPS_ARCH_VER("disk-error-policy-s390x", "s390x", "2.12.0"); @@ -1365,7 +1367,7 @@ mymain(void) DO_TEST_CAPS_LATEST("disk-metadata-cache"); DO_TEST_CAPS_ARCH_VER_PARSE_ERROR("disk-transient", "x86_64", "4.1.0"); DO_TEST_CAPS_LATEST("disk-transient"); - DO_TEST("disk-network-nbd", NONE); + DO_TEST_NOCAPS("disk-network-nbd"); DO_TEST_CAPS_VER("disk-network-nbd", "2.12.0"); DO_TEST_CAPS_LATEST("disk-network-nbd"); DO_TEST("disk-network-iscsi", QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_BLOCK); @@ -1385,10 +1387,10 @@ mymain(void) DO_TEST_CAPS_VER("disk-network-rbd", "2.12.0"); DO_TEST_CAPS_LATEST("disk-network-rbd"); DO_TEST_FAILURE("disk-network-rbd-no-colon", NONE); - DO_TEST("disk-network-sheepdog", NONE); + DO_TEST_NOCAPS("disk-network-sheepdog"); DO_TEST_CAPS_VER("disk-network-sheepdog", "2.12.0"); DO_TEST_CAPS_VER("disk-network-sheepdog", "6.0.0"); - DO_TEST("disk-network-source-auth", NONE); + DO_TEST_NOCAPS("disk-network-source-auth"); DO_TEST_CAPS_VER("disk-network-source-auth", "2.12.0"); DO_TEST_CAPS_LATEST("disk-network-source-auth"); DO_TEST("disk-network-vxhs", QEMU_CAPS_VXHS); @@ -1404,7 +1406,7 @@ mymain(void) DO_TEST_CAPS_LATEST("disk-network-http"); driver.config->vxhsTLS = 0; VIR_FREE(driver.config->vxhsTLSx509certdir); - DO_TEST("disk-no-boot", NONE); + DO_TEST_NOCAPS("disk-no-boot"); DO_TEST_CAPS_LATEST("disk-nvme"); DO_TEST_CAPS_LATEST("disk-vhostuser"); DO_TEST_PARSE_ERROR("disk-device-lun-type-invalid", @@ -1431,12 +1433,12 @@ mymain(void) DO_TEST_CAPS_LATEST("controller-virtio-scsi"); DO_TEST("disk-sata-device", QEMU_CAPS_ICH9_AHCI); - DO_TEST("disk-aio", NONE); + DO_TEST_NOCAPS("disk-aio"); DO_TEST_CAPS_VER("disk-aio", "2.12.0"); DO_TEST_CAPS_LATEST("disk-aio"); DO_TEST_CAPS_LATEST("disk-aio-io_uring"); - DO_TEST("disk-source-pool", NONE); - DO_TEST("disk-source-pool-mode", NONE); + DO_TEST_NOCAPS("disk-source-pool"); + DO_TEST_NOCAPS("disk-source-pool-mode"); DO_TEST("disk-ioeventfd", QEMU_CAPS_VIRTIO_IOEVENTFD, QEMU_CAPS_VIRTIO_TX_ALG, @@ -1450,7 +1452,7 @@ mymain(void) DO_TEST_CAPS_LATEST("disk-discard"); DO_TEST_CAPS_VER("disk-detect-zeroes", "2.12.0"); DO_TEST_CAPS_LATEST("disk-detect-zeroes"); - DO_TEST("disk-snapshot", NONE); + DO_TEST_NOCAPS("disk-snapshot"); DO_TEST_PARSE_ERROR("disk-same-targets", QEMU_CAPS_SCSI_LSI, QEMU_CAPS_DEVICE_USB_STORAGE); @@ -1603,28 +1605,28 @@ mymain(void) DO_TEST_CAPS_LATEST_PARSE_ERROR("graphics-spice-invalid-egl-headless"); DO_TEST_CAPS_LATEST("graphics-spice-gl-auto-rendernode"); - DO_TEST("input-usbmouse", NONE); - DO_TEST("input-usbtablet", NONE); - DO_TEST("misc-acpi", NONE); + DO_TEST_NOCAPS("input-usbmouse"); + DO_TEST_NOCAPS("input-usbtablet"); + DO_TEST_NOCAPS("misc-acpi"); DO_TEST("misc-disable-s3", QEMU_CAPS_PIIX_DISABLE_S3); DO_TEST("misc-disable-suspends", QEMU_CAPS_PIIX_DISABLE_S3, QEMU_CAPS_PIIX_DISABLE_S4); DO_TEST("misc-enable-s4", QEMU_CAPS_PIIX_DISABLE_S4); DO_TEST_PARSE_ERROR("misc-enable-s4", NONE); - DO_TEST("misc-no-reboot", NONE); - DO_TEST("misc-uuid", NONE); + DO_TEST_NOCAPS("misc-no-reboot"); + DO_TEST_NOCAPS("misc-uuid"); DO_TEST_PARSE_ERROR("vhost_queues-invalid", NONE); DO_TEST("net-vhostuser", QEMU_CAPS_CHARDEV_FD_PASS); DO_TEST_CAPS_LATEST("net-vhostuser"); - DO_TEST("net-vhostuser-multiq", NONE); + DO_TEST_NOCAPS("net-vhostuser-multiq"); DO_TEST_FAILURE("net-vhostuser-fail", NONE); - DO_TEST("net-user", NONE); + DO_TEST_NOCAPS("net-user"); DO_TEST_CAPS_ARCH_VER_FULL("net-user", "x86_64", "4.0.0", ARG_FLAGS, FLAG_SLIRP_HELPER); - DO_TEST("net-user-addr", NONE); - DO_TEST("net-virtio", NONE); + DO_TEST_NOCAPS("net-user-addr"); + DO_TEST_NOCAPS("net-virtio"); DO_TEST("net-virtio-device", QEMU_CAPS_VIRTIO_TX_ALG); - DO_TEST("net-virtio-disable-offloads", NONE); - DO_TEST("net-virtio-netdev", NONE); + DO_TEST_NOCAPS("net-virtio-disable-offloads"); + DO_TEST_NOCAPS("net-virtio-netdev"); DO_TEST("net-virtio-ccw", QEMU_CAPS_CCW); DO_TEST("net-virtio-rxtxqueuesize", QEMU_CAPS_VIRTIO_NET_RX_QUEUE_SIZE, @@ -1638,16 +1640,16 @@ mymain(void) DO_TEST("net-virtio-teaming-hostdev", QEMU_CAPS_VIRTIO_NET_FAILOVER, QEMU_CAPS_DEVICE_VFIO_PCI); - DO_TEST("net-eth", NONE); - DO_TEST("net-eth-ifname", NONE); - DO_TEST("net-eth-names", NONE); - DO_TEST("net-eth-hostip", NONE); - DO_TEST("net-eth-unmanaged-tap", NONE); - DO_TEST("net-client", NONE); - DO_TEST("net-server", NONE); - DO_TEST("net-many-models", NONE); - DO_TEST("net-mcast", NONE); - DO_TEST("net-udp", NONE); + DO_TEST_NOCAPS("net-eth"); + DO_TEST_NOCAPS("net-eth-ifname"); + DO_TEST_NOCAPS("net-eth-names"); + DO_TEST_NOCAPS("net-eth-hostip"); + DO_TEST_NOCAPS("net-eth-unmanaged-tap"); + DO_TEST_NOCAPS("net-client"); + DO_TEST_NOCAPS("net-server"); + DO_TEST_NOCAPS("net-many-models"); + DO_TEST_NOCAPS("net-mcast"); + DO_TEST_NOCAPS("net-udp"); DO_TEST("net-hostdev", QEMU_CAPS_DEVICE_VFIO_PCI); DO_TEST("net-hostdev-bootorder", QEMU_CAPS_DEVICE_VFIO_PCI); DO_TEST("net-hostdev-multidomain", QEMU_CAPS_DEVICE_VFIO_PCI); @@ -1675,7 +1677,7 @@ mymain(void) QEMU_CAPS_DEVICE_QXL, QEMU_CAPS_SPICE, QEMU_CAPS_DEVICE_ISA_SERIAL); - DO_TEST("serial-spiceport-nospice", NONE); + DO_TEST_NOCAPS("serial-spiceport-nospice"); DO_TEST("console-compat", QEMU_CAPS_DEVICE_ISA_SERIAL); @@ -1726,22 +1728,22 @@ mymain(void) VIR_FREE(driver.config->chardevTLSx509certdir); DO_TEST("serial-many-chardev", QEMU_CAPS_DEVICE_ISA_SERIAL); - DO_TEST("parallel-tcp-chardev", NONE); - DO_TEST("parallel-parport-chardev", NONE); + DO_TEST_NOCAPS("parallel-tcp-chardev"); + DO_TEST_NOCAPS("parallel-parport-chardev"); DO_TEST_CAPS_LATEST("parallel-unix-chardev"); DO_TEST("console-compat-chardev", QEMU_CAPS_DEVICE_ISA_SERIAL); DO_TEST("pci-serial-dev-chardev", QEMU_CAPS_DEVICE_PCI_SERIAL); - DO_TEST("channel-guestfwd", NONE); + DO_TEST_NOCAPS("channel-guestfwd"); DO_TEST_CAPS_LATEST("channel-unix-guestfwd"); - DO_TEST("channel-virtio", NONE); - DO_TEST("channel-virtio-state", NONE); - DO_TEST("channel-virtio-auto", NONE); - DO_TEST("channel-virtio-autoassign", NONE); - DO_TEST("channel-virtio-autoadd", NONE); - DO_TEST("console-virtio", NONE); + DO_TEST_NOCAPS("channel-virtio"); + DO_TEST_NOCAPS("channel-virtio-state"); + DO_TEST_NOCAPS("channel-virtio-auto"); + DO_TEST_NOCAPS("channel-virtio-autoassign"); + DO_TEST_NOCAPS("channel-virtio-autoadd"); + DO_TEST_NOCAPS("console-virtio"); DO_TEST("console-virtio-many", QEMU_CAPS_DEVICE_ISA_SERIAL); DO_TEST("console-virtio-ccw", QEMU_CAPS_CCW); @@ -1752,7 +1754,7 @@ mymain(void) QEMU_CAPS_DEVICE_CIRRUS_VGA); DO_TEST("channel-virtio-default", QEMU_CAPS_SPICE); - DO_TEST("channel-virtio-unix", NONE); + DO_TEST_NOCAPS("channel-virtio-unix"); DO_TEST("smartcard-host", QEMU_CAPS_CCID_EMULATED); @@ -1779,12 +1781,12 @@ mymain(void) DO_TEST_PARSE_ERROR("chardev-reconnect-generated-path", QEMU_CAPS_CHARDEV_RECONNECT); - DO_TEST("usb-controller", NONE); + DO_TEST_NOCAPS("usb-controller"); DO_TEST("usb-piix3-controller", QEMU_CAPS_PIIX3_USB_UHCI); DO_TEST("usb-ich9-ehci-addr", QEMU_CAPS_ICH9_USB_EHCI1); - DO_TEST("input-usbmouse-addr", NONE); + DO_TEST_NOCAPS("input-usbmouse-addr"); DO_TEST("usb-ich9-companion", QEMU_CAPS_ICH9_USB_EHCI1); DO_TEST_PARSE_ERROR("usb-ich9-no-companion", @@ -1837,7 +1839,7 @@ mymain(void) QEMU_CAPS_PIIX3_USB_UHCI, QEMU_CAPS_USB_HUB, QEMU_CAPS_ICH9_USB_EHCI1); - DO_TEST("usb-none", NONE); + DO_TEST_NOCAPS("usb-none"); DO_TEST_PARSE_ERROR("usb-none-other", NONE); DO_TEST_PARSE_ERROR("usb-none-hub", QEMU_CAPS_USB_HUB); @@ -1878,17 +1880,17 @@ mymain(void) DO_TEST_PARSE_ERROR("usb-controller-qemu-xhci-limit", QEMU_CAPS_DEVICE_QEMU_XHCI); - DO_TEST("smbios", NONE); + DO_TEST_NOCAPS("smbios"); DO_TEST_PARSE_ERROR("smbios-date", NONE); DO_TEST_PARSE_ERROR("smbios-uuid-match", NONE); DO_TEST("smbios-type-fwcfg", QEMU_CAPS_FW_CFG); - DO_TEST("watchdog", NONE); - DO_TEST("watchdog-device", NONE); - DO_TEST("watchdog-dump", NONE); - DO_TEST("watchdog-injectnmi", NONE); + DO_TEST_NOCAPS("watchdog"); + DO_TEST_NOCAPS("watchdog-device"); + DO_TEST_NOCAPS("watchdog-dump"); + DO_TEST_NOCAPS("watchdog-injectnmi"); DO_TEST_CAPS_ARCH_LATEST("watchdog-diag288", "s390x"); - DO_TEST("balloon-device", NONE); + DO_TEST_NOCAPS("balloon-device"); DO_TEST("balloon-device-deflate", QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE); DO_TEST("balloon-ccw-deflate", @@ -1898,22 +1900,22 @@ mymain(void) QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE); DO_TEST("balloon-device-deflate-off", QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE); - DO_TEST("balloon-device-auto", NONE); - DO_TEST("balloon-device-period", NONE); - DO_TEST("sound", NONE); + DO_TEST_NOCAPS("balloon-device-auto"); + DO_TEST_NOCAPS("balloon-device-period"); + DO_TEST_NOCAPS("sound"); DO_TEST("sound-device", QEMU_CAPS_HDA_DUPLEX, QEMU_CAPS_HDA_MICRO, QEMU_CAPS_HDA_OUTPUT, QEMU_CAPS_DEVICE_ICH9_INTEL_HDA, QEMU_CAPS_OBJECT_USB_AUDIO); - DO_TEST("fs9p", NONE); + DO_TEST_NOCAPS("fs9p"); DO_TEST_CAPS_LATEST("fs9p"); DO_TEST("fs9p-ccw", QEMU_CAPS_CCW); DO_TEST_CAPS_ARCH_LATEST("fs9p-ccw", "s390x"); - DO_TEST("hostdev-usb-address", NONE); - DO_TEST("hostdev-usb-address-device", NONE); - DO_TEST("hostdev-usb-address-device-boot", NONE); + DO_TEST_NOCAPS("hostdev-usb-address"); + DO_TEST_NOCAPS("hostdev-usb-address-device"); + DO_TEST_NOCAPS("hostdev-usb-address-device-boot"); DO_TEST_PARSE_ERROR("hostdev-usb-duplicate", NONE); DO_TEST("hostdev-pci-address", QEMU_CAPS_DEVICE_VFIO_PCI); DO_TEST("hostdev-pci-address-device", QEMU_CAPS_DEVICE_VFIO_PCI); @@ -1983,8 +1985,8 @@ mymain(void) QEMU_CAPS_DEVICE_ZPCI); DO_TEST("pci-rom", QEMU_CAPS_DEVICE_VFIO_PCI); - DO_TEST("pci-rom-disabled", NONE); - DO_TEST("pci-rom-disabled-invalid", NONE); + DO_TEST_NOCAPS("pci-rom-disabled"); + DO_TEST_NOCAPS("pci-rom-disabled-invalid"); DO_TEST("hostdev-subsys-mdev-vfio-ccw", QEMU_CAPS_CCW, @@ -2034,10 +2036,10 @@ mymain(void) DO_TEST_CAPS_VER("qemu-ns", "4.0.0"); DO_TEST_CAPS_LATEST("qemu-ns"); - DO_TEST("qemu-ns-no-env", NONE); - DO_TEST("qemu-ns-alt", NONE); + DO_TEST_NOCAPS("qemu-ns-no-env"); + DO_TEST_NOCAPS("qemu-ns-alt"); - DO_TEST("smp", NONE); + DO_TEST_NOCAPS("smp"); DO_TEST("smp-dies", QEMU_CAPS_SMP_DIES); DO_TEST("iothreads", QEMU_CAPS_OBJECT_IOTHREAD); @@ -2051,9 +2053,9 @@ mymain(void) DO_TEST_CAPS_LATEST("iothreads-virtio-scsi-pci"); DO_TEST_CAPS_ARCH_LATEST("iothreads-virtio-scsi-ccw", "s390x"); - DO_TEST("cpu-topology1", NONE); - DO_TEST("cpu-topology2", NONE); - DO_TEST("cpu-topology3", NONE); + DO_TEST_NOCAPS("cpu-topology1"); + DO_TEST_NOCAPS("cpu-topology2"); + DO_TEST_NOCAPS("cpu-topology3"); DO_TEST("cpu-minimum1", QEMU_CAPS_KVM); DO_TEST("cpu-minimum2", QEMU_CAPS_KVM); DO_TEST("cpu-exact1", QEMU_CAPS_KVM); @@ -2063,17 +2065,17 @@ mymain(void) DO_TEST_FAILURE("cpu-nofallback", QEMU_CAPS_KVM); DO_TEST("cpu-strict1", QEMU_CAPS_KVM); DO_TEST("cpu-no-removed-features", QEMU_CAPS_KVM); - DO_TEST("cpu-numa1", NONE); - DO_TEST("cpu-numa2", NONE); - DO_TEST("cpu-numa-no-memory-element", NONE); + DO_TEST_NOCAPS("cpu-numa1"); + DO_TEST_NOCAPS("cpu-numa2"); + DO_TEST_NOCAPS("cpu-numa-no-memory-element"); DO_TEST_PARSE_ERROR("cpu-numa3", NONE); DO_TEST_PARSE_ERROR("cpu-numa-disjoint", NONE); DO_TEST("cpu-numa-disjoint", QEMU_CAPS_NUMA); DO_TEST_FAILURE("cpu-numa-memshared", QEMU_CAPS_OBJECT_MEMORY_RAM); DO_TEST_PARSE_ERROR("cpu-numa-memshared-1", NONE); DO_TEST("cpu-numa-memshared", QEMU_CAPS_OBJECT_MEMORY_FILE); - DO_TEST("cpu-host-model", NONE); - DO_TEST("cpu-host-model-vendor", NONE); + DO_TEST_NOCAPS("cpu-host-model"); + DO_TEST_NOCAPS("cpu-host-model-vendor"); DO_TEST_FULL("cpu-host-model-fallback", "", ARG_FLAGS, FLAG_SKIP_LEGACY_CPUS, ARG_END); DO_TEST_FULL("cpu-host-model-nofallback", "", @@ -2093,7 +2095,7 @@ mymain(void) DO_TEST("cpu-Haswell2", QEMU_CAPS_KVM); DO_TEST("cpu-Haswell3", QEMU_CAPS_KVM); DO_TEST("cpu-Haswell-noTSX", QEMU_CAPS_KVM); - DO_TEST("cpu-host-model-cmt", NONE); + DO_TEST_NOCAPS("cpu-host-model-cmt"); DO_TEST_CAPS_VER("cpu-host-model-cmt", "4.0.0"); DO_TEST("cpu-tsc-frequency", QEMU_CAPS_KVM); DO_TEST_CAPS_VER("cpu-tsc-frequency", "4.0.0"); @@ -2113,12 +2115,12 @@ mymain(void) DO_TEST_PARSE_ERROR("luks-disk-invalid", NONE); DO_TEST_PARSE_ERROR("luks-disks-source-both", QEMU_CAPS_OBJECT_SECRET); - DO_TEST("memtune", NONE); - DO_TEST("memtune-unlimited", NONE); - DO_TEST("blkiotune", NONE); - DO_TEST("blkiotune-device", NONE); - DO_TEST("cputune", NONE); - DO_TEST("cputune-zero-shares", NONE); + DO_TEST_NOCAPS("memtune"); + DO_TEST_NOCAPS("memtune-unlimited"); + DO_TEST_NOCAPS("blkiotune"); + DO_TEST_NOCAPS("blkiotune-device"); + DO_TEST_NOCAPS("cputune"); + DO_TEST_NOCAPS("cputune-zero-shares"); DO_TEST_PARSE_ERROR("cputune-iothreadsched-toomuch", NONE); DO_TEST_PARSE_ERROR("cputune-vcpusched-overlap", NONE); DO_TEST("cputune-numatune", @@ -2131,7 +2133,7 @@ mymain(void) QEMU_CAPS_OBJECT_IOTHREAD); DO_TEST_CAPS_LATEST("cputune-cpuset-big-id"); - DO_TEST("numatune-memory", NONE); + DO_TEST_NOCAPS("numatune-memory"); DO_TEST_PARSE_ERROR("numatune-memory-invalid-nodeset", NONE); DO_TEST("numatune-memnode", QEMU_CAPS_NUMA, @@ -2148,22 +2150,22 @@ mymain(void) DO_TEST_PARSE_ERROR("numatune-memnode-no-memory", NONE); DO_TEST("numatune-distances", QEMU_CAPS_NUMA); - DO_TEST("numatune-no-vcpu", NONE); + DO_TEST_NOCAPS("numatune-no-vcpu"); DO_TEST_CAPS_LATEST("numatune-hmat"); - DO_TEST("numatune-auto-nodeset-invalid", NONE); + DO_TEST_NOCAPS("numatune-auto-nodeset-invalid"); DO_TEST("numatune-auto-prefer", QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE); DO_TEST_FAILURE("numatune-static-nodeset-exceed-hostnode", QEMU_CAPS_OBJECT_MEMORY_RAM); DO_TEST_PARSE_ERROR("numatune-memnode-nocpu", NONE); DO_TEST_PARSE_ERROR("numatune-memnodes-problematic", NONE); - DO_TEST("numad", NONE); - DO_TEST("numad-auto-vcpu-static-numatune", NONE); + DO_TEST_NOCAPS("numad"); + DO_TEST_NOCAPS("numad-auto-vcpu-static-numatune"); DO_TEST_PARSE_ERROR("numad-auto-vcpu-static-numatune-no-nodeset", NONE); - DO_TEST("numad-auto-memory-vcpu-cpuset", NONE); - DO_TEST("numad-auto-memory-vcpu-no-cpuset-and-placement", NONE); - DO_TEST("numad-static-memory-auto-vcpu", NONE); + DO_TEST_NOCAPS("numad-auto-memory-vcpu-cpuset"); + DO_TEST_NOCAPS("numad-auto-memory-vcpu-no-cpuset-and-placement"); + DO_TEST_NOCAPS("numad-static-memory-auto-vcpu"); DO_TEST_CAPS_VER("blkdeviotune-max", "4.1.0"); DO_TEST_CAPS_LATEST("blkdeviotune-max"); DO_TEST_CAPS_VER("blkdeviotune-group-num", "4.1.0"); @@ -2174,18 +2176,18 @@ mymain(void) DO_TEST("multifunction-pci-device", QEMU_CAPS_SCSI_LSI); - DO_TEST("monitor-json", NONE); - - DO_TEST("seclabel-dynamic", NONE); - DO_TEST("seclabel-dynamic-baselabel", NONE); - DO_TEST("seclabel-dynamic-override", NONE); - DO_TEST("seclabel-dynamic-labelskip", NONE); - DO_TEST("seclabel-dynamic-relabel", NONE); - DO_TEST("seclabel-static", NONE); - DO_TEST("seclabel-static-relabel", NONE); - DO_TEST("seclabel-static-labelskip", NONE); - DO_TEST("seclabel-none", NONE); - DO_TEST("seclabel-dac-none", NONE); + DO_TEST_NOCAPS("monitor-json"); + + DO_TEST_NOCAPS("seclabel-dynamic"); + DO_TEST_NOCAPS("seclabel-dynamic-baselabel"); + DO_TEST_NOCAPS("seclabel-dynamic-override"); + DO_TEST_NOCAPS("seclabel-dynamic-labelskip"); + DO_TEST_NOCAPS("seclabel-dynamic-relabel"); + DO_TEST_NOCAPS("seclabel-static"); + DO_TEST_NOCAPS("seclabel-static-relabel"); + DO_TEST_NOCAPS("seclabel-static-labelskip"); + DO_TEST_NOCAPS("seclabel-none"); + DO_TEST_NOCAPS("seclabel-dac-none"); DO_TEST_PARSE_ERROR("seclabel-multiple", NONE); DO_TEST_PARSE_ERROR("seclabel-device-duplicates", NONE); @@ -2431,12 +2433,12 @@ mymain(void) QEMU_CAPS_DEVICE_VIRTIO_MMIO); DO_TEST_PARSE_ERROR("mach-virt-serial-invalid-machine", NONE); - DO_TEST("disk-ide-split", NONE); + DO_TEST_NOCAPS("disk-ide-split"); DO_TEST("disk-ide-wwn", QEMU_CAPS_IDE_DRIVE_WWN, QEMU_CAPS_SCSI_DISK_WWN); - DO_TEST("disk-geometry", NONE); + DO_TEST_NOCAPS("disk-geometry"); DO_TEST("disk-blockio", QEMU_CAPS_BLOCKIO); DO_TEST("video-device-pciaddr-default", @@ -2886,8 +2888,8 @@ mymain(void) QEMU_CAPS_DEVICE_QXL, QEMU_CAPS_Q35_PCI_HOLE64_SIZE); - DO_TEST("arm-vexpressa9-nodevs", NONE); - DO_TEST("arm-vexpressa9-basic", NONE); + DO_TEST_NOCAPS("arm-vexpressa9-nodevs"); + DO_TEST_NOCAPS("arm-vexpressa9-basic"); DO_TEST("arm-vexpressa9-virtio", QEMU_CAPS_DEVICE_VIRTIO_MMIO, QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM); @@ -3042,9 +3044,9 @@ mymain(void) QEMU_CAPS_DEVICE_PCI_SERIAL); /* Make sure all combinations of ACPI and UEFI behave as expected */ - DO_TEST("aarch64-acpi-uefi", NONE); - DO_TEST("aarch64-noacpi-uefi", NONE); - DO_TEST("aarch64-noacpi-nouefi", NONE); + DO_TEST_NOCAPS("aarch64-acpi-uefi"); + DO_TEST_NOCAPS("aarch64-noacpi-uefi"); + DO_TEST_NOCAPS("aarch64-noacpi-nouefi"); DO_TEST_PARSE_ERROR("aarch64-acpi-nouefi", NONE); /* QEMU 4.0.0 didn't have support for aarch64 CPU features */ @@ -3090,7 +3092,7 @@ mymain(void) DO_TEST_FAILURE("memory-align-fail", NONE); DO_TEST_PARSE_ERROR("memory-hotplug-nonuma", QEMU_CAPS_DEVICE_PC_DIMM); - DO_TEST("memory-hotplug", NONE); + DO_TEST_NOCAPS("memory-hotplug"); DO_TEST("memory-hotplug", QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA); DO_TEST("memory-hotplug-dimm", QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA, QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE); @@ -3221,12 +3223,12 @@ mymain(void) QEMU_CAPS_CCW, QEMU_CAPS_LOADPARM); - DO_TEST("qemu-ns-domain-ns0", NONE); - DO_TEST("qemu-ns-domain-commandline", NONE); - DO_TEST("qemu-ns-domain-commandline-ns0", NONE); - DO_TEST("qemu-ns-commandline", NONE); - DO_TEST("qemu-ns-commandline-ns0", NONE); - DO_TEST("qemu-ns-commandline-ns1", NONE); + DO_TEST_NOCAPS("qemu-ns-domain-ns0"); + DO_TEST_NOCAPS("qemu-ns-domain-commandline"); + DO_TEST_NOCAPS("qemu-ns-domain-commandline-ns0"); + DO_TEST_NOCAPS("qemu-ns-commandline"); + DO_TEST_NOCAPS("qemu-ns-commandline-ns0"); + DO_TEST_NOCAPS("qemu-ns-commandline-ns1"); DO_TEST("virtio-input", QEMU_CAPS_VIRTIO_KEYBOARD, QEMU_CAPS_VIRTIO_MOUSE, QEMU_CAPS_VIRTIO_TABLET); @@ -3313,7 +3315,7 @@ mymain(void) DO_TEST_PARSE_ERROR("usb-too-long-port-path-invalid", QEMU_CAPS_USB_HUB); - DO_TEST("acpi-table", NONE); + DO_TEST_NOCAPS("acpi-table"); DO_TEST_CAPS_LATEST("intel-iommu"); DO_TEST_CAPS_LATEST("intel-iommu-caching-mode"); @@ -3411,7 +3413,7 @@ mymain(void) DO_TEST("cpu-check-partial", QEMU_CAPS_KVM); DO_TEST("cpu-check-full", QEMU_CAPS_KVM); DO_TEST("cpu-check-default-none", QEMU_CAPS_KVM); - DO_TEST("cpu-check-default-none2", NONE); + DO_TEST_NOCAPS("cpu-check-default-none2"); DO_TEST("cpu-check-default-partial", QEMU_CAPS_KVM); DO_TEST("cpu-check-default-partial2", QEMU_CAPS_KVM); -- 2.31.1

Add a explicit version of our test invocation macro for tests which use no capabilities. This reduces the usage of the somewhat anonymous 'NONE' macro and will lead to simplification of the code later. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/qemuxml2argvtest.c | 186 ++++++++++++++++++++------------------- 1 file changed, 94 insertions(+), 92 deletions(-) diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index bb2534ffc9..0f7e7e811d 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1030,6 +1030,10 @@ mymain(void) DO_TEST_FULL(name, "", \ ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR | FLAG_EXPECT_FAILURE, \ ARG_QEMU_CAPS, __VA_ARGS__, QEMU_CAPS_LAST, ARG_END) +# define DO_TEST_PARSE_ERROR_NOCAPS(name) \ + DO_TEST_FULL(name, "", \ + ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR | FLAG_EXPECT_FAILURE, \ + ARG_END) # define NONE QEMU_CAPS_LAST @@ -1050,7 +1054,7 @@ mymain(void) DO_TEST_NOCAPS("minimal"); DO_TEST("minimal-sandbox", QEMU_CAPS_SECCOMP_BLACKLIST); - DO_TEST_PARSE_ERROR("minimal-no-memory", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("minimal-no-memory"); DO_TEST("minimal-msg-timestamp", QEMU_CAPS_MSG_TIMESTAMP); DO_TEST_CAPS_LATEST("genid"); @@ -1083,7 +1087,7 @@ mymain(void) DO_TEST_NOCAPS("boot-menu-enable"); DO_TEST("boot-menu-enable-with-timeout", QEMU_CAPS_SPLASH_TIMEOUT); - DO_TEST_PARSE_ERROR("boot-menu-enable-with-timeout", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("boot-menu-enable-with-timeout"); DO_TEST_PARSE_ERROR("boot-menu-enable-with-timeout-invalid", QEMU_CAPS_SPLASH_TIMEOUT); DO_TEST_NOCAPS("boot-menu-disable"); @@ -1102,7 +1106,7 @@ mymain(void) DO_TEST_NOCAPS("audio-none-minimal"); DO_TEST_NOCAPS("audio-alsa-minimal"); DO_TEST_NOCAPS("audio-coreaudio-minimal"); - DO_TEST_PARSE_ERROR("audio-jack-minimal", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("audio-jack-minimal"); DO_TEST_NOCAPS("audio-oss-minimal"); DO_TEST_NOCAPS("audio-pulseaudio-minimal"); DO_TEST_NOCAPS("audio-sdl-minimal"); @@ -1139,15 +1143,15 @@ mymain(void) DO_TEST_CAPS_LATEST("audio-file-best"); /* Full <audio> only compat with new QEMU -audiodev args */ - DO_TEST_PARSE_ERROR("audio-none-full", NONE); - DO_TEST_PARSE_ERROR("audio-alsa-full", NONE); - DO_TEST_PARSE_ERROR("audio-coreaudio-full", NONE); - DO_TEST_PARSE_ERROR("audio-jack-full", NONE); - DO_TEST_PARSE_ERROR("audio-oss-full", NONE); - DO_TEST_PARSE_ERROR("audio-pulseaudio-full", NONE); - DO_TEST_PARSE_ERROR("audio-sdl-full", NONE); - DO_TEST_PARSE_ERROR("audio-spice-full", NONE); - DO_TEST_PARSE_ERROR("audio-file-full", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("audio-none-full"); + DO_TEST_PARSE_ERROR_NOCAPS("audio-alsa-full"); + DO_TEST_PARSE_ERROR_NOCAPS("audio-coreaudio-full"); + DO_TEST_PARSE_ERROR_NOCAPS("audio-jack-full"); + DO_TEST_PARSE_ERROR_NOCAPS("audio-oss-full"); + DO_TEST_PARSE_ERROR_NOCAPS("audio-pulseaudio-full"); + DO_TEST_PARSE_ERROR_NOCAPS("audio-sdl-full"); + DO_TEST_PARSE_ERROR_NOCAPS("audio-spice-full"); + DO_TEST_PARSE_ERROR_NOCAPS("audio-file-full"); DO_TEST_CAPS_LATEST("audio-none-full"); DO_TEST_CAPS_LATEST("audio-alsa-full"); @@ -1160,7 +1164,7 @@ mymain(void) DO_TEST_CAPS_LATEST("audio-file-full"); /* Multiple backends not supported with ENV */ - DO_TEST_PARSE_ERROR("audio-many-backends", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("audio-many-backends"); DO_TEST_CAPS_LATEST("audio-many-backends"); /* Validate auto-creation of <audio> for legacy compat */ @@ -1190,7 +1194,7 @@ mymain(void) DO_TEST("reboot-timeout-disabled", QEMU_CAPS_REBOOT_TIMEOUT); DO_TEST("reboot-timeout-enabled", QEMU_CAPS_REBOOT_TIMEOUT); - DO_TEST_PARSE_ERROR("reboot-timeout-enabled", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("reboot-timeout-enabled"); DO_TEST("bios", QEMU_CAPS_DEVICE_ISA_SERIAL, @@ -1205,7 +1209,7 @@ mymain(void) /* Make sure all combinations of ACPI and UEFI behave as expected */ DO_TEST_NOCAPS("q35-acpi-uefi"); - DO_TEST_PARSE_ERROR("q35-noacpi-uefi", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("q35-noacpi-uefi"); DO_TEST_NOCAPS("q35-noacpi-nouefi"); DO_TEST_NOCAPS("q35-acpi-nouefi"); @@ -1272,7 +1276,7 @@ mymain(void) DO_TEST("hugepages-default", QEMU_CAPS_OBJECT_MEMORY_FILE); DO_TEST("hugepages-default-2M", QEMU_CAPS_OBJECT_MEMORY_FILE); DO_TEST("hugepages-default-system-size", QEMU_CAPS_OBJECT_MEMORY_FILE); - DO_TEST_PARSE_ERROR("hugepages-default-1G-nodeset-2M", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("hugepages-default-1G-nodeset-2M"); DO_TEST("hugepages-nodeset", QEMU_CAPS_OBJECT_MEMORY_FILE); DO_TEST_PARSE_ERROR("hugepages-nodeset-nonexist", QEMU_CAPS_DEVICE_PC_DIMM, @@ -1298,7 +1302,7 @@ mymain(void) DO_TEST("hugepages-shared", QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE); - DO_TEST_PARSE_ERROR("hugepages-memaccess-invalid", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("hugepages-memaccess-invalid"); DO_TEST("hugepages-memaccess", QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA); @@ -1351,12 +1355,12 @@ mymain(void) DO_TEST_CAPS_VER("disk-readonly-disk", "2.12.0"); DO_TEST_CAPS_LATEST("disk-readonly-disk"); DO_TEST_NOCAPS("disk-fmt-qcow"); - DO_TEST_PARSE_ERROR("disk-fmt-cow", NONE); - DO_TEST_PARSE_ERROR("disk-fmt-dir", NONE); - DO_TEST_PARSE_ERROR("disk-fmt-iso", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("disk-fmt-cow"); + DO_TEST_PARSE_ERROR_NOCAPS("disk-fmt-dir"); + DO_TEST_PARSE_ERROR_NOCAPS("disk-fmt-iso"); DO_TEST_CAPS_VER("disk-shared", "2.12.0"); DO_TEST_CAPS_LATEST("disk-shared"); - DO_TEST_PARSE_ERROR("disk-shared-qcow", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("disk-shared-qcow"); DO_TEST_NOCAPS("disk-error-policy"); DO_TEST_CAPS_VER("disk-error-policy", "2.12.0"); DO_TEST_CAPS_LATEST("disk-error-policy"); @@ -1377,9 +1381,9 @@ mymain(void) QEMU_CAPS_ISCSI_PASSWORD_SECRET); DO_TEST_CAPS_VER("disk-network-iscsi", "2.12.0"); DO_TEST_CAPS_LATEST("disk-network-iscsi"); - DO_TEST_PARSE_ERROR("disk-network-iscsi-auth-secrettype-invalid", NONE); - DO_TEST_PARSE_ERROR("disk-network-iscsi-auth-wrong-secrettype", NONE); - DO_TEST_PARSE_ERROR("disk-network-source-auth-both", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("disk-network-iscsi-auth-secrettype-invalid"); + DO_TEST_PARSE_ERROR_NOCAPS("disk-network-iscsi-auth-wrong-secrettype"); + DO_TEST_PARSE_ERROR_NOCAPS("disk-network-source-auth-both"); DO_TEST("disk-network-gluster", QEMU_CAPS_GLUSTER_DEBUG_LEVEL); DO_TEST_CAPS_VER("disk-network-gluster", "2.12.0"); @@ -1412,7 +1416,7 @@ mymain(void) DO_TEST_PARSE_ERROR("disk-device-lun-type-invalid", QEMU_CAPS_VIRTIO_SCSI); DO_TEST_CAPS_LATEST_PARSE_ERROR("disk-attaching-partition-nosupport"); - DO_TEST_PARSE_ERROR("disk-usb-nosupport", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("disk-usb-nosupport"); DO_TEST("disk-usb-device", QEMU_CAPS_DEVICE_USB_STORAGE); DO_TEST("disk-usb-device-removable", @@ -1473,10 +1477,8 @@ mymain(void) QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI); DO_TEST("disk-serial", QEMU_CAPS_KVM); - DO_TEST_PARSE_ERROR("disk-fdc-incompatible-address", - NONE); - DO_TEST_PARSE_ERROR("disk-ide-incompatible-address", - NONE); + DO_TEST_PARSE_ERROR_NOCAPS("disk-fdc-incompatible-address"); + DO_TEST_PARSE_ERROR_NOCAPS("disk-ide-incompatible-address"); DO_TEST_PARSE_ERROR("disk-sata-incompatible-address", QEMU_CAPS_ICH9_AHCI); DO_TEST_PARSE_ERROR("disk-scsi-incompatible-address", @@ -1611,10 +1613,10 @@ mymain(void) DO_TEST("misc-disable-s3", QEMU_CAPS_PIIX_DISABLE_S3); DO_TEST("misc-disable-suspends", QEMU_CAPS_PIIX_DISABLE_S3, QEMU_CAPS_PIIX_DISABLE_S4); DO_TEST("misc-enable-s4", QEMU_CAPS_PIIX_DISABLE_S4); - DO_TEST_PARSE_ERROR("misc-enable-s4", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("misc-enable-s4"); DO_TEST_NOCAPS("misc-no-reboot"); DO_TEST_NOCAPS("misc-uuid"); - DO_TEST_PARSE_ERROR("vhost_queues-invalid", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("vhost_queues-invalid"); DO_TEST("net-vhostuser", QEMU_CAPS_CHARDEV_FD_PASS); DO_TEST_CAPS_LATEST("net-vhostuser"); DO_TEST_NOCAPS("net-vhostuser-multiq"); @@ -1636,7 +1638,7 @@ mymain(void) DO_TEST("net-virtio-teaming", QEMU_CAPS_VIRTIO_NET_FAILOVER, QEMU_CAPS_DEVICE_VFIO_PCI); - DO_TEST_PARSE_ERROR("net-virtio-teaming", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("net-virtio-teaming"); DO_TEST("net-virtio-teaming-hostdev", QEMU_CAPS_VIRTIO_NET_FAILOVER, QEMU_CAPS_DEVICE_VFIO_PCI); @@ -1698,7 +1700,7 @@ mymain(void) DO_TEST("serial-unix-chardev", QEMU_CAPS_DEVICE_ISA_SERIAL); DO_TEST_CAPS_LATEST("serial-unix-chardev"); - DO_TEST_PARSE_ERROR("serial-unix-missing-source", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("serial-unix-missing-source"); DO_TEST("serial-tcp-chardev", QEMU_CAPS_DEVICE_ISA_SERIAL); DO_TEST("serial-udp-chardev", @@ -1840,10 +1842,10 @@ mymain(void) QEMU_CAPS_USB_HUB, QEMU_CAPS_ICH9_USB_EHCI1); DO_TEST_NOCAPS("usb-none"); - DO_TEST_PARSE_ERROR("usb-none-other", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("usb-none-other"); DO_TEST_PARSE_ERROR("usb-none-hub", QEMU_CAPS_USB_HUB); - DO_TEST_PARSE_ERROR("usb-none-usbtablet", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("usb-none-usbtablet"); DO_TEST("usb-controller-default-q35", QEMU_CAPS_DEVICE_IOH3420, QEMU_CAPS_PCI_OHCI, @@ -1881,8 +1883,8 @@ mymain(void) QEMU_CAPS_DEVICE_QEMU_XHCI); DO_TEST_NOCAPS("smbios"); - DO_TEST_PARSE_ERROR("smbios-date", NONE); - DO_TEST_PARSE_ERROR("smbios-uuid-match", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("smbios-date"); + DO_TEST_PARSE_ERROR_NOCAPS("smbios-uuid-match"); DO_TEST("smbios-type-fwcfg", QEMU_CAPS_FW_CFG); DO_TEST_NOCAPS("watchdog"); @@ -1916,7 +1918,7 @@ mymain(void) DO_TEST_NOCAPS("hostdev-usb-address"); DO_TEST_NOCAPS("hostdev-usb-address-device"); DO_TEST_NOCAPS("hostdev-usb-address-device-boot"); - DO_TEST_PARSE_ERROR("hostdev-usb-duplicate", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("hostdev-usb-duplicate"); DO_TEST("hostdev-pci-address", QEMU_CAPS_DEVICE_VFIO_PCI); DO_TEST("hostdev-pci-address-device", QEMU_CAPS_DEVICE_VFIO_PCI); DO_TEST_PARSE_ERROR("hostdev-pci-duplicate", @@ -2068,11 +2070,11 @@ mymain(void) DO_TEST_NOCAPS("cpu-numa1"); DO_TEST_NOCAPS("cpu-numa2"); DO_TEST_NOCAPS("cpu-numa-no-memory-element"); - DO_TEST_PARSE_ERROR("cpu-numa3", NONE); - DO_TEST_PARSE_ERROR("cpu-numa-disjoint", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("cpu-numa3"); + DO_TEST_PARSE_ERROR_NOCAPS("cpu-numa-disjoint"); DO_TEST("cpu-numa-disjoint", QEMU_CAPS_NUMA); DO_TEST_FAILURE("cpu-numa-memshared", QEMU_CAPS_OBJECT_MEMORY_RAM); - DO_TEST_PARSE_ERROR("cpu-numa-memshared-1", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("cpu-numa-memshared-1"); DO_TEST("cpu-numa-memshared", QEMU_CAPS_OBJECT_MEMORY_FILE); DO_TEST_NOCAPS("cpu-host-model"); DO_TEST_NOCAPS("cpu-host-model-vendor"); @@ -2112,7 +2114,7 @@ mymain(void) DO_TEST("luks-disks-source-qcow2", QEMU_CAPS_OBJECT_SECRET, QEMU_CAPS_QCOW2_LUKS); DO_TEST_CAPS_VER("luks-disks-source-qcow2", "5.2.0"); DO_TEST_CAPS_LATEST("luks-disks-source-qcow2"); - DO_TEST_PARSE_ERROR("luks-disk-invalid", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("luks-disk-invalid"); DO_TEST_PARSE_ERROR("luks-disks-source-both", QEMU_CAPS_OBJECT_SECRET); DO_TEST_NOCAPS("memtune"); @@ -2121,8 +2123,8 @@ mymain(void) DO_TEST_NOCAPS("blkiotune-device"); DO_TEST_NOCAPS("cputune"); DO_TEST_NOCAPS("cputune-zero-shares"); - DO_TEST_PARSE_ERROR("cputune-iothreadsched-toomuch", NONE); - DO_TEST_PARSE_ERROR("cputune-vcpusched-overlap", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("cputune-iothreadsched-toomuch"); + DO_TEST_PARSE_ERROR_NOCAPS("cputune-vcpusched-overlap"); DO_TEST("cputune-numatune", QEMU_CAPS_KVM, QEMU_CAPS_OBJECT_IOTHREAD, @@ -2134,20 +2136,20 @@ mymain(void) DO_TEST_CAPS_LATEST("cputune-cpuset-big-id"); DO_TEST_NOCAPS("numatune-memory"); - DO_TEST_PARSE_ERROR("numatune-memory-invalid-nodeset", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("numatune-memory-invalid-nodeset"); DO_TEST("numatune-memnode", QEMU_CAPS_NUMA, QEMU_CAPS_OBJECT_MEMORY_RAM); - DO_TEST_PARSE_ERROR("numatune-memnode", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("numatune-memnode"); DO_TEST_CAPS_VER("numatune-memnode", "5.2.0"); DO_TEST_CAPS_LATEST("numatune-memnode"); - DO_TEST_PARSE_ERROR("numatune-memnode-invalid-mode", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("numatune-memnode-invalid-mode"); DO_TEST_CAPS_LATEST("numatune-memnode-restrictive-mode"); DO_TEST("numatune-memnode-no-memory", QEMU_CAPS_NUMA, QEMU_CAPS_OBJECT_MEMORY_RAM); - DO_TEST_PARSE_ERROR("numatune-memnode-no-memory", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("numatune-memnode-no-memory"); DO_TEST("numatune-distances", QEMU_CAPS_NUMA); DO_TEST_NOCAPS("numatune-no-vcpu"); @@ -2158,11 +2160,11 @@ mymain(void) QEMU_CAPS_OBJECT_MEMORY_FILE); DO_TEST_FAILURE("numatune-static-nodeset-exceed-hostnode", QEMU_CAPS_OBJECT_MEMORY_RAM); - DO_TEST_PARSE_ERROR("numatune-memnode-nocpu", NONE); - DO_TEST_PARSE_ERROR("numatune-memnodes-problematic", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("numatune-memnode-nocpu"); + DO_TEST_PARSE_ERROR_NOCAPS("numatune-memnodes-problematic"); DO_TEST_NOCAPS("numad"); DO_TEST_NOCAPS("numad-auto-vcpu-static-numatune"); - DO_TEST_PARSE_ERROR("numad-auto-vcpu-static-numatune-no-nodeset", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("numad-auto-vcpu-static-numatune-no-nodeset"); DO_TEST_NOCAPS("numad-auto-memory-vcpu-cpuset"); DO_TEST_NOCAPS("numad-auto-memory-vcpu-no-cpuset-and-placement"); DO_TEST_NOCAPS("numad-static-memory-auto-vcpu"); @@ -2188,8 +2190,8 @@ mymain(void) DO_TEST_NOCAPS("seclabel-static-labelskip"); DO_TEST_NOCAPS("seclabel-none"); DO_TEST_NOCAPS("seclabel-dac-none"); - DO_TEST_PARSE_ERROR("seclabel-multiple", NONE); - DO_TEST_PARSE_ERROR("seclabel-device-duplicates", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("seclabel-multiple"); + DO_TEST_PARSE_ERROR_NOCAPS("seclabel-device-duplicates"); DO_TEST("pseries-basic", QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, @@ -2210,7 +2212,7 @@ mymain(void) DO_TEST("pseries-vio-user-assigned", QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, QEMU_CAPS_DEVICE_SPAPR_VTY); - DO_TEST_PARSE_ERROR("pseries-vio-address-clash", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("pseries-vio-address-clash"); DO_TEST("pseries-nvram", QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, QEMU_CAPS_DEVICE_NVRAM); @@ -2221,7 +2223,7 @@ mymain(void) DO_TEST("pseries-cpu-exact", QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, QEMU_CAPS_DEVICE_SPAPR_VTY); - DO_TEST_PARSE_ERROR("pseries-no-parallel", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("pseries-no-parallel"); qemuTestSetHostArch(&driver, VIR_ARCH_PPC64); DO_TEST("pseries-cpu-compat", QEMU_CAPS_KVM, @@ -2270,9 +2272,9 @@ mymain(void) QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, QEMU_CAPS_SPAPR_PCI_HOST_BRIDGE_NUMA_NODE); - DO_TEST_PARSE_ERROR("pseries-phb-invalid-target-index-1", NONE); - DO_TEST_PARSE_ERROR("pseries-phb-invalid-target-index-2", NONE); - DO_TEST_PARSE_ERROR("pseries-phb-invalid-target-index-3", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("pseries-phb-invalid-target-index-1"); + DO_TEST_PARSE_ERROR_NOCAPS("pseries-phb-invalid-target-index-2"); + DO_TEST_PARSE_ERROR_NOCAPS("pseries-phb-invalid-target-index-3"); DO_TEST("pseries-many-devices", QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, @@ -2384,7 +2386,7 @@ mymain(void) QEMU_CAPS_MACHINE_PSERIES_CAP_CFPC, QEMU_CAPS_MACHINE_PSERIES_CAP_SBBC); - DO_TEST_PARSE_ERROR("pseries-features-invalid-machine", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("pseries-features-invalid-machine"); DO_TEST("pseries-serial-native", QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, @@ -2407,8 +2409,8 @@ mymain(void) QEMU_CAPS_DEVICE_SPAPR_VTY); DO_TEST("pseries-console-virtio", QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE); - DO_TEST_PARSE_ERROR("pseries-serial-invalid-machine", NONE); - DO_TEST_PARSE_ERROR("pseries-spaprvio-invalid", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("pseries-serial-invalid-machine"); + DO_TEST_PARSE_ERROR_NOCAPS("pseries-spaprvio-invalid"); DO_TEST("mach-virt-serial-native", QEMU_CAPS_DEVICE_PL011); @@ -2431,7 +2433,7 @@ mymain(void) QEMU_CAPS_DEVICE_PL011); DO_TEST("mach-virt-console-virtio", QEMU_CAPS_DEVICE_VIRTIO_MMIO); - DO_TEST_PARSE_ERROR("mach-virt-serial-invalid-machine", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("mach-virt-serial-invalid-machine"); DO_TEST_NOCAPS("disk-ide-split"); DO_TEST("disk-ide-wwn", @@ -2499,8 +2501,8 @@ mymain(void) DO_TEST_CAPS_LATEST_PARSE_ERROR("video-ramfb-display-device-pci-address"); DO_TEST("video-none-device", QEMU_CAPS_VNC); - DO_TEST_PARSE_ERROR("video-invalid-multiple-devices", NONE); - DO_TEST_PARSE_ERROR("default-video-type-x86_64-caps-test-0", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("video-invalid-multiple-devices"); + DO_TEST_PARSE_ERROR_NOCAPS("default-video-type-x86_64-caps-test-0"); DO_TEST_CAPS_ARCH_LATEST("default-video-type-aarch64", "aarch64"); DO_TEST_CAPS_ARCH_LATEST("default-video-type-ppc64", "ppc64"); @@ -2567,12 +2569,12 @@ mymain(void) DO_TEST_CAPS_LATEST("tpm-emulator-tpm2-pstate"); DO_TEST_CAPS_LATEST_PPC64("tpm-emulator-spapr"); DO_TEST_CAPS_ARCH_LATEST("aarch64-tpm", "aarch64"); - DO_TEST_PARSE_ERROR("aarch64-tpm-wrong-model", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("aarch64-tpm-wrong-model"); - DO_TEST_PARSE_ERROR("pci-domain-invalid", NONE); - DO_TEST_PARSE_ERROR("pci-bus-invalid", NONE); - DO_TEST_PARSE_ERROR("pci-slot-invalid", NONE); - DO_TEST_PARSE_ERROR("pci-function-invalid", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("pci-domain-invalid"); + DO_TEST_PARSE_ERROR_NOCAPS("pci-bus-invalid"); + DO_TEST_PARSE_ERROR_NOCAPS("pci-slot-invalid"); + DO_TEST_PARSE_ERROR_NOCAPS("pci-function-invalid"); DO_TEST("pci-bridge", QEMU_CAPS_DEVICE_PCI_BRIDGE, @@ -2802,8 +2804,8 @@ mymain(void) QEMU_CAPS_ICH9_AHCI, QEMU_CAPS_ICH9_USB_EHCI1, QEMU_CAPS_DEVICE_QXL); - DO_TEST_PARSE_ERROR("440fx-wrong-root", NONE); - DO_TEST_PARSE_ERROR("440fx-ide-address-conflict", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("440fx-wrong-root"); + DO_TEST_PARSE_ERROR_NOCAPS("440fx-ide-address-conflict"); DO_TEST_PARSE_ERROR("pcie-root-port-too-many", QEMU_CAPS_DEVICE_IOH3420, @@ -2872,16 +2874,16 @@ mymain(void) DO_TEST_CAPS_LATEST("mlock-on"); DO_TEST_CAPS_LATEST("mlock-off"); - DO_TEST_PARSE_ERROR("pci-bridge-negative-index-invalid", NONE); - DO_TEST_PARSE_ERROR("pci-bridge-duplicate-index", NONE); - DO_TEST_PARSE_ERROR("pci-root-nonzero-index", NONE); - DO_TEST_PARSE_ERROR("pci-root-address", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("pci-bridge-negative-index-invalid"); + DO_TEST_PARSE_ERROR_NOCAPS("pci-bridge-duplicate-index"); + DO_TEST_PARSE_ERROR_NOCAPS("pci-root-nonzero-index"); + DO_TEST_PARSE_ERROR_NOCAPS("pci-root-address"); DO_TEST("hotplug-base", QEMU_CAPS_KVM, QEMU_CAPS_VIRTIO_SCSI); DO_TEST("pcihole64", QEMU_CAPS_I440FX_PCI_HOLE64_SIZE); - DO_TEST_PARSE_ERROR("pcihole64-none", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("pcihole64-none"); DO_TEST("pcihole64-q35", QEMU_CAPS_DEVICE_IOH3420, QEMU_CAPS_ICH9_AHCI, @@ -3047,7 +3049,7 @@ mymain(void) DO_TEST_NOCAPS("aarch64-acpi-uefi"); DO_TEST_NOCAPS("aarch64-noacpi-uefi"); DO_TEST_NOCAPS("aarch64-noacpi-nouefi"); - DO_TEST_PARSE_ERROR("aarch64-acpi-nouefi", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("aarch64-acpi-nouefi"); /* QEMU 4.0.0 didn't have support for aarch64 CPU features */ DO_TEST_CAPS_ARCH_VER_FAILURE("aarch64-features-sve", "aarch64", "4.0.0"); @@ -3080,14 +3082,14 @@ mymain(void) DO_TEST("shmem-plain-doorbell", QEMU_CAPS_DEVICE_IVSHMEM, QEMU_CAPS_DEVICE_IVSHMEM_PLAIN, QEMU_CAPS_DEVICE_IVSHMEM_DOORBELL); - DO_TEST_PARSE_ERROR("shmem", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("shmem"); DO_TEST_FAILURE("shmem-invalid-size", QEMU_CAPS_DEVICE_IVSHMEM); DO_TEST_FAILURE("shmem-invalid-address", QEMU_CAPS_DEVICE_IVSHMEM); DO_TEST_FAILURE("shmem-small-size", QEMU_CAPS_DEVICE_IVSHMEM); - DO_TEST_PARSE_ERROR("shmem-msi-only", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("shmem-msi-only"); DO_TEST("cpu-host-passthrough-features", QEMU_CAPS_KVM); DO_TEST_FAILURE("memory-align-fail", NONE); @@ -3356,12 +3358,12 @@ mymain(void) DO_TEST_CAPS_LATEST("virtio-options-rng-packed"); DO_TEST_CAPS_LATEST("virtio-options-video-packed"); DO_TEST_PARSE_ERROR("virtio-options-controller-iommu", QEMU_CAPS_VIRTIO_SCSI); - DO_TEST_PARSE_ERROR("virtio-options-disk-iommu", NONE); - DO_TEST_PARSE_ERROR("virtio-options-fs-iommu", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("virtio-options-disk-iommu"); + DO_TEST_PARSE_ERROR_NOCAPS("virtio-options-fs-iommu"); DO_TEST_PARSE_ERROR("virtio-options-input-iommu", QEMU_CAPS_VIRTIO_MOUSE, QEMU_CAPS_VIRTIO_KEYBOARD); - DO_TEST_PARSE_ERROR("virtio-options-net-iommu", NONE); - DO_TEST_PARSE_ERROR("virtio-options-memballoon-iommu", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("virtio-options-net-iommu"); + DO_TEST_PARSE_ERROR_NOCAPS("virtio-options-memballoon-iommu"); DO_TEST_PARSE_ERROR("virtio-options-rng-iommu", QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM); DO_TEST_PARSE_ERROR("virtio-options-video-iommu", QEMU_CAPS_DEVICE_VIRTIO_GPU, @@ -3369,12 +3371,12 @@ mymain(void) QEMU_CAPS_VIRTIO_GPU_VIRGL, QEMU_CAPS_DEVICE_VHOST_USER_GPU); DO_TEST_PARSE_ERROR("virtio-options-controller-ats", QEMU_CAPS_VIRTIO_SCSI); - DO_TEST_PARSE_ERROR("virtio-options-disk-ats", NONE); - DO_TEST_PARSE_ERROR("virtio-options-fs-ats", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("virtio-options-disk-ats"); + DO_TEST_PARSE_ERROR_NOCAPS("virtio-options-fs-ats"); DO_TEST_PARSE_ERROR("virtio-options-input-ats", QEMU_CAPS_VIRTIO_MOUSE, QEMU_CAPS_VIRTIO_KEYBOARD); - DO_TEST_PARSE_ERROR("virtio-options-memballoon-ats", NONE); - DO_TEST_PARSE_ERROR("virtio-options-net-ats", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("virtio-options-memballoon-ats"); + DO_TEST_PARSE_ERROR_NOCAPS("virtio-options-net-ats"); DO_TEST_PARSE_ERROR("virtio-options-rng-ats", QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM); DO_TEST_PARSE_ERROR("virtio-options-video-ats", QEMU_CAPS_DEVICE_VIRTIO_GPU, @@ -3382,13 +3384,13 @@ mymain(void) QEMU_CAPS_VIRTIO_GPU_VIRGL, QEMU_CAPS_DEVICE_VHOST_USER_GPU); DO_TEST_PARSE_ERROR("virtio-options-controller-packed", QEMU_CAPS_VIRTIO_SCSI); - DO_TEST_PARSE_ERROR("virtio-options-disk-packed", NONE); - DO_TEST_PARSE_ERROR("virtio-options-fs-packed", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("virtio-options-disk-packed"); + DO_TEST_PARSE_ERROR_NOCAPS("virtio-options-fs-packed"); DO_TEST_PARSE_ERROR("virtio-options-input-packed", QEMU_CAPS_VIRTIO_MOUSE, QEMU_CAPS_VIRTIO_KEYBOARD); - DO_TEST_PARSE_ERROR("virtio-options-memballoon-packed", NONE); - DO_TEST_PARSE_ERROR("virtio-options-memballoon-freepage-reporting", NONE); - DO_TEST_PARSE_ERROR("virtio-options-net-packed", NONE); + DO_TEST_PARSE_ERROR_NOCAPS("virtio-options-memballoon-packed"); + DO_TEST_PARSE_ERROR_NOCAPS("virtio-options-memballoon-freepage-reporting"); + DO_TEST_PARSE_ERROR_NOCAPS("virtio-options-net-packed"); DO_TEST_PARSE_ERROR("virtio-options-rng-packed", QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM); DO_TEST_PARSE_ERROR("virtio-options-video-packed", QEMU_CAPS_DEVICE_VIRTIO_GPU, -- 2.31.1

Add a explicit version of our test invocation macro for tests which use no capabilities. This removes the usage of the somewhat anonymous 'NONE' macro and will lead to simplification of the code later. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/qemuxml2argvtest.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 0f7e7e811d..80ae2aa329 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1025,6 +1025,8 @@ mymain(void) DO_TEST_FULL(name, "", \ ARG_FLAGS, FLAG_EXPECT_FAILURE, \ ARG_QEMU_CAPS, __VA_ARGS__, QEMU_CAPS_LAST, ARG_END) +# define DO_TEST_FAILURE_NOCAPS(name) \ + DO_TEST_FULL(name, "", ARG_FLAGS, FLAG_EXPECT_FAILURE, ARG_END) # define DO_TEST_PARSE_ERROR(name, ...) \ DO_TEST_FULL(name, "", \ @@ -1035,8 +1037,6 @@ mymain(void) ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR | FLAG_EXPECT_FAILURE, \ ARG_END) -# define NONE QEMU_CAPS_LAST - /* Unset or set all envvars here that are copied in qemudBuildCommandLine * using ADD_ENV_COPY, otherwise these tests may fail due to unexpected * values for these envvars */ @@ -1390,7 +1390,7 @@ mymain(void) DO_TEST_CAPS_LATEST("disk-network-gluster"); DO_TEST_CAPS_VER("disk-network-rbd", "2.12.0"); DO_TEST_CAPS_LATEST("disk-network-rbd"); - DO_TEST_FAILURE("disk-network-rbd-no-colon", NONE); + DO_TEST_FAILURE_NOCAPS("disk-network-rbd-no-colon"); DO_TEST_NOCAPS("disk-network-sheepdog"); DO_TEST_CAPS_VER("disk-network-sheepdog", "2.12.0"); DO_TEST_CAPS_VER("disk-network-sheepdog", "6.0.0"); @@ -1620,7 +1620,7 @@ mymain(void) DO_TEST("net-vhostuser", QEMU_CAPS_CHARDEV_FD_PASS); DO_TEST_CAPS_LATEST("net-vhostuser"); DO_TEST_NOCAPS("net-vhostuser-multiq"); - DO_TEST_FAILURE("net-vhostuser-fail", NONE); + DO_TEST_FAILURE_NOCAPS("net-vhostuser-fail"); DO_TEST_NOCAPS("net-user"); DO_TEST_CAPS_ARCH_VER_FULL("net-user", "x86_64", "4.0.0", ARG_FLAGS, FLAG_SLIRP_HELPER); DO_TEST_NOCAPS("net-user-addr"); @@ -1878,7 +1878,7 @@ mymain(void) QEMU_CAPS_NEC_USB_XHCI, QEMU_CAPS_NEC_USB_XHCI_PORTS); DO_TEST("usb-controller-qemu-xhci", QEMU_CAPS_DEVICE_QEMU_XHCI); - DO_TEST_FAILURE("usb-controller-qemu-xhci-unavailable", NONE); + DO_TEST_FAILURE_NOCAPS("usb-controller-qemu-xhci-unavailable"); DO_TEST_PARSE_ERROR("usb-controller-qemu-xhci-limit", QEMU_CAPS_DEVICE_QEMU_XHCI); @@ -2047,7 +2047,7 @@ mymain(void) DO_TEST("iothreads", QEMU_CAPS_OBJECT_IOTHREAD); DO_TEST("iothreads-ids", QEMU_CAPS_OBJECT_IOTHREAD); DO_TEST("iothreads-ids-partial", QEMU_CAPS_OBJECT_IOTHREAD); - DO_TEST_FAILURE("iothreads-nocap", NONE); + DO_TEST_FAILURE_NOCAPS("iothreads-nocap"); DO_TEST("iothreads-disk", QEMU_CAPS_OBJECT_IOTHREAD); DO_TEST("iothreads-disk-virtio-ccw", QEMU_CAPS_OBJECT_IOTHREAD, QEMU_CAPS_CCW); @@ -3092,7 +3092,7 @@ mymain(void) DO_TEST_PARSE_ERROR_NOCAPS("shmem-msi-only"); DO_TEST("cpu-host-passthrough-features", QEMU_CAPS_KVM); - DO_TEST_FAILURE("memory-align-fail", NONE); + DO_TEST_FAILURE_NOCAPS("memory-align-fail"); DO_TEST_PARSE_ERROR("memory-hotplug-nonuma", QEMU_CAPS_DEVICE_PC_DIMM); DO_TEST_NOCAPS("memory-hotplug"); DO_TEST("memory-hotplug", QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA); -- 2.31.1

Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/qemuxml2xmltest.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 9652d2a7ce..598c5d8e70 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -151,9 +151,7 @@ mymain(void) static struct testQemuInfo info = { \ .name = _name, \ }; \ - if (testQemuInfoSetArgs(&info, capscache, capslatest, \ - __VA_ARGS__, \ - ARG_END) < 0 || \ + if (testQemuInfoSetArgs(&info, capscache, capslatest, __VA_ARGS__) < 0 || \ qemuTestCapsCacheInsert(driver.qemuCapsCache, info.qemuCaps) < 0) { \ VIR_TEST_DEBUG("Failed to generate test data for '%s'", _name); \ ret = -1; \ @@ -179,7 +177,8 @@ mymain(void) DO_TEST_INTERNAL(name, "." arch "-" ver, WHEN_BOTH, \ ARG_CAPS_ARCH, arch, \ ARG_CAPS_VER, ver, \ - __VA_ARGS__) + __VA_ARGS__, \ + ARG_END) #define DO_TEST_CAPS_ARCH_LATEST_FULL(name, arch, ...) \ DO_TEST_CAPS_INTERNAL(name, arch, "latest", __VA_ARGS__) @@ -200,7 +199,7 @@ mymain(void) DO_TEST_CAPS_ARCH_VER(name, "x86_64", ver) #define DO_TEST_FULL(name, when, ...) \ - DO_TEST_INTERNAL(name, "", when, __VA_ARGS__) + DO_TEST_INTERNAL(name, "", when, __VA_ARGS__, ARG_END) #define DO_TEST(name, ...) \ DO_TEST_FULL(name, WHEN_BOTH, \ -- 2.31.1

'DO_TEST_FULL' isn't a useful wrapper any more. Use the better name for the main macro and replace all uses. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/qemuxml2xmltest.c | 132 ++++++++++++++++++++-------------------- 1 file changed, 65 insertions(+), 67 deletions(-) diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 598c5d8e70..529a4b5485 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -146,7 +146,7 @@ mymain(void) virSetConnectSecret(conn); virSetConnectStorage(conn); -#define DO_TEST_INTERNAL(_name, suffix, when, ...) \ +#define DO_TEST_FULL(_name, suffix, when, ...) \ do { \ static struct testQemuInfo info = { \ .name = _name, \ @@ -174,11 +174,11 @@ mymain(void) } while (0) #define DO_TEST_CAPS_INTERNAL(name, arch, ver, ...) \ - DO_TEST_INTERNAL(name, "." arch "-" ver, WHEN_BOTH, \ - ARG_CAPS_ARCH, arch, \ - ARG_CAPS_VER, ver, \ - __VA_ARGS__, \ - ARG_END) + DO_TEST_FULL(name, "." arch "-" ver, WHEN_BOTH, \ + ARG_CAPS_ARCH, arch, \ + ARG_CAPS_VER, ver, \ + __VA_ARGS__, \ + ARG_END) #define DO_TEST_CAPS_ARCH_LATEST_FULL(name, arch, ...) \ DO_TEST_CAPS_INTERNAL(name, arch, "latest", __VA_ARGS__) @@ -198,12 +198,9 @@ mymain(void) #define DO_TEST_CAPS_VER(name, ver) \ DO_TEST_CAPS_ARCH_VER(name, "x86_64", ver) -#define DO_TEST_FULL(name, when, ...) \ - DO_TEST_INTERNAL(name, "", when, __VA_ARGS__, ARG_END) - #define DO_TEST(name, ...) \ - DO_TEST_FULL(name, WHEN_BOTH, \ - ARG_QEMU_CAPS, __VA_ARGS__, QEMU_CAPS_LAST) + DO_TEST_FULL(name, "", WHEN_BOTH, \ + ARG_QEMU_CAPS, __VA_ARGS__, QEMU_CAPS_LAST, ARG_END) #define NONE QEMU_CAPS_LAST @@ -620,24 +617,25 @@ mymain(void) DO_TEST_CAPS_ARCH_LATEST("ppc64-tpmproxy-single", "ppc64"); DO_TEST_CAPS_ARCH_LATEST("ppc64-tpmproxy-with-tpm", "ppc64"); - DO_TEST_FULL("seclabel-dynamic-baselabel", WHEN_INACTIVE, - ARG_QEMU_CAPS, NONE); - DO_TEST_FULL("seclabel-dynamic-override", WHEN_INACTIVE, - ARG_QEMU_CAPS, NONE); - DO_TEST_FULL("seclabel-dynamic-labelskip", WHEN_INACTIVE, - ARG_QEMU_CAPS, NONE); - DO_TEST_FULL("seclabel-dynamic-relabel", WHEN_INACTIVE, - ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("seclabel-dynamic-baselabel", "", WHEN_INACTIVE, + ARG_QEMU_CAPS, NONE, ARG_END); + DO_TEST_FULL("seclabel-dynamic-override", "", WHEN_INACTIVE, + ARG_QEMU_CAPS, NONE, ARG_END); + DO_TEST_FULL("seclabel-dynamic-labelskip", "", WHEN_INACTIVE, + ARG_QEMU_CAPS, NONE, ARG_END); + DO_TEST_FULL("seclabel-dynamic-relabel", "", WHEN_INACTIVE, + ARG_QEMU_CAPS, NONE, ARG_END); DO_TEST("seclabel-static", NONE); DO_TEST("seclabel-static-labelskip", NONE); DO_TEST("seclabel-none", NONE); DO_TEST("seclabel-dac-none", NONE); DO_TEST("seclabel-dynamic-none", NONE); DO_TEST("seclabel-device-multiple", NONE); - DO_TEST_FULL("seclabel-dynamic-none-relabel", WHEN_INACTIVE, + DO_TEST_FULL("seclabel-dynamic-none-relabel", "", WHEN_INACTIVE, ARG_QEMU_CAPS, QEMU_CAPS_DEVICE_CIRRUS_VGA, QEMU_CAPS_OBJECT_MEMORY_FILE, - QEMU_CAPS_SPICE, NONE); + QEMU_CAPS_SPICE, NONE, + ARG_END); DO_TEST("numad-static-vcpu-no-numatune", NONE); DO_TEST("disk-scsi-lun-passthrough-sgio", @@ -1163,69 +1161,69 @@ mymain(void) QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_VNC); - DO_TEST_FULL("aarch64-gic-none", WHEN_BOTH, + DO_TEST_FULL("aarch64-gic-none", "", WHEN_BOTH, ARG_GIC, GIC_NONE, - ARG_QEMU_CAPS, NONE); - DO_TEST_FULL("aarch64-gic-none-v2", WHEN_BOTH, + ARG_QEMU_CAPS, NONE, ARG_END); + DO_TEST_FULL("aarch64-gic-none-v2", "", WHEN_BOTH, ARG_GIC, GIC_V2, - ARG_QEMU_CAPS, NONE); - DO_TEST_FULL("aarch64-gic-none-v3", WHEN_BOTH, + ARG_QEMU_CAPS, NONE, ARG_END); + DO_TEST_FULL("aarch64-gic-none-v3", "", WHEN_BOTH, ARG_GIC, GIC_V3, - ARG_QEMU_CAPS, NONE); - DO_TEST_FULL("aarch64-gic-none-both", WHEN_BOTH, + ARG_QEMU_CAPS, NONE, ARG_END); + DO_TEST_FULL("aarch64-gic-none-both", "", WHEN_BOTH, ARG_GIC, GIC_BOTH, - ARG_QEMU_CAPS, NONE); - DO_TEST_FULL("aarch64-gic-none-tcg", WHEN_BOTH, + ARG_QEMU_CAPS, NONE, ARG_END); + DO_TEST_FULL("aarch64-gic-none-tcg", "", WHEN_BOTH, ARG_GIC, GIC_BOTH, - ARG_QEMU_CAPS, NONE); - DO_TEST_FULL("aarch64-gic-default", WHEN_BOTH, + ARG_QEMU_CAPS, NONE, ARG_END); + DO_TEST_FULL("aarch64-gic-default", "", WHEN_BOTH, ARG_GIC, GIC_NONE, - ARG_QEMU_CAPS, NONE); - DO_TEST_FULL("aarch64-gic-default-v2", WHEN_BOTH, + ARG_QEMU_CAPS, NONE, ARG_END); + DO_TEST_FULL("aarch64-gic-default-v2", "", WHEN_BOTH, ARG_GIC, GIC_V2, - ARG_QEMU_CAPS, NONE); - DO_TEST_FULL("aarch64-gic-default-v3", WHEN_BOTH, + ARG_QEMU_CAPS, NONE, ARG_END); + DO_TEST_FULL("aarch64-gic-default-v3", "", WHEN_BOTH, ARG_GIC, GIC_V3, - ARG_QEMU_CAPS, NONE); - DO_TEST_FULL("aarch64-gic-default-both", WHEN_BOTH, + ARG_QEMU_CAPS, NONE, ARG_END); + DO_TEST_FULL("aarch64-gic-default-both", "", WHEN_BOTH, ARG_GIC, GIC_BOTH, - ARG_QEMU_CAPS, NONE); - DO_TEST_FULL("aarch64-gic-v2", WHEN_BOTH, + ARG_QEMU_CAPS, NONE, ARG_END); + DO_TEST_FULL("aarch64-gic-v2", "", WHEN_BOTH, ARG_GIC, GIC_NONE, - ARG_QEMU_CAPS, NONE); - DO_TEST_FULL("aarch64-gic-v2", WHEN_BOTH, + ARG_QEMU_CAPS, NONE, ARG_END); + DO_TEST_FULL("aarch64-gic-v2", "", WHEN_BOTH, ARG_GIC, GIC_V2, - ARG_QEMU_CAPS, NONE); - DO_TEST_FULL("aarch64-gic-v2", WHEN_BOTH, + ARG_QEMU_CAPS, NONE, ARG_END); + DO_TEST_FULL("aarch64-gic-v2", "", WHEN_BOTH, ARG_GIC, GIC_V3, - ARG_QEMU_CAPS, NONE); - DO_TEST_FULL("aarch64-gic-v2", WHEN_BOTH, + ARG_QEMU_CAPS, NONE, ARG_END); + DO_TEST_FULL("aarch64-gic-v2", "", WHEN_BOTH, ARG_GIC, GIC_BOTH, - ARG_QEMU_CAPS, NONE); - DO_TEST_FULL("aarch64-gic-v3", WHEN_BOTH, + ARG_QEMU_CAPS, NONE, ARG_END); + DO_TEST_FULL("aarch64-gic-v3", "", WHEN_BOTH, ARG_GIC, GIC_NONE, - ARG_QEMU_CAPS, NONE); - DO_TEST_FULL("aarch64-gic-v3", WHEN_BOTH, + ARG_QEMU_CAPS, NONE, ARG_END); + DO_TEST_FULL("aarch64-gic-v3", "", WHEN_BOTH, ARG_GIC, GIC_V2, - ARG_QEMU_CAPS, NONE); - DO_TEST_FULL("aarch64-gic-v3", WHEN_BOTH, + ARG_QEMU_CAPS, NONE, ARG_END); + DO_TEST_FULL("aarch64-gic-v3", "", WHEN_BOTH, ARG_GIC, GIC_V3, - ARG_QEMU_CAPS, NONE); - DO_TEST_FULL("aarch64-gic-v3", WHEN_BOTH, + ARG_QEMU_CAPS, NONE, ARG_END); + DO_TEST_FULL("aarch64-gic-v3", "", WHEN_BOTH, ARG_GIC, GIC_BOTH, - ARG_QEMU_CAPS, NONE); - DO_TEST_FULL("aarch64-gic-host", WHEN_BOTH, + ARG_QEMU_CAPS, NONE, ARG_END); + DO_TEST_FULL("aarch64-gic-host", "", WHEN_BOTH, ARG_GIC, GIC_NONE, - ARG_QEMU_CAPS, NONE); - DO_TEST_FULL("aarch64-gic-host", WHEN_BOTH, + ARG_QEMU_CAPS, NONE, ARG_END); + DO_TEST_FULL("aarch64-gic-host", "", WHEN_BOTH, ARG_GIC, GIC_V2, - ARG_QEMU_CAPS, NONE); - DO_TEST_FULL("aarch64-gic-host", WHEN_BOTH, + ARG_QEMU_CAPS, NONE, ARG_END); + DO_TEST_FULL("aarch64-gic-host", "", WHEN_BOTH, ARG_GIC, GIC_V3, - ARG_QEMU_CAPS, NONE); - DO_TEST_FULL("aarch64-gic-host", WHEN_BOTH, + ARG_QEMU_CAPS, NONE, ARG_END); + DO_TEST_FULL("aarch64-gic-host", "", WHEN_BOTH, ARG_GIC, GIC_BOTH, - ARG_QEMU_CAPS, NONE); + ARG_QEMU_CAPS, NONE, ARG_END); /* SVE aarch64 CPU features work on modern QEMU */ DO_TEST_CAPS_ARCH_LATEST("aarch64-features-sve", "aarch64"); @@ -1233,13 +1231,13 @@ mymain(void) DO_TEST("memory-hotplug-ppc64-nonuma", QEMU_CAPS_KVM, QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA, QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE); - DO_TEST_FULL("memory-hotplug-ppc64-nonuma-abi-update", WHEN_BOTH, + DO_TEST_FULL("memory-hotplug-ppc64-nonuma-abi-update", "", WHEN_BOTH, ARG_PARSEFLAGS, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE, ARG_QEMU_CAPS, QEMU_CAPS_KVM, QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA, QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, QEMU_CAPS_OBJECT_MEMORY_RAM, - QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_LAST); + QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_LAST, ARG_END); DO_TEST("memory-hotplug", NONE); DO_TEST("memory-hotplug-dimm", QEMU_CAPS_DEVICE_PC_DIMM); DO_TEST("memory-hotplug-nvdimm", QEMU_CAPS_DEVICE_NVDIMM); @@ -1252,13 +1250,13 @@ mymain(void) DO_TEST("memory-hotplug-nvdimm-ppc64", QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_DEVICE_NVDIMM); - DO_TEST_FULL("memory-hotplug-nvdimm-ppc64-abi-update", WHEN_BOTH, + DO_TEST_FULL("memory-hotplug-nvdimm-ppc64-abi-update", "", WHEN_BOTH, ARG_PARSEFLAGS, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE, ARG_QEMU_CAPS, QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_DEVICE_NVDIMM, - QEMU_CAPS_LAST); + QEMU_CAPS_LAST, ARG_END); DO_TEST_CAPS_LATEST("memory-hotplug-virtio-pmem"); DO_TEST("net-udp", NONE); -- 2.31.1

Since qemuCaps are now always allocated we don't need to pass ARG_QEMU_CAPS, QEMU_CAPS_LAST to force the allocation. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/qemuxml2xmltest.c | 96 +++++++++++------------------------------ 1 file changed, 25 insertions(+), 71 deletions(-) diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 529a4b5485..ae73daea5c 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -617,14 +617,10 @@ mymain(void) DO_TEST_CAPS_ARCH_LATEST("ppc64-tpmproxy-single", "ppc64"); DO_TEST_CAPS_ARCH_LATEST("ppc64-tpmproxy-with-tpm", "ppc64"); - DO_TEST_FULL("seclabel-dynamic-baselabel", "", WHEN_INACTIVE, - ARG_QEMU_CAPS, NONE, ARG_END); - DO_TEST_FULL("seclabel-dynamic-override", "", WHEN_INACTIVE, - ARG_QEMU_CAPS, NONE, ARG_END); - DO_TEST_FULL("seclabel-dynamic-labelskip", "", WHEN_INACTIVE, - ARG_QEMU_CAPS, NONE, ARG_END); - DO_TEST_FULL("seclabel-dynamic-relabel", "", WHEN_INACTIVE, - ARG_QEMU_CAPS, NONE, ARG_END); + DO_TEST_FULL("seclabel-dynamic-baselabel", "", WHEN_INACTIVE, ARG_END); + DO_TEST_FULL("seclabel-dynamic-override", "", WHEN_INACTIVE, ARG_END); + DO_TEST_FULL("seclabel-dynamic-labelskip", "", WHEN_INACTIVE, ARG_END); + DO_TEST_FULL("seclabel-dynamic-relabel", "", WHEN_INACTIVE, ARG_END); DO_TEST("seclabel-static", NONE); DO_TEST("seclabel-static-labelskip", NONE); DO_TEST("seclabel-none", NONE); @@ -1161,69 +1157,27 @@ mymain(void) QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_VNC); - DO_TEST_FULL("aarch64-gic-none", "", WHEN_BOTH, - ARG_GIC, GIC_NONE, - ARG_QEMU_CAPS, NONE, ARG_END); - DO_TEST_FULL("aarch64-gic-none-v2", "", WHEN_BOTH, - ARG_GIC, GIC_V2, - ARG_QEMU_CAPS, NONE, ARG_END); - DO_TEST_FULL("aarch64-gic-none-v3", "", WHEN_BOTH, - ARG_GIC, GIC_V3, - ARG_QEMU_CAPS, NONE, ARG_END); - DO_TEST_FULL("aarch64-gic-none-both", "", WHEN_BOTH, - ARG_GIC, GIC_BOTH, - ARG_QEMU_CAPS, NONE, ARG_END); - DO_TEST_FULL("aarch64-gic-none-tcg", "", WHEN_BOTH, - ARG_GIC, GIC_BOTH, - ARG_QEMU_CAPS, NONE, ARG_END); - DO_TEST_FULL("aarch64-gic-default", "", WHEN_BOTH, - ARG_GIC, GIC_NONE, - ARG_QEMU_CAPS, NONE, ARG_END); - DO_TEST_FULL("aarch64-gic-default-v2", "", WHEN_BOTH, - ARG_GIC, GIC_V2, - ARG_QEMU_CAPS, NONE, ARG_END); - DO_TEST_FULL("aarch64-gic-default-v3", "", WHEN_BOTH, - ARG_GIC, GIC_V3, - ARG_QEMU_CAPS, NONE, ARG_END); - DO_TEST_FULL("aarch64-gic-default-both", "", WHEN_BOTH, - ARG_GIC, GIC_BOTH, - ARG_QEMU_CAPS, NONE, ARG_END); - DO_TEST_FULL("aarch64-gic-v2", "", WHEN_BOTH, - ARG_GIC, GIC_NONE, - ARG_QEMU_CAPS, NONE, ARG_END); - DO_TEST_FULL("aarch64-gic-v2", "", WHEN_BOTH, - ARG_GIC, GIC_V2, - ARG_QEMU_CAPS, NONE, ARG_END); - DO_TEST_FULL("aarch64-gic-v2", "", WHEN_BOTH, - ARG_GIC, GIC_V3, - ARG_QEMU_CAPS, NONE, ARG_END); - DO_TEST_FULL("aarch64-gic-v2", "", WHEN_BOTH, - ARG_GIC, GIC_BOTH, - ARG_QEMU_CAPS, NONE, ARG_END); - DO_TEST_FULL("aarch64-gic-v3", "", WHEN_BOTH, - ARG_GIC, GIC_NONE, - ARG_QEMU_CAPS, NONE, ARG_END); - DO_TEST_FULL("aarch64-gic-v3", "", WHEN_BOTH, - ARG_GIC, GIC_V2, - ARG_QEMU_CAPS, NONE, ARG_END); - DO_TEST_FULL("aarch64-gic-v3", "", WHEN_BOTH, - ARG_GIC, GIC_V3, - ARG_QEMU_CAPS, NONE, ARG_END); - DO_TEST_FULL("aarch64-gic-v3", "", WHEN_BOTH, - ARG_GIC, GIC_BOTH, - ARG_QEMU_CAPS, NONE, ARG_END); - DO_TEST_FULL("aarch64-gic-host", "", WHEN_BOTH, - ARG_GIC, GIC_NONE, - ARG_QEMU_CAPS, NONE, ARG_END); - DO_TEST_FULL("aarch64-gic-host", "", WHEN_BOTH, - ARG_GIC, GIC_V2, - ARG_QEMU_CAPS, NONE, ARG_END); - DO_TEST_FULL("aarch64-gic-host", "", WHEN_BOTH, - ARG_GIC, GIC_V3, - ARG_QEMU_CAPS, NONE, ARG_END); - DO_TEST_FULL("aarch64-gic-host", "", WHEN_BOTH, - ARG_GIC, GIC_BOTH, - ARG_QEMU_CAPS, NONE, ARG_END); + DO_TEST_FULL("aarch64-gic-none", "", WHEN_BOTH, ARG_GIC, GIC_NONE, ARG_END); + DO_TEST_FULL("aarch64-gic-none-v2", "", WHEN_BOTH, ARG_GIC, GIC_V2, ARG_END); + DO_TEST_FULL("aarch64-gic-none-v3", "", WHEN_BOTH, ARG_GIC, GIC_V3, ARG_END); + DO_TEST_FULL("aarch64-gic-none-both", "", WHEN_BOTH, ARG_GIC, GIC_BOTH, ARG_END); + DO_TEST_FULL("aarch64-gic-none-tcg", "", WHEN_BOTH, ARG_GIC, GIC_BOTH, ARG_END); + DO_TEST_FULL("aarch64-gic-default", "", WHEN_BOTH, ARG_GIC, GIC_NONE, ARG_END); + DO_TEST_FULL("aarch64-gic-default-v2", "", WHEN_BOTH, ARG_GIC, GIC_V2, ARG_END); + DO_TEST_FULL("aarch64-gic-default-v3", "", WHEN_BOTH, ARG_GIC, GIC_V3, ARG_END); + DO_TEST_FULL("aarch64-gic-default-both", "", WHEN_BOTH, ARG_GIC, GIC_BOTH, ARG_END); + DO_TEST_FULL("aarch64-gic-v2", "", WHEN_BOTH, ARG_GIC, GIC_NONE, ARG_END); + DO_TEST_FULL("aarch64-gic-v2", "", WHEN_BOTH, ARG_GIC, GIC_V2, ARG_END); + DO_TEST_FULL("aarch64-gic-v2", "", WHEN_BOTH, ARG_GIC, GIC_V3, ARG_END); + DO_TEST_FULL("aarch64-gic-v2", "", WHEN_BOTH, ARG_GIC, GIC_BOTH, ARG_END); + DO_TEST_FULL("aarch64-gic-v3", "", WHEN_BOTH, ARG_GIC, GIC_NONE, ARG_END); + DO_TEST_FULL("aarch64-gic-v3", "", WHEN_BOTH, ARG_GIC, GIC_V2, ARG_END); + DO_TEST_FULL("aarch64-gic-v3", "", WHEN_BOTH, ARG_GIC, GIC_V3, ARG_END); + DO_TEST_FULL("aarch64-gic-v3", "", WHEN_BOTH, ARG_GIC, GIC_BOTH, ARG_END); + DO_TEST_FULL("aarch64-gic-host", "", WHEN_BOTH, ARG_GIC, GIC_NONE, ARG_END); + DO_TEST_FULL("aarch64-gic-host", "", WHEN_BOTH, ARG_GIC, GIC_V2, ARG_END); + DO_TEST_FULL("aarch64-gic-host", "", WHEN_BOTH, ARG_GIC, GIC_V3, ARG_END); + DO_TEST_FULL("aarch64-gic-host", "", WHEN_BOTH, ARG_GIC, GIC_BOTH, ARG_END); /* SVE aarch64 CPU features work on modern QEMU */ DO_TEST_CAPS_ARCH_LATEST("aarch64-features-sve", "aarch64"); -- 2.31.1

Add a explicit version of our test invocation macro for tests which use no capabilities. This reduces the usage of the somewhat anonymous 'NONE' macro and will lead to simplification of the code later. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/qemuxml2xmltest.c | 388 ++++++++++++++++++++-------------------- 1 file changed, 195 insertions(+), 193 deletions(-) diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index ae73daea5c..c1fe74f1cc 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -201,6 +201,8 @@ mymain(void) #define DO_TEST(name, ...) \ DO_TEST_FULL(name, "", WHEN_BOTH, \ ARG_QEMU_CAPS, __VA_ARGS__, QEMU_CAPS_LAST, ARG_END) +#define DO_TEST_NOCAPS(name) \ + DO_TEST_FULL(name, "", WHEN_BOTH, ARG_END) #define NONE QEMU_CAPS_LAST @@ -211,62 +213,62 @@ mymain(void) g_unsetenv("QEMU_AUDIO_DRV"); g_unsetenv("SDL_AUDIODRIVER"); - DO_TEST("minimal", NONE); + DO_TEST_NOCAPS("minimal"); DO_TEST_CAPS_LATEST("genid"); DO_TEST_CAPS_LATEST("genid-auto"); - DO_TEST("machine-core-on", NONE); - DO_TEST("machine-core-off", NONE); + DO_TEST_NOCAPS("machine-core-on"); + DO_TEST_NOCAPS("machine-core-off"); DO_TEST("machine-loadparm-multiple-disks-nets-s390", QEMU_CAPS_CCW); - DO_TEST("default-kvm-host-arch", NONE); - DO_TEST("default-qemu-host-arch", NONE); - DO_TEST("boot-cdrom", NONE); - DO_TEST("boot-network", NONE); - DO_TEST("boot-floppy", NONE); + DO_TEST_NOCAPS("default-kvm-host-arch"); + DO_TEST_NOCAPS("default-qemu-host-arch"); + DO_TEST_NOCAPS("boot-cdrom"); + DO_TEST_NOCAPS("boot-network"); + DO_TEST_NOCAPS("boot-floppy"); DO_TEST("boot-floppy-q35", QEMU_CAPS_DEVICE_IOH3420, QEMU_CAPS_ICH9_AHCI); - DO_TEST("boot-multi", NONE); + DO_TEST_NOCAPS("boot-multi"); DO_TEST("boot-menu-enable-with-timeout", QEMU_CAPS_SPLASH_TIMEOUT); - DO_TEST("boot-menu-disable", NONE); - DO_TEST("boot-menu-disable-with-timeout", NONE); - DO_TEST("boot-order", NONE); + DO_TEST_NOCAPS("boot-menu-disable"); + DO_TEST_NOCAPS("boot-menu-disable-with-timeout"); + DO_TEST_NOCAPS("boot-order"); DO_TEST("reboot-timeout-enabled", QEMU_CAPS_REBOOT_TIMEOUT); DO_TEST("reboot-timeout-disabled", QEMU_CAPS_REBOOT_TIMEOUT); - DO_TEST("clock-utc", NONE); - DO_TEST("clock-localtime", NONE); - DO_TEST("cpu-empty", NONE); - DO_TEST("cpu-kvmclock", NONE); - DO_TEST("cpu-host-kvmclock", NONE); - DO_TEST("cpu-host-passthrough-features", NONE); - DO_TEST("cpu-host-model-features", NONE); - DO_TEST("cpu-host-model-vendor", NONE); + DO_TEST_NOCAPS("clock-utc"); + DO_TEST_NOCAPS("clock-localtime"); + DO_TEST_NOCAPS("cpu-empty"); + DO_TEST_NOCAPS("cpu-kvmclock"); + DO_TEST_NOCAPS("cpu-host-kvmclock"); + DO_TEST_NOCAPS("cpu-host-passthrough-features"); + DO_TEST_NOCAPS("cpu-host-model-features"); + DO_TEST_NOCAPS("cpu-host-model-vendor"); DO_TEST("clock-catchup", QEMU_CAPS_KVM_PIT_TICK_POLICY); - DO_TEST("kvmclock", NONE); - DO_TEST("clock-timer-hyperv-rtc", NONE); + DO_TEST_NOCAPS("kvmclock"); + DO_TEST_NOCAPS("clock-timer-hyperv-rtc"); DO_TEST_CAPS_ARCH_LATEST("clock-timer-armvtimer", "aarch64"); - DO_TEST("clock-realtime", NONE); + DO_TEST_NOCAPS("clock-realtime"); - DO_TEST("cpu-eoi-disabled", NONE); - DO_TEST("cpu-eoi-enabled", NONE); - DO_TEST("eoi-disabled", NONE); - DO_TEST("eoi-enabled", NONE); - DO_TEST("pv-spinlock-disabled", NONE); - DO_TEST("pv-spinlock-enabled", NONE); + DO_TEST_NOCAPS("cpu-eoi-disabled"); + DO_TEST_NOCAPS("cpu-eoi-enabled"); + DO_TEST_NOCAPS("eoi-disabled"); + DO_TEST_NOCAPS("eoi-enabled"); + DO_TEST_NOCAPS("pv-spinlock-disabled"); + DO_TEST_NOCAPS("pv-spinlock-enabled"); - DO_TEST("hyperv", NONE); - DO_TEST("hyperv-off", NONE); - DO_TEST("hyperv-panic", NONE); - DO_TEST("hyperv-stimer-direct", NONE); + DO_TEST_NOCAPS("hyperv"); + DO_TEST_NOCAPS("hyperv-off"); + DO_TEST_NOCAPS("hyperv-panic"); + DO_TEST_NOCAPS("hyperv-stimer-direct"); - DO_TEST("kvm-features", NONE); - DO_TEST("kvm-features-off", NONE); + DO_TEST_NOCAPS("kvm-features"); + DO_TEST_NOCAPS("kvm-features-off"); - DO_TEST("pmu-feature", NONE); - DO_TEST("pmu-feature-off", NONE); + DO_TEST_NOCAPS("pmu-feature"); + DO_TEST_NOCAPS("pmu-feature-off"); - DO_TEST("pages-discard", NONE); + DO_TEST_NOCAPS("pages-discard"); DO_TEST("pages-discard-hugepages", QEMU_CAPS_OBJECT_MEMORY_FILE); DO_TEST("pages-dimm-discard", QEMU_CAPS_DEVICE_PC_DIMM); DO_TEST("hugepages-default", QEMU_CAPS_OBJECT_MEMORY_FILE); @@ -285,40 +287,40 @@ mymain(void) QEMU_CAPS_OBJECT_MEMORY_FILE); DO_TEST("hugepages-nvdimm", QEMU_CAPS_DEVICE_NVDIMM, QEMU_CAPS_OBJECT_MEMORY_FILE); - DO_TEST("nosharepages", NONE); - DO_TEST("restore-v2", NONE); - DO_TEST("migrate", NONE); - DO_TEST("qemu-ns-no-env", NONE); + DO_TEST_NOCAPS("nosharepages"); + DO_TEST_NOCAPS("restore-v2"); + DO_TEST_NOCAPS("migrate"); + DO_TEST_NOCAPS("qemu-ns-no-env"); DO_TEST_CAPS_LATEST("qemu-ns"); - DO_TEST("disk-aio", NONE); + DO_TEST_NOCAPS("disk-aio"); DO_TEST_CAPS_LATEST("disk-aio-io_uring"); - DO_TEST("disk-cdrom", NONE); + DO_TEST_NOCAPS("disk-cdrom"); DO_TEST_CAPS_LATEST("disk-cdrom-empty-network-invalid"); DO_TEST("disk-cdrom-bus-other", QEMU_CAPS_DEVICE_USB_STORAGE); - DO_TEST("disk-floppy", NONE); + DO_TEST_NOCAPS("disk-floppy"); DO_TEST("disk-usb-device", QEMU_CAPS_DEVICE_USB_STORAGE); - DO_TEST("disk-virtio", NONE); - DO_TEST("floppy-drive-fat", NONE); + DO_TEST_NOCAPS("disk-virtio"); + DO_TEST_NOCAPS("floppy-drive-fat"); DO_TEST("disk-virtio-queues", QEMU_CAPS_VIRTIO_BLK_NUM_QUEUES); - DO_TEST("disk-boot-disk", NONE); - DO_TEST("disk-boot-cdrom", NONE); - DO_TEST("disk-error-policy", NONE); + DO_TEST_NOCAPS("disk-boot-disk"); + DO_TEST_NOCAPS("disk-boot-cdrom"); + DO_TEST_NOCAPS("disk-error-policy"); DO_TEST_CAPS_LATEST("disk-transient"); - DO_TEST("disk-fmt-qcow", NONE); + DO_TEST_NOCAPS("disk-fmt-qcow"); DO_TEST_CAPS_VER("disk-cache", "2.12.0"); DO_TEST_CAPS_LATEST("disk-cache"); DO_TEST_CAPS_LATEST("disk-metadata-cache"); - DO_TEST("disk-network-nbd", NONE); + DO_TEST_NOCAPS("disk-network-nbd"); DO_TEST("disk-network-iscsi", QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_BLOCK); - DO_TEST("disk-network-gluster", NONE); - DO_TEST("disk-network-rbd", NONE); - DO_TEST("disk-network-source-auth", NONE); - DO_TEST("disk-network-sheepdog", NONE); - DO_TEST("disk-network-vxhs", NONE); + DO_TEST_NOCAPS("disk-network-gluster"); + DO_TEST_NOCAPS("disk-network-rbd"); + DO_TEST_NOCAPS("disk-network-source-auth"); + DO_TEST_NOCAPS("disk-network-sheepdog"); + DO_TEST_NOCAPS("disk-network-vxhs"); DO_TEST_CAPS_LATEST("disk-network-nfs"); - DO_TEST("disk-network-tlsx509-nbd", NONE); - DO_TEST("disk-network-tlsx509-vxhs", NONE); + DO_TEST_NOCAPS("disk-network-tlsx509-nbd"); + DO_TEST_NOCAPS("disk-network-tlsx509-vxhs"); DO_TEST("disk-nvme", QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_QCOW2_LUKS); DO_TEST_CAPS_LATEST("disk-vhostuser"); DO_TEST_CAPS_LATEST("disk-scsi"); @@ -330,9 +332,9 @@ mymain(void) DO_TEST("disk-virtio-s390-zpci", QEMU_CAPS_DEVICE_ZPCI, QEMU_CAPS_CCW); - DO_TEST("disk-mirror-old", NONE); - DO_TEST("disk-mirror", NONE); - DO_TEST("disk-active-commit", NONE); + DO_TEST_NOCAPS("disk-mirror-old"); + DO_TEST_NOCAPS("disk-mirror"); + DO_TEST_NOCAPS("disk-active-commit"); DO_TEST("graphics-listen-network", QEMU_CAPS_DEVICE_CIRRUS_VGA, QEMU_CAPS_VNC); @@ -419,27 +421,27 @@ mymain(void) QEMU_CAPS_EGL_HEADLESS_RENDERNODE, QEMU_CAPS_EGL_HEADLESS); - DO_TEST("input-usbmouse", NONE); - DO_TEST("input-usbtablet", NONE); - DO_TEST("misc-acpi", NONE); + DO_TEST_NOCAPS("input-usbmouse"); + DO_TEST_NOCAPS("input-usbtablet"); + DO_TEST_NOCAPS("misc-acpi"); DO_TEST("misc-disable-s3", QEMU_CAPS_PIIX_DISABLE_S3); DO_TEST("misc-disable-suspends", QEMU_CAPS_PIIX_DISABLE_S3, QEMU_CAPS_PIIX_DISABLE_S4); DO_TEST("misc-enable-s4", QEMU_CAPS_PIIX_DISABLE_S4); - DO_TEST("misc-no-reboot", NONE); - DO_TEST("misc-uuid", NONE); - DO_TEST("net-vhostuser", NONE); - DO_TEST("net-user", NONE); - DO_TEST("net-user-addr", NONE); - DO_TEST("net-virtio", NONE); + DO_TEST_NOCAPS("misc-no-reboot"); + DO_TEST_NOCAPS("misc-uuid"); + DO_TEST_NOCAPS("net-vhostuser"); + DO_TEST_NOCAPS("net-user"); + DO_TEST_NOCAPS("net-user-addr"); + DO_TEST_NOCAPS("net-virtio"); DO_TEST("net-virtio-device", QEMU_CAPS_VIRTIO_TX_ALG); - DO_TEST("net-virtio-disable-offloads", NONE); - DO_TEST("net-eth", NONE); - DO_TEST("net-eth-ifname", NONE); - DO_TEST("net-eth-hostip", NONE); - DO_TEST("net-eth-unmanaged-tap", NONE); - DO_TEST("net-virtio-network-portgroup", NONE); + DO_TEST_NOCAPS("net-virtio-disable-offloads"); + DO_TEST_NOCAPS("net-eth"); + DO_TEST_NOCAPS("net-eth-ifname"); + DO_TEST_NOCAPS("net-eth-hostip"); + DO_TEST_NOCAPS("net-eth-unmanaged-tap"); + DO_TEST_NOCAPS("net-virtio-network-portgroup"); DO_TEST("net-virtio-rxtxqueuesize", QEMU_CAPS_VIRTIO_NET_RX_QUEUE_SIZE, QEMU_CAPS_VIRTIO_NET_TX_QUEUE_SIZE); @@ -453,28 +455,28 @@ mymain(void) QEMU_CAPS_VIRTIO_NET_FAILOVER, QEMU_CAPS_DEVICE_VFIO_PCI); DO_TEST_CAPS_LATEST("net-isolated-port"); - DO_TEST("net-hostdev", NONE); - DO_TEST("net-hostdev-bootorder", NONE); + DO_TEST_NOCAPS("net-hostdev"); + DO_TEST_NOCAPS("net-hostdev-bootorder"); DO_TEST("net-hostdev-vfio", QEMU_CAPS_DEVICE_VFIO_PCI); - DO_TEST("net-midonet", NONE); - DO_TEST("net-openvswitch", NONE); - DO_TEST("sound", NONE); + DO_TEST_NOCAPS("net-midonet"); + DO_TEST_NOCAPS("net-openvswitch"); + DO_TEST_NOCAPS("sound"); DO_TEST("sound-device", QEMU_CAPS_DEVICE_ICH9_INTEL_HDA, QEMU_CAPS_OBJECT_USB_AUDIO, QEMU_CAPS_HDA_MICRO, QEMU_CAPS_HDA_DUPLEX, QEMU_CAPS_HDA_OUTPUT); - DO_TEST("watchdog", NONE); + DO_TEST_NOCAPS("watchdog"); DO_TEST("net-bandwidth", QEMU_CAPS_DEVICE_VGA, QEMU_CAPS_VNC); DO_TEST("net-bandwidth2", QEMU_CAPS_DEVICE_VGA, QEMU_CAPS_VNC); DO_TEST("net-mtu", QEMU_CAPS_VIRTIO_NET_HOST_MTU); - DO_TEST("net-coalesce", NONE); - DO_TEST("net-many-models", NONE); + DO_TEST_NOCAPS("net-coalesce"); + DO_TEST_NOCAPS("net-many-models"); DO_TEST("net-vdpa", QEMU_CAPS_NETDEV_VHOST_VDPA); - DO_TEST("serial-tcp-tlsx509-chardev", NONE); - DO_TEST("serial-tcp-tlsx509-chardev-notls", NONE); + DO_TEST_NOCAPS("serial-tcp-tlsx509-chardev"); + DO_TEST_NOCAPS("serial-tcp-tlsx509-chardev-notls"); cfg->spiceTLS = true; DO_TEST("serial-spiceport", @@ -482,18 +484,18 @@ mymain(void) QEMU_CAPS_SPICE); cfg->spiceTLS = false; - DO_TEST("serial-spiceport-nospice", NONE); - DO_TEST("console-compat", NONE); - DO_TEST("console-compat2", NONE); - DO_TEST("console-virtio-many", NONE); - DO_TEST("channel-guestfwd", NONE); - DO_TEST("channel-virtio", NONE); - DO_TEST("channel-virtio-state", NONE); + DO_TEST_NOCAPS("serial-spiceport-nospice"); + DO_TEST_NOCAPS("console-compat"); + DO_TEST_NOCAPS("console-compat2"); + DO_TEST_NOCAPS("console-virtio-many"); + DO_TEST_NOCAPS("channel-guestfwd"); + DO_TEST_NOCAPS("channel-virtio"); + DO_TEST_NOCAPS("channel-virtio-state"); - DO_TEST("channel-unix-source-path", NONE); + DO_TEST_NOCAPS("channel-unix-source-path"); - DO_TEST("hostdev-usb-address", NONE); - DO_TEST("hostdev-pci-address", NONE); + DO_TEST_NOCAPS("hostdev-usb-address"); + DO_TEST_NOCAPS("hostdev-pci-address"); DO_TEST("hostdev-pci-address-unassigned", QEMU_CAPS_DEVICE_VFIO_PCI); DO_TEST("hostdev-pci-multifunction", QEMU_CAPS_DEVICE_VFIO_PCI); DO_TEST("hostdev-vfio", QEMU_CAPS_DEVICE_VFIO_PCI); @@ -529,58 +531,58 @@ mymain(void) QEMU_CAPS_DEVICE_VFIO_PCI, QEMU_CAPS_VNC); DO_TEST_CAPS_LATEST("hostdev-mdev-display-ramfb"); - DO_TEST("pci-rom", NONE); - DO_TEST("pci-rom-disabled", NONE); - DO_TEST("pci-rom-disabled-invalid", NONE); - DO_TEST("pci-serial-dev-chardev", NONE); + DO_TEST_NOCAPS("pci-rom"); + DO_TEST_NOCAPS("pci-rom-disabled"); + DO_TEST_NOCAPS("pci-rom-disabled-invalid"); + DO_TEST_NOCAPS("pci-serial-dev-chardev"); DO_TEST_CAPS_LATEST("disk-slices"); DO_TEST_CAPS_LATEST("disk-rotation"); DO_TEST("encrypted-disk", QEMU_CAPS_QCOW2_LUKS); DO_TEST("encrypted-disk-usage", QEMU_CAPS_QCOW2_LUKS); - DO_TEST("luks-disks", NONE); - DO_TEST("luks-disks-source", NONE); + DO_TEST_NOCAPS("luks-disks"); + DO_TEST_NOCAPS("luks-disks-source"); DO_TEST_CAPS_LATEST("luks-disks-source-qcow2"); - DO_TEST("memtune", NONE); - DO_TEST("memtune-unlimited", NONE); - DO_TEST("blkiotune", NONE); - DO_TEST("blkiotune-device", NONE); - DO_TEST("cputune", NONE); - DO_TEST("cputune-zero-shares", NONE); - DO_TEST("cputune-iothreadsched", NONE); - DO_TEST("cputune-iothreadsched-zeropriority", NONE); - DO_TEST("cputune-numatune", NONE); + DO_TEST_NOCAPS("memtune"); + DO_TEST_NOCAPS("memtune-unlimited"); + DO_TEST_NOCAPS("blkiotune"); + DO_TEST_NOCAPS("blkiotune-device"); + DO_TEST_NOCAPS("cputune"); + DO_TEST_NOCAPS("cputune-zero-shares"); + DO_TEST_NOCAPS("cputune-iothreadsched"); + DO_TEST_NOCAPS("cputune-iothreadsched-zeropriority"); + DO_TEST_NOCAPS("cputune-numatune"); DO_TEST("vcpu-placement-static", QEMU_CAPS_KVM, QEMU_CAPS_OBJECT_IOTHREAD); DO_TEST_CAPS_LATEST("cputune-cpuset-big-id"); DO_TEST_CAPS_LATEST("numavcpus-topology-mismatch"); - DO_TEST("smp", NONE); - DO_TEST("iothreads", NONE); - DO_TEST("iothreads-ids", NONE); - DO_TEST("iothreads-ids-partial", NONE); - DO_TEST("cputune-iothreads", NONE); - DO_TEST("iothreads-disk", NONE); + DO_TEST_NOCAPS("smp"); + DO_TEST_NOCAPS("iothreads"); + DO_TEST_NOCAPS("iothreads-ids"); + DO_TEST_NOCAPS("iothreads-ids-partial"); + DO_TEST_NOCAPS("cputune-iothreads"); + DO_TEST_NOCAPS("iothreads-disk"); DO_TEST("iothreads-disk-virtio-ccw", QEMU_CAPS_CCW); DO_TEST("iothreads-virtio-scsi-pci", QEMU_CAPS_VIRTIO_SCSI); DO_TEST("iothreads-virtio-scsi-ccw", QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_CCW); - DO_TEST("lease", NONE); - DO_TEST("event_idx", NONE); - DO_TEST("vhost_queues", NONE); - DO_TEST("interface-driver", NONE); + DO_TEST_NOCAPS("lease"); + DO_TEST_NOCAPS("event_idx"); + DO_TEST_NOCAPS("vhost_queues"); + DO_TEST_NOCAPS("interface-driver"); DO_TEST("interface-server", QEMU_CAPS_DEVICE_CIRRUS_VGA, QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_PIIX_DISABLE_S3, QEMU_CAPS_PIIX_DISABLE_S4, QEMU_CAPS_VNC); - DO_TEST("virtio-lun", NONE); + DO_TEST_NOCAPS("virtio-lun"); - DO_TEST("usb-none", NONE); - DO_TEST("usb-controller", NONE); + DO_TEST_NOCAPS("usb-none"); + DO_TEST_NOCAPS("usb-controller"); DO_TEST("usb-piix3-controller", QEMU_CAPS_PIIX3_USB_UHCI); DO_TEST("usb-controller-default-q35", @@ -621,18 +623,18 @@ mymain(void) DO_TEST_FULL("seclabel-dynamic-override", "", WHEN_INACTIVE, ARG_END); DO_TEST_FULL("seclabel-dynamic-labelskip", "", WHEN_INACTIVE, ARG_END); DO_TEST_FULL("seclabel-dynamic-relabel", "", WHEN_INACTIVE, ARG_END); - DO_TEST("seclabel-static", NONE); - DO_TEST("seclabel-static-labelskip", NONE); - DO_TEST("seclabel-none", NONE); - DO_TEST("seclabel-dac-none", NONE); - DO_TEST("seclabel-dynamic-none", NONE); - DO_TEST("seclabel-device-multiple", NONE); + DO_TEST_NOCAPS("seclabel-static"); + DO_TEST_NOCAPS("seclabel-static-labelskip"); + DO_TEST_NOCAPS("seclabel-none"); + DO_TEST_NOCAPS("seclabel-dac-none"); + DO_TEST_NOCAPS("seclabel-dynamic-none"); + DO_TEST_NOCAPS("seclabel-device-multiple"); DO_TEST_FULL("seclabel-dynamic-none-relabel", "", WHEN_INACTIVE, ARG_QEMU_CAPS, QEMU_CAPS_DEVICE_CIRRUS_VGA, QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_SPICE, NONE, ARG_END); - DO_TEST("numad-static-vcpu-no-numatune", NONE); + DO_TEST_NOCAPS("numad-static-vcpu-no-numatune"); DO_TEST("disk-scsi-lun-passthrough-sgio", QEMU_CAPS_SCSI_LSI, @@ -641,13 +643,13 @@ mymain(void) QEMU_CAPS_SCSI_BLOCK); DO_TEST("disk-scsi-disk-vpd", QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_DISK_WWN); - DO_TEST("disk-source-pool", NONE); - DO_TEST("disk-source-pool-mode", NONE); + DO_TEST_NOCAPS("disk-source-pool"); + DO_TEST_NOCAPS("disk-source-pool-mode"); DO_TEST_CAPS_LATEST("disk-discard"); DO_TEST_CAPS_LATEST("disk-detect-zeroes"); - DO_TEST("disk-serial", NONE); + DO_TEST_NOCAPS("disk-serial"); DO_TEST_CAPS_ARCH_LATEST("disk-arm-virtio-sd", "aarch64"); @@ -732,9 +734,9 @@ mymain(void) DO_TEST("pseries-console-virtio", QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE); - DO_TEST("mach-virt-serial-native", NONE); - DO_TEST("mach-virt-serial+console-native", NONE); - DO_TEST("mach-virt-serial-compat", NONE); + DO_TEST_NOCAPS("mach-virt-serial-native"); + DO_TEST_NOCAPS("mach-virt-serial+console-native"); + DO_TEST_NOCAPS("mach-virt-serial-compat"); DO_TEST("mach-virt-serial-pci", QEMU_CAPS_OBJECT_GPEX, QEMU_CAPS_DEVICE_PCIE_ROOT_PORT, @@ -751,24 +753,24 @@ mymain(void) DO_TEST("mach-virt-console-virtio", QEMU_CAPS_DEVICE_VIRTIO_MMIO); - DO_TEST("balloon-device-auto", NONE); - DO_TEST("balloon-device-period", NONE); - DO_TEST("channel-virtio-auto", NONE); - DO_TEST("console-compat-auto", NONE); + DO_TEST_NOCAPS("balloon-device-auto"); + DO_TEST_NOCAPS("balloon-device-period"); + DO_TEST_NOCAPS("channel-virtio-auto"); + DO_TEST_NOCAPS("console-compat-auto"); DO_TEST("disk-scsi-device-auto", QEMU_CAPS_SCSI_LSI); - DO_TEST("console-virtio", NONE); - DO_TEST("serial-target-port-auto", NONE); + DO_TEST_NOCAPS("console-virtio"); + DO_TEST_NOCAPS("serial-target-port-auto"); DO_TEST("graphics-listen-network2", QEMU_CAPS_DEVICE_CIRRUS_VGA, QEMU_CAPS_VNC); DO_TEST("graphics-spice-timeout", QEMU_CAPS_DEVICE_VGA, QEMU_CAPS_SPICE); - DO_TEST("numad-auto-vcpu-no-numatune", NONE); - DO_TEST("numad-auto-memory-vcpu-no-cpuset-and-placement", NONE); - DO_TEST("numad-auto-memory-vcpu-cpuset", NONE); - DO_TEST("usb-ich9-ehci-addr", NONE); + DO_TEST_NOCAPS("numad-auto-vcpu-no-numatune"); + DO_TEST_NOCAPS("numad-auto-memory-vcpu-no-cpuset-and-placement"); + DO_TEST_NOCAPS("numad-auto-memory-vcpu-cpuset"); + DO_TEST_NOCAPS("usb-ich9-ehci-addr"); DO_TEST("disk-copy_on_read", QEMU_CAPS_VIRTIO_TX_ALG); DO_TEST_CAPS_LATEST("tpm-passthrough"); DO_TEST_CAPS_LATEST("tpm-passthrough-crb"); @@ -778,8 +780,8 @@ mymain(void) DO_TEST_CAPS_LATEST("tpm-emulator-tpm2-pstate"); DO_TEST_CAPS_ARCH_LATEST("aarch64-tpm", "aarch64"); - DO_TEST("metadata", NONE); - DO_TEST("metadata-duplicate", NONE); + DO_TEST_NOCAPS("metadata"); + DO_TEST_NOCAPS("metadata-duplicate"); DO_TEST("pci-bridge", QEMU_CAPS_DEVICE_PCI_BRIDGE, @@ -1070,9 +1072,9 @@ mymain(void) DO_TEST("panic-double", QEMU_CAPS_DEVICE_PANIC); DO_TEST("panic-no-address", QEMU_CAPS_DEVICE_PANIC); - DO_TEST("disk-backing-chains", NONE); - DO_TEST("disk-backing-chains-index", NONE); - DO_TEST("disk-backing-chains-noindex", NONE); + DO_TEST_NOCAPS("disk-backing-chains"); + DO_TEST_NOCAPS("disk-backing-chains-index"); + DO_TEST_NOCAPS("disk-backing-chains-noindex"); DO_TEST_CAPS_LATEST("disk-network-http"); @@ -1080,14 +1082,14 @@ mymain(void) QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_EGD); - DO_TEST("cpu-numa1", NONE); - DO_TEST("cpu-numa2", NONE); - DO_TEST("cpu-numa-no-memory-element", NONE); - DO_TEST("cpu-numa-disordered", NONE); + DO_TEST_NOCAPS("cpu-numa1"); + DO_TEST_NOCAPS("cpu-numa2"); + DO_TEST_NOCAPS("cpu-numa-no-memory-element"); + DO_TEST_NOCAPS("cpu-numa-disordered"); DO_TEST("cpu-numa-disjoint", QEMU_CAPS_NUMA); DO_TEST("cpu-numa-memshared", QEMU_CAPS_OBJECT_MEMORY_FILE); - DO_TEST("numatune-auto-prefer", NONE); + DO_TEST_NOCAPS("numatune-auto-prefer"); DO_TEST("numatune-memnode", QEMU_CAPS_NUMA, QEMU_CAPS_OBJECT_MEMORY_FILE); DO_TEST("numatune-memnode-no-memory", QEMU_CAPS_OBJECT_MEMORY_FILE); DO_TEST("numatune-distances", QEMU_CAPS_NUMA); @@ -1095,16 +1097,16 @@ mymain(void) DO_TEST("numatune-hmat", QEMU_CAPS_NUMA_HMAT, QEMU_CAPS_OBJECT_MEMORY_RAM); DO_TEST_CAPS_LATEST("numatune-memnode-restrictive-mode"); - DO_TEST("bios-nvram", NONE); - DO_TEST("bios-nvram-os-interleave", NONE); + DO_TEST_NOCAPS("bios-nvram"); + DO_TEST_NOCAPS("bios-nvram-os-interleave"); - DO_TEST("tap-vhost", NONE); - DO_TEST("tap-vhost-incorrect", NONE); + DO_TEST_NOCAPS("tap-vhost"); + DO_TEST_NOCAPS("tap-vhost-incorrect"); DO_TEST("shmem", QEMU_CAPS_DEVICE_IVSHMEM); DO_TEST("shmem-plain-doorbell", QEMU_CAPS_DEVICE_IVSHMEM_PLAIN, QEMU_CAPS_DEVICE_IVSHMEM_DOORBELL); - DO_TEST("smbios", NONE); - DO_TEST("smbios-multiple-type2", NONE); + DO_TEST_NOCAPS("smbios"); + DO_TEST_NOCAPS("smbios-multiple-type2"); DO_TEST("smbios-type-fwcfg", QEMU_CAPS_FW_CFG); DO_TEST_CAPS_LATEST("os-firmware-bios"); @@ -1192,7 +1194,7 @@ mymain(void) QEMU_CAPS_NUMA, QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_LAST, ARG_END); - DO_TEST("memory-hotplug", NONE); + DO_TEST_NOCAPS("memory-hotplug"); DO_TEST("memory-hotplug-dimm", QEMU_CAPS_DEVICE_PC_DIMM); DO_TEST("memory-hotplug-nvdimm", QEMU_CAPS_DEVICE_NVDIMM); DO_TEST("memory-hotplug-nvdimm-access", QEMU_CAPS_DEVICE_NVDIMM); @@ -1213,7 +1215,7 @@ mymain(void) QEMU_CAPS_LAST, ARG_END); DO_TEST_CAPS_LATEST("memory-hotplug-virtio-pmem"); - DO_TEST("net-udp", NONE); + DO_TEST_NOCAPS("net-udp"); DO_TEST("video-virtio-gpu-device", QEMU_CAPS_DEVICE_VIRTIO_GPU); DO_TEST("video-virtio-gpu-virgl", @@ -1240,8 +1242,8 @@ mymain(void) DO_TEST_CAPS_LATEST("input-linux"); - DO_TEST("memorybacking-set", NONE); - DO_TEST("memorybacking-unset", NONE); + DO_TEST_NOCAPS("memorybacking-set"); + DO_TEST_NOCAPS("memorybacking-unset"); DO_TEST_CAPS_LATEST("virtio-options"); @@ -1265,7 +1267,7 @@ mymain(void) QEMU_CAPS_OBJECT_MEMORY_MEMFD_HUGETLB, QEMU_CAPS_OBJECT_MEMORY_FILE); - DO_TEST("acpi-table", NONE); + DO_TEST_NOCAPS("acpi-table"); DO_TEST("video-device-pciaddr-default", QEMU_CAPS_KVM, @@ -1297,13 +1299,13 @@ mymain(void) DO_TEST_CAPS_LATEST("intel-iommu-aw-bits"); DO_TEST_CAPS_ARCH_LATEST("iommu-smmuv3", "aarch64"); - DO_TEST("cpu-check-none", NONE); - DO_TEST("cpu-check-partial", NONE); - DO_TEST("cpu-check-full", NONE); - DO_TEST("cpu-check-default-none", NONE); - DO_TEST("cpu-check-default-none2", NONE); - DO_TEST("cpu-check-default-partial", NONE); - DO_TEST("cpu-check-default-partial2", NONE); + DO_TEST_NOCAPS("cpu-check-none"); + DO_TEST_NOCAPS("cpu-check-partial"); + DO_TEST_NOCAPS("cpu-check-full"); + DO_TEST_NOCAPS("cpu-check-default-none"); + DO_TEST_NOCAPS("cpu-check-default-none2"); + DO_TEST_NOCAPS("cpu-check-default-partial"); + DO_TEST_NOCAPS("cpu-check-default-partial2"); DO_TEST("vmcoreinfo", QEMU_CAPS_DEVICE_VMCOREINFO); DO_TEST("smartcard-host", QEMU_CAPS_CCID_EMULATED); @@ -1405,27 +1407,27 @@ mymain(void) DO_TEST_CAPS_LATEST("virtio-9p-multidevs"); DO_TEST_CAPS_LATEST("virtio-9p-createmode"); - DO_TEST("downscript", NONE); + DO_TEST_NOCAPS("downscript"); /* Simplest possible <audio>, all supported with ENV */ - DO_TEST("audio-none-minimal", NONE); - DO_TEST("audio-alsa-minimal", NONE); - DO_TEST("audio-coreaudio-minimal", NONE); - DO_TEST("audio-oss-minimal", NONE); - DO_TEST("audio-pulseaudio-minimal", NONE); - DO_TEST("audio-sdl-minimal", NONE); - DO_TEST("audio-spice-minimal", NONE); - DO_TEST("audio-file-minimal", NONE); + DO_TEST_NOCAPS("audio-none-minimal"); + DO_TEST_NOCAPS("audio-alsa-minimal"); + DO_TEST_NOCAPS("audio-coreaudio-minimal"); + DO_TEST_NOCAPS("audio-oss-minimal"); + DO_TEST_NOCAPS("audio-pulseaudio-minimal"); + DO_TEST_NOCAPS("audio-sdl-minimal"); + DO_TEST_NOCAPS("audio-spice-minimal"); + DO_TEST_NOCAPS("audio-file-minimal"); /* Best <audio> still compat with old ENV */ - DO_TEST("audio-none-best", NONE); - DO_TEST("audio-alsa-best", NONE); - DO_TEST("audio-coreaudio-best", NONE); - DO_TEST("audio-oss-best", NONE); - DO_TEST("audio-pulseaudio-best", NONE); - DO_TEST("audio-sdl-best", NONE); - DO_TEST("audio-spice-best", NONE); - DO_TEST("audio-file-best", NONE); + DO_TEST_NOCAPS("audio-none-best"); + DO_TEST_NOCAPS("audio-alsa-best"); + DO_TEST_NOCAPS("audio-coreaudio-best"); + DO_TEST_NOCAPS("audio-oss-best"); + DO_TEST_NOCAPS("audio-pulseaudio-best"); + DO_TEST_NOCAPS("audio-sdl-best"); + DO_TEST_NOCAPS("audio-spice-best"); + DO_TEST_NOCAPS("audio-file-best"); /* Full <audio> only compat with new QEMU -audiodev args */ DO_TEST("audio-none-full", QEMU_CAPS_AUDIODEV); -- 2.31.1

There's one last user. Use QEMU_CAPS_LAST explicitly. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/qemuxml2xmltest.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index c1fe74f1cc..04aeba383d 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -204,8 +204,6 @@ mymain(void) #define DO_TEST_NOCAPS(name) \ DO_TEST_FULL(name, "", WHEN_BOTH, ARG_END) -#define NONE QEMU_CAPS_LAST - /* Unset or set all envvars here that are copied in qemudBuildCommandLine * using ADD_ENV_COPY, otherwise these tests may fail due to unexpected * values for these envvars */ @@ -632,7 +630,7 @@ mymain(void) DO_TEST_FULL("seclabel-dynamic-none-relabel", "", WHEN_INACTIVE, ARG_QEMU_CAPS, QEMU_CAPS_DEVICE_CIRRUS_VGA, QEMU_CAPS_OBJECT_MEMORY_FILE, - QEMU_CAPS_SPICE, NONE, + QEMU_CAPS_SPICE, QEMU_CAPS_LAST, ARG_END); DO_TEST_NOCAPS("numad-static-vcpu-no-numatune"); -- 2.31.1

Both are used in the same parser. Using offset values ensures that errors are caught earlier. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/testutilsqemu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testutilsqemu.h b/tests/testutilsqemu.h index 2e9ce8ec62..c6da0745a0 100644 --- a/tests/testutilsqemu.h +++ b/tests/testutilsqemu.h @@ -34,7 +34,7 @@ enum { }; typedef enum { - ARG_QEMU_CAPS, + ARG_QEMU_CAPS = QEMU_CAPS_LAST + 1, ARG_GIC, ARG_MIGRATE_FROM, ARG_MIGRATE_FD, -- 2.31.1

The callers don't use it any more. Remove it to avoid fragility of the test suite. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/testutilsqemu.c | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index 32119e30c2..c86f7f2e39 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -705,23 +705,6 @@ testQemuInfoSetArgs(struct testQemuInfo *info, while ((flag = va_arg(argptr, int)) < QEMU_CAPS_LAST) virQEMUCapsSet(fakeCaps, flag); - - /* Some tests are run with NONE capabilities, which is just - * another name for QEMU_CAPS_LAST. If that is the case the - * arguments look like this : - * - * ARG_QEMU_CAPS, NONE, QEMU_CAPS_LAST, ARG_END - * - * Fetch one argument more and if it is QEMU_CAPS_LAST then - * break from the switch() to force getting next argument - * in the line. If it is not QEMU_CAPS_LAST then we've - * fetched real ARG_* and we must process it. - */ - if ((flag = va_arg(argptr, int)) != QEMU_CAPS_LAST) { - argname = flag; - continue; - } - break; case ARG_GIC: -- 2.31.1

Since the last patch removed the hack which needed lookahead to see whether all QEMU_CAPS_ were parsed we can move the fetching of the arguments into the loop. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/testutilsqemu.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index c86f7f2e39..5ff373e954 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -697,8 +697,7 @@ testQemuInfoSetArgs(struct testQemuInfo *info, abort(); va_start(argptr, capslatest); - argname = va_arg(argptr, testQemuInfoArgName); - while (argname != ARG_END) { + while ((argname = va_arg(argptr, testQemuInfoArgName)) != ARG_END) { switch (argname) { case ARG_QEMU_CAPS: fakeCapsUsed = true; @@ -740,8 +739,6 @@ testQemuInfoSetArgs(struct testQemuInfo *info, fprintf(stderr, "Unexpected test info argument"); goto cleanup; } - - argname = va_arg(argptr, testQemuInfoArgName); } if (!!capsarch ^ !!capsver) { -- 2.31.1

We pass multiple caching objects to individual tests which don't change. To prevent always having to pass them individually to 'testQemuInfoSetArgs' introduce 'struct testQemuConf' which will hold all of them and just the struct will be passed to the tests. Additionally this will make the conf available from inside the test run. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/qemustatusxml2xmltest.c | 8 +++++--- tests/qemuxml2argvtest.c | 20 ++++++++++---------- tests/qemuxml2xmltest.c | 9 ++++++--- tests/testutilsqemu.c | 13 +++++++------ tests/testutilsqemu.h | 13 ++++++++++--- 5 files changed, 38 insertions(+), 25 deletions(-) diff --git a/tests/qemustatusxml2xmltest.c b/tests/qemustatusxml2xmltest.c index ac007405a6..995ef68a4c 100644 --- a/tests/qemustatusxml2xmltest.c +++ b/tests/qemustatusxml2xmltest.c @@ -72,11 +72,13 @@ mymain(void) int ret = 0; g_autofree char *fakerootdir = NULL; g_autoptr(virQEMUDriverConfig) cfg = NULL; - g_autoptr(GHashTable) capslatest = NULL; + g_autoptr(GHashTable) capslatest = testQemuGetLatestCaps(); g_autoptr(GHashTable) capscache = virHashNew(virObjectFreeHashData); g_autoptr(virConnect) conn = NULL; + struct testQemuConf testConf = { .capslatest = capslatest, + .capscache = capscache, + .qapiSchemaCache = NULL }; - capslatest = testQemuGetLatestCaps(); if (!capslatest) return EXIT_FAILURE; @@ -110,7 +112,7 @@ mymain(void) static struct testQemuInfo info = { \ .name = _name, \ }; \ - if (testQemuInfoSetArgs(&info, capscache, capslatest, ARG_END) < 0 || \ + if (testQemuInfoSetArgs(&info, &testConf, ARG_END) < 0 || \ qemuTestCapsCacheInsert(driver.qemuCapsCache, info.qemuCaps) < 0) { \ VIR_TEST_DEBUG("Failed to generate status test data for '%s'", _name); \ return -1; \ diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 80ae2aa329..0dbb6ad94b 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -535,11 +535,11 @@ testCompareXMLToArgvValidateSchema(virQEMUDriver *drv, if (info->schemafile) { /* lookup and insert into cache if not found */ - if (!g_hash_table_lookup_extended(info->qapiSchemaCache, + if (!g_hash_table_lookup_extended(info->conf->qapiSchemaCache, info->schemafile, NULL, (void **) &schema)) { schema = testQEMUSchemaLoad(info->schemafile); - g_hash_table_insert(info->qapiSchemaCache, + g_hash_table_insert(info->conf->qapiSchemaCache, g_strdup(info->schemafile), schema); } @@ -845,9 +845,15 @@ mymain(void) { int ret = 0; g_autofree char *fakerootdir = NULL; - g_autoptr(GHashTable) capslatest = NULL; + g_autoptr(GHashTable) capslatest = testQemuGetLatestCaps(); g_autoptr(GHashTable) qapiSchemaCache = virHashNew((GDestroyNotify) virHashFree); g_autoptr(GHashTable) capscache = virHashNew(virObjectFreeHashData); + struct testQemuConf testConf = { .capslatest = capslatest, + .capscache = capscache, + .qapiSchemaCache = qapiSchemaCache }; + + if (!capslatest) + return EXIT_FAILURE; fakerootdir = g_strdup(FAKEROOTDIRTEMPLATE); @@ -901,10 +907,6 @@ mymain(void) VIR_FREE(driver.config->nvramDir); driver.config->nvramDir = g_strdup("/var/lib/libvirt/qemu/nvram"); - capslatest = testQemuGetLatestCaps(); - if (!capslatest) - return EXIT_FAILURE; - virFileWrapperAddPrefix(SYSCONFDIR "/qemu/firmware", abs_srcdir "/qemufirmwaredata/etc/qemu/firmware"); virFileWrapperAddPrefix(PREFIX "/share/qemu/firmware", @@ -941,9 +943,7 @@ mymain(void) static struct testQemuInfo info = { \ .name = _name, \ }; \ - info.qapiSchemaCache = qapiSchemaCache; \ - if (testQemuInfoSetArgs(&info, capscache, capslatest, \ - __VA_ARGS__) < 0) \ + if (testQemuInfoSetArgs(&info, &testConf, __VA_ARGS__) < 0) \ ret = -1; \ testInfoSetPaths(&info, _suffix); \ if (virTestRun("QEMU XML-2-ARGV " _name _suffix, \ diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 04aeba383d..e71b77b967 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -104,14 +104,17 @@ mymain(void) int ret = 0; g_autofree char *fakerootdir = NULL; g_autoptr(virQEMUDriverConfig) cfg = NULL; - g_autoptr(GHashTable) capslatest = NULL; + g_autoptr(GHashTable) capslatest = testQemuGetLatestCaps(); g_autoptr(GHashTable) capscache = virHashNew(virObjectFreeHashData); g_autoptr(virConnect) conn = NULL; + struct testQemuConf testConf = { .capslatest = capslatest, + .capscache = capscache, + .qapiSchemaCache = NULL }; - capslatest = testQemuGetLatestCaps(); if (!capslatest) return EXIT_FAILURE; + fakerootdir = g_strdup(FAKEROOTDIRTEMPLATE); if (!g_mkdtemp(fakerootdir)) { @@ -151,7 +154,7 @@ mymain(void) static struct testQemuInfo info = { \ .name = _name, \ }; \ - if (testQemuInfoSetArgs(&info, capscache, capslatest, __VA_ARGS__) < 0 || \ + if (testQemuInfoSetArgs(&info, &testConf, __VA_ARGS__) < 0 || \ qemuTestCapsCacheInsert(driver.qemuCapsCache, info.qemuCaps) < 0) { \ VIR_TEST_DEBUG("Failed to generate test data for '%s'", _name); \ ret = -1; \ diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index 5ff373e954..821f6e2707 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -679,8 +679,7 @@ testQemuCapsIterate(const char *suffix, int testQemuInfoSetArgs(struct testQemuInfo *info, - GHashTable *capscache, - GHashTable *capslatest, ...) + struct testQemuConf *conf, ...) { va_list argptr; testQemuInfoArgName argname; @@ -696,7 +695,9 @@ testQemuInfoSetArgs(struct testQemuInfo *info, if (!fakeCaps) abort(); - va_start(argptr, capslatest); + info->conf = conf; + + va_start(argptr, conf); while ((argname = va_arg(argptr, testQemuInfoArgName)) != ARG_END) { switch (argname) { case ARG_QEMU_CAPS: @@ -760,18 +761,18 @@ testQemuInfoSetArgs(struct testQemuInfo *info, info->arch = virArchFromString(capsarch); if (STREQ(capsver, "latest")) { - capsfile = g_strdup(virHashLookup(capslatest, capsarch)); + capsfile = g_strdup(virHashLookup(info->conf->capslatest, capsarch)); stripmachinealiases = true; } else { capsfile = g_strdup_printf("%s/caps_%s.%s.xml", TEST_QEMU_CAPS_PATH, capsver, capsarch); } - if (!g_hash_table_lookup_extended(capscache, capsfile, NULL, (void **) &cachedcaps)) { + if (!g_hash_table_lookup_extended(info->conf->capscache, capsfile, NULL, (void **) &cachedcaps)) { if (!(cachedcaps = qemuTestParseCapabilitiesArch(info->arch, capsfile))) goto cleanup; - g_hash_table_insert(capscache, g_strdup(capsfile), cachedcaps); + g_hash_table_insert(info->conf->capscache, g_strdup(capsfile), cachedcaps); } if (!(info->qemuCaps = virQEMUCapsNewCopy(cachedcaps))) diff --git a/tests/testutilsqemu.h b/tests/testutilsqemu.h index c6da0745a0..af7e756c05 100644 --- a/tests/testutilsqemu.h +++ b/tests/testutilsqemu.h @@ -54,6 +54,12 @@ typedef enum { FLAG_SLIRP_HELPER = 1 << 5, } testQemuInfoFlags; +struct testQemuConf { + GHashTable *capscache; + GHashTable *capslatest; + GHashTable *qapiSchemaCache; +}; + struct testQemuInfo { const char *name; char *infile; @@ -66,7 +72,8 @@ struct testQemuInfo { unsigned int parseFlags; virArch arch; char *schemafile; - GHashTable *qapiSchemaCache; + + struct testQemuConf *conf; }; virCaps *testQemuCapsInit(void); @@ -110,8 +117,8 @@ int testQemuCapsIterate(const char *suffix, void *opaque); int testQemuInfoSetArgs(struct testQemuInfo *info, - GHashTable *capscache, - GHashTable *capslatest, ...); + struct testQemuConf *conf, + ...); void testQemuInfoClear(struct testQemuInfo *info); #endif -- 2.31.1

Previously we've ran into problems when 'testQemuInfoSetArgs' failed as calling the actual test executor could lead to a crash if the data wasn't prepared but reporting an error doesn't play nicely with our test output which is handled by 'virTestRun'. To avoid the issue (and as a side effect improve compilation times of the test files) split up testQemuInfoSetArgs into two functions. The first is still called 'testQemuInfoSetArgs' and just blindly populates arguments into a sub-struct of testQemuInfo. This function no longer reports errors A new function 'testQemuInfoInitArgs' which is meant to be called from the test executor then checks errors and prepares the test data. This one can fail and the test will be marked as failed appropriately. A nice side effect is that this vastly improves compile times of qemuxml2xmltest and qemuxml2argvtest. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/qemustatusxml2xmltest.c | 12 +++-- tests/qemuxml2argvtest.c | 6 ++- tests/qemuxml2xmltest.c | 17 +++---- tests/testutilsqemu.c | 93 ++++++++++++++++++++--------------- tests/testutilsqemu.h | 18 +++++-- 5 files changed, 87 insertions(+), 59 deletions(-) diff --git a/tests/qemustatusxml2xmltest.c b/tests/qemustatusxml2xmltest.c index 995ef68a4c..d58f4b69da 100644 --- a/tests/qemustatusxml2xmltest.c +++ b/tests/qemustatusxml2xmltest.c @@ -23,6 +23,12 @@ testCompareStatusXMLToXMLFiles(const void *opaque) g_autofree char *actual = NULL; int ret = -1; + if (testQemuInfoInitArgs((struct testQemuInfo *) data) < 0) + return -1; + + if (qemuTestCapsCacheInsert(driver.qemuCapsCache, data->qemuCaps) < 0) + return -1; + if (!(obj = virDomainObjParseFile(data->infile, driver.xmlopt, VIR_DOMAIN_DEF_PARSE_STATUS | VIR_DOMAIN_DEF_PARSE_ACTUAL_NET | @@ -112,11 +118,7 @@ mymain(void) static struct testQemuInfo info = { \ .name = _name, \ }; \ - if (testQemuInfoSetArgs(&info, &testConf, ARG_END) < 0 || \ - qemuTestCapsCacheInsert(driver.qemuCapsCache, info.qemuCaps) < 0) { \ - VIR_TEST_DEBUG("Failed to generate status test data for '%s'", _name); \ - return -1; \ - } \ + testQemuInfoSetArgs(&info, &testConf, ARG_END); \ testInfoSetStatusPaths(&info); \ \ if (virTestRun("QEMU status XML-2-XML " _name, \ diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 0dbb6ad94b..34b92c4a35 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -653,6 +653,9 @@ testCompareXMLToArgv(const void *data) virArch arch = VIR_ARCH_NONE; g_autoptr(virIdentity) sysident = virIdentityGetSystem(); + if (testQemuInfoInitArgs((struct testQemuInfo *) info) < 0) + goto cleanup; + if (info->arch != VIR_ARCH_NONE && info->arch != VIR_ARCH_X86_64) qemuTestSetHostArch(&driver, info->arch); @@ -943,8 +946,7 @@ mymain(void) static struct testQemuInfo info = { \ .name = _name, \ }; \ - if (testQemuInfoSetArgs(&info, &testConf, __VA_ARGS__) < 0) \ - ret = -1; \ + testQemuInfoSetArgs(&info, &testConf, __VA_ARGS__); \ testInfoSetPaths(&info, _suffix); \ if (virTestRun("QEMU XML-2-ARGV " _name _suffix, \ testCompareXMLToArgv, &info) < 0) \ diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index e71b77b967..92fab7d169 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -32,11 +32,14 @@ enum { static int testXML2XMLCommon(const struct testQemuInfo *info) { - if (!(info->flags & FLAG_REAL_CAPS)) { + if (testQemuInfoInitArgs((struct testQemuInfo *) info) < 0) + return -1; + + if (!(info->flags & FLAG_REAL_CAPS)) virQEMUCapsInitQMPBasicArch(info->qemuCaps); - if (qemuTestCapsCacheInsert(driver.qemuCapsCache, info->qemuCaps) < 0) - return -1; - } + + if (qemuTestCapsCacheInsert(driver.qemuCapsCache, info->qemuCaps) < 0) + return -1; return 0; } @@ -154,11 +157,7 @@ mymain(void) static struct testQemuInfo info = { \ .name = _name, \ }; \ - if (testQemuInfoSetArgs(&info, &testConf, __VA_ARGS__) < 0 || \ - qemuTestCapsCacheInsert(driver.qemuCapsCache, info.qemuCaps) < 0) { \ - VIR_TEST_DEBUG("Failed to generate test data for '%s'", _name); \ - ret = -1; \ - } \ + testQemuInfoSetArgs(&info, &testConf, __VA_ARGS__); \ \ if (when & WHEN_INACTIVE) { \ testInfoSetPaths(&info, suffix, WHEN_INACTIVE); \ diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index 821f6e2707..81d4a44f9a 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -677,38 +677,32 @@ testQemuCapsIterate(const char *suffix, } -int +void testQemuInfoSetArgs(struct testQemuInfo *info, struct testQemuConf *conf, ...) { va_list argptr; testQemuInfoArgName argname; - g_autoptr(virQEMUCaps) fakeCaps = virQEMUCapsNew(); - bool fakeCapsUsed = false; - int gic = GIC_NONE; - char *capsarch = NULL; - char *capsver = NULL; - g_autofree char *capsfile = NULL; int flag; - int ret = -1; - if (!fakeCaps) + if (!(info->args.fakeCaps = virQEMUCapsNew())) abort(); info->conf = conf; + info->args.newargs = true; va_start(argptr, conf); while ((argname = va_arg(argptr, testQemuInfoArgName)) != ARG_END) { switch (argname) { case ARG_QEMU_CAPS: - fakeCapsUsed = true; + info->args.fakeCapsUsed = true; while ((flag = va_arg(argptr, int)) < QEMU_CAPS_LAST) - virQEMUCapsSet(fakeCaps, flag); + virQEMUCapsSet(info->args.fakeCaps, flag); break; case ARG_GIC: - gic = va_arg(argptr, int); + info->args.gic = va_arg(argptr, int); break; case ARG_MIGRATE_FROM: @@ -728,55 +722,77 @@ testQemuInfoSetArgs(struct testQemuInfo *info, break; case ARG_CAPS_ARCH: - capsarch = va_arg(argptr, char *); + info->args.capsarch = va_arg(argptr, char *); break; case ARG_CAPS_VER: - capsver = va_arg(argptr, char *); + info->args.capsver = va_arg(argptr, char *); break; case ARG_END: default: - fprintf(stderr, "Unexpected test info argument"); - goto cleanup; + info->args.invalidarg = true; + break; } + + if (info->args.invalidarg) + break; } - if (!!capsarch ^ !!capsver) { - fprintf(stderr, "ARG_CAPS_ARCH and ARG_CAPS_VER " - "must be specified together.\n"); - goto cleanup; + va_end(argptr); +} + + +int +testQemuInfoInitArgs(struct testQemuInfo *info) +{ + g_autofree char *capsfile = NULL; + + if (!info->args.newargs) + return 0; + + info->args.newargs = false; + + if (info->args.invalidarg) { + fprintf(stderr, "Invalid agument encountered by 'testQemuInfoSetArgs'\n"); + return -1; } - if (capsarch && capsver) { + if (!!info->args.capsarch ^ !!info->args.capsver) { + fprintf(stderr, "ARG_CAPS_ARCH and ARG_CAPS_VER must be specified together.\n"); + return -1; + } + + if (info->args.capsarch && info->args.capsver) { bool stripmachinealiases = false; virQEMUCaps *cachedcaps = NULL; - if (fakeCapsUsed) { - fprintf(stderr, "ARG_QEMU_CAPS can not be combined with ARG_CAPS_ARCH " - "or ARG_CAPS_VER\n"); - goto cleanup; + if (info->args.fakeCapsUsed) { + fprintf(stderr, "ARG_QEMU_CAPS can not be combined with ARG_CAPS_ARCH or ARG_CAPS_VER\n"); + return -1; } - info->arch = virArchFromString(capsarch); + info->arch = virArchFromString(info->args.capsarch); - if (STREQ(capsver, "latest")) { - capsfile = g_strdup(virHashLookup(info->conf->capslatest, capsarch)); + if (STREQ(info->args.capsver, "latest")) { + capsfile = g_strdup(virHashLookup(info->conf->capslatest, info->args.capsarch)); stripmachinealiases = true; } else { capsfile = g_strdup_printf("%s/caps_%s.%s.xml", - TEST_QEMU_CAPS_PATH, capsver, capsarch); + TEST_QEMU_CAPS_PATH, + info->args.capsver, + info->args.capsarch); } if (!g_hash_table_lookup_extended(info->conf->capscache, capsfile, NULL, (void **) &cachedcaps)) { if (!(cachedcaps = qemuTestParseCapabilitiesArch(info->arch, capsfile))) - goto cleanup; + return -1; g_hash_table_insert(info->conf->capscache, g_strdup(capsfile), cachedcaps); } if (!(info->qemuCaps = virQEMUCapsNewCopy(cachedcaps))) - goto cleanup; + return -1; if (stripmachinealiases) virQEMUCapsStripMachineAliases(info->qemuCaps); @@ -787,18 +803,14 @@ testQemuInfoSetArgs(struct testQemuInfo *info, capsfile[strlen(capsfile) - 3] = '\0'; info->schemafile = g_strdup_printf("%sreplies", capsfile); } else { - info->qemuCaps = g_steal_pointer(&fakeCaps); + info->qemuCaps = g_steal_pointer(&info->args.fakeCaps); } - if (gic != GIC_NONE && testQemuCapsSetGIC(info->qemuCaps, gic) < 0) - goto cleanup; - - ret = 0; - - cleanup: - va_end(argptr); + if (info->args.gic != GIC_NONE && + testQemuCapsSetGIC(info->qemuCaps, info->args.gic) < 0) + return -1; - return ret; + return 0; } @@ -810,4 +822,5 @@ testQemuInfoClear(struct testQemuInfo *info) VIR_FREE(info->schemafile); VIR_FREE(info->errfile); virObjectUnref(info->qemuCaps); + g_clear_pointer(&info->args.fakeCaps, virObjectUnref); } diff --git a/tests/testutilsqemu.h b/tests/testutilsqemu.h index af7e756c05..d59fa53239 100644 --- a/tests/testutilsqemu.h +++ b/tests/testutilsqemu.h @@ -60,6 +60,16 @@ struct testQemuConf { GHashTable *qapiSchemaCache; }; +struct testQemuArgs { + bool newargs; + virQEMUCaps *fakeCaps; + bool fakeCapsUsed; + char *capsver; + char *capsarch; + int gic; + bool invalidarg; +}; + struct testQemuInfo { const char *name; char *infile; @@ -73,6 +83,7 @@ struct testQemuInfo { virArch arch; char *schemafile; + struct testQemuArgs args; struct testQemuConf *conf; }; @@ -116,9 +127,10 @@ int testQemuCapsIterate(const char *suffix, testQemuCapsIterateCallback callback, void *opaque); -int testQemuInfoSetArgs(struct testQemuInfo *info, - struct testQemuConf *conf, - ...); +void testQemuInfoSetArgs(struct testQemuInfo *info, + struct testQemuConf *conf, + ...); +int testQemuInfoInitArgs(struct testQemuInfo *info); void testQemuInfoClear(struct testQemuInfo *info); #endif -- 2.31.1

Pass a pointer to the 'ret' variable to the test executor itself and update it there to improve compile times of the test. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/qemustatusxml2xmltest.c | 3 ++- tests/qemuxml2argvtest.c | 10 ++++++---- tests/qemuxml2xmltest.c | 3 ++- tests/testutilsqemu.h | 1 + 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/tests/qemustatusxml2xmltest.c b/tests/qemustatusxml2xmltest.c index d58f4b69da..f6bde507a1 100644 --- a/tests/qemustatusxml2xmltest.c +++ b/tests/qemustatusxml2xmltest.c @@ -83,7 +83,8 @@ mymain(void) g_autoptr(virConnect) conn = NULL; struct testQemuConf testConf = { .capslatest = capslatest, .capscache = capscache, - .qapiSchemaCache = NULL }; + .qapiSchemaCache = NULL, + .retptr = NULL }; if (!capslatest) return EXIT_FAILURE; diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 34b92c4a35..a88eb1cb90 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -826,6 +826,9 @@ testCompareXMLToArgv(const void *data) if (info->arch != VIR_ARCH_NONE && info->arch != VIR_ARCH_X86_64) qemuTestSetHostArch(&driver, VIR_ARCH_NONE); + if (ret < 0) + *info->conf->retptr = ret; + return ret; } @@ -853,7 +856,8 @@ mymain(void) g_autoptr(GHashTable) capscache = virHashNew(virObjectFreeHashData); struct testQemuConf testConf = { .capslatest = capslatest, .capscache = capscache, - .qapiSchemaCache = qapiSchemaCache }; + .qapiSchemaCache = qapiSchemaCache, + .retptr = &ret }; if (!capslatest) return EXIT_FAILURE; @@ -948,9 +952,7 @@ mymain(void) }; \ testQemuInfoSetArgs(&info, &testConf, __VA_ARGS__); \ testInfoSetPaths(&info, _suffix); \ - if (virTestRun("QEMU XML-2-ARGV " _name _suffix, \ - testCompareXMLToArgv, &info) < 0) \ - ret = -1; \ + virTestRun("QEMU XML-2-ARGV " _name _suffix, testCompareXMLToArgv, &info); \ testQemuInfoClear(&info); \ } while (0) diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 92fab7d169..f6a38d7716 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -112,7 +112,8 @@ mymain(void) g_autoptr(virConnect) conn = NULL; struct testQemuConf testConf = { .capslatest = capslatest, .capscache = capscache, - .qapiSchemaCache = NULL }; + .qapiSchemaCache = NULL, + .retptr = NULL }; if (!capslatest) return EXIT_FAILURE; diff --git a/tests/testutilsqemu.h b/tests/testutilsqemu.h index d59fa53239..64562cbd1c 100644 --- a/tests/testutilsqemu.h +++ b/tests/testutilsqemu.h @@ -58,6 +58,7 @@ struct testQemuConf { GHashTable *capscache; GHashTable *capslatest; GHashTable *qapiSchemaCache; + int *retptr; }; struct testQemuArgs { -- 2.31.1

Pass a pointer to the 'ret' variable to the test executor itself and update it there to improve compile times of the test. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/qemuxml2xmltest.c | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index f6a38d7716..0413a130c3 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -50,13 +50,16 @@ testXML2XMLActive(const void *opaque) { const struct testQemuInfo *info = opaque; - if (testXML2XMLCommon(info) < 0) + if (testXML2XMLCommon(info) < 0 || + testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt, + info->infile, info->outfile, true, + info->parseFlags, + TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS) < 0) { + *info->conf->retptr = -1; return -1; + } - return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt, - info->infile, info->outfile, true, - info->parseFlags, - TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS); + return 0; } @@ -65,13 +68,16 @@ testXML2XMLInactive(const void *opaque) { const struct testQemuInfo *info = opaque; - if (testXML2XMLCommon(info) < 0) + if (testXML2XMLCommon(info) < 0 || + testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt, + info->infile, info->outfile, false, + info->parseFlags, + TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS) < 0) { + *info->conf->retptr = -1; return -1; + } - return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt, - info->infile, info->outfile, false, - info->parseFlags, - TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS); + return 0; } @@ -113,7 +119,7 @@ mymain(void) struct testQemuConf testConf = { .capslatest = capslatest, .capscache = capscache, .qapiSchemaCache = NULL, - .retptr = NULL }; + .retptr = &ret }; if (!capslatest) return EXIT_FAILURE; @@ -162,16 +168,12 @@ mymain(void) \ if (when & WHEN_INACTIVE) { \ testInfoSetPaths(&info, suffix, WHEN_INACTIVE); \ - if (virTestRun("QEMU XML-2-XML-inactive " _name, \ - testXML2XMLInactive, &info) < 0) \ - ret = -1; \ + virTestRun("QEMU XML-2-XML-inactive " _name, testXML2XMLInactive, &info); \ } \ \ if (when & WHEN_ACTIVE) { \ testInfoSetPaths(&info, suffix, WHEN_ACTIVE); \ - if (virTestRun("QEMU XML-2-XML-active " _name, \ - testXML2XMLActive, &info) < 0) \ - ret = -1; \ + virTestRun("QEMU XML-2-XML-active " _name, testXML2XMLActive, &info); \ } \ testQemuInfoClear(&info); \ } while (0) -- 2.31.1

On a Tuesday in 2021, Peter Krempa wrote:
The original patch was replaced. A nice side effect of this series is substantial improvement of compile times for:
qemuxml2xmltest 15.8s -> 1.3s qemuxml2argvtest 6.4s -> 1.8s
In addition this also cleans up the messy parsing of fake caps and removes the somewhat ambiguous NONE macro.
Peter Krempa (23): qemu: capabilities: Remove virQEMUCapsSetList qemuxml2argvtest: Add 'ARG_END' from higher level macros qemuxml2argvtest: Fix broken invocation of "pseries-spaprvio-invalid" qemuxml2argvtest: Fix broken invocation of "aarch64-tpm-wrong-model" testQemuInfoSetArgs: Always allocate 'info->qemuCaps' qemustatusxml2xmltest: Remove hack for qemuCaps allocation qemuxml2argvtest: Add QEMU_CAPS_LAST in places where ARG_QEMU_CAPS is used qemuxml2argvtest: Rename DO_TEST_INTERNAL to DO_TEST_FULL and fix users qemuxml2argvtest: Add 'DO_TEST_NOCAPS' to replace 'DO_TEST("blah", NONE);' qemuxml2argvtest: Add 'DO_TEST_PARSE_ERROR_NOCAPS' to replace 'DO_TEST_PARSE_ERROR("blah", NONE);' qemuxml2argvtest: Add 'DO_TEST_FAILURE_NOCAPS' to replace 'DO_TEST_FAILURE("blah", NONE);' qemuxml2xmltest: Add 'ARG_END' from higher level macros qemuxml2xmltest: Rename DO_TEST_INTERNAL to DO_TEST_FULL and fix users qemuxml2xmltest: Remove hack for qemuCaps allocation qemuxml2xmltest: Add 'DO_TEST_NOCAPS' to replace 'DO_TEST("blah", NONE);' qemuxml2xmltest: Remove 'NONE' macro testutilsqemu: Ensure that ARG_* macros are out of range of QEMU_CAPS_* testQemuInfoSetArgs: Remove hack for double QEMU_CAPS_LAST in caps list testQemuInfoSetArgs: Move argument fetching to the loop testutilsqemu: Introduce struct to hold data valid for all test runs testutilsqemu: Improve error propagation from 'testQemuInfoSetArgs' qemuxml2argvtest: Avoid conditions in test macro qemuxml2xmltesttest: Avoid conditions in test macro
src/qemu/qemu_capabilities.c | 13 - src/qemu/qemu_capabilities.h | 2 - tests/qemustatusxml2xmltest.c | 21 +- tests/qemuxml2argvtest.c | 666 +++++++++++++++++----------------- tests/qemuxml2xmltest.c | 578 ++++++++++++++--------------- tests/testutilsqemu.c | 140 ++++--- tests/testutilsqemu.h | 30 +- 7 files changed, 706 insertions(+), 744 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano
participants (2)
-
Ján Tomko
-
Peter Krempa