Rather than having a separate argument to DO_TEST pass the state via
newly added flags 'FLAG_SKIP_CONFIG_ACTIVE'. The '_INACTIVE' equivalent
was not added as there's no test which'd use it.
Remove the old 'WHEN_' flags and move the decision logic out of the
DO_TEST macro as any addition to the logic makes the compiler take much
longer to compile qemuxml2xmltest.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
tests/qemuxml2xmltest.c | 36 ++++++++++++++----------------------
tests/testutilsqemu.h | 1 +
2 files changed, 15 insertions(+), 22 deletions(-)
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index c67909404f..e6018f8240 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -19,13 +19,6 @@
static virQEMUDriver driver;
-enum {
- WHEN_INACTIVE = 1,
- WHEN_ACTIVE = 2,
- WHEN_BOTH = 3,
-};
-
-
static int
testXML2XMLCommon(const struct testQemuInfo *info)
{
@@ -46,6 +39,9 @@ testXML2XMLActive(const void *opaque)
{
const struct testQemuInfo *info = opaque;
+ if (info->flags & FLAG_SKIP_CONFIG_ACTIVE)
+ return EXIT_AM_SKIP;
+
if (testXML2XMLCommon(info) < 0 ||
testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt,
info->infile, info->outfile, true,
@@ -150,27 +146,23 @@ mymain(void)
virSetConnectSecret(conn);
virSetConnectStorage(conn);
-#define DO_TEST_FULL(_name, suffix, when, ...) \
+#define DO_TEST_FULL(_name, suffix, ...) \
do { \
static struct testQemuInfo info = { \
.name = _name, \
}; \
testQemuInfoSetArgs(&info, &testConf, __VA_ARGS__); \
\
- if (when & WHEN_INACTIVE) { \
- testInfoSetPaths(&info, suffix, "inactive"); \
- virTestRunLog(&ret, "QEMU XML-2-XML-inactive " _name,
testXML2XMLInactive, &info); \
- } \
+ testInfoSetPaths(&info, suffix, "inactive"); \
+ virTestRunLog(&ret, "QEMU XML-2-XML-inactive " _name,
testXML2XMLInactive, &info); \
\
- if (when & WHEN_ACTIVE) { \
- testInfoSetPaths(&info, suffix, "active"); \
- virTestRunLog(&ret, "QEMU XML-2-XML-active " _name,
testXML2XMLActive, &info); \
- } \
+ testInfoSetPaths(&info, suffix, "active"); \
+ virTestRunLog(&ret, "QEMU XML-2-XML-active " _name,
testXML2XMLActive, &info); \
testQemuInfoClear(&info); \
} while (0)
#define DO_TEST_CAPS_INTERNAL(name, arch, ver, ...) \
- DO_TEST_FULL(name, "." arch "-" ver, WHEN_BOTH, \
+ DO_TEST_FULL(name, "." arch "-" ver, \
ARG_CAPS_ARCH, arch, \
ARG_CAPS_VER, ver, \
__VA_ARGS__, \
@@ -511,17 +503,17 @@ 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_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_FULL("seclabel-dynamic-baselabel", "", ARG_FLAGS,
FLAG_SKIP_CONFIG_ACTIVE, ARG_END);
+ DO_TEST_FULL("seclabel-dynamic-override", "", ARG_FLAGS,
FLAG_SKIP_CONFIG_ACTIVE, ARG_END);
+ DO_TEST_FULL("seclabel-dynamic-labelskip", "", ARG_FLAGS,
FLAG_SKIP_CONFIG_ACTIVE, ARG_END);
+ DO_TEST_FULL("seclabel-dynamic-relabel", "", ARG_FLAGS,
FLAG_SKIP_CONFIG_ACTIVE, ARG_END);
DO_TEST_CAPS_LATEST("seclabel-static");
DO_TEST_CAPS_LATEST("seclabel-static-labelskip");
DO_TEST_CAPS_LATEST("seclabel-none");
DO_TEST_CAPS_LATEST("seclabel-dac-none");
DO_TEST_CAPS_LATEST("seclabel-dynamic-none");
DO_TEST_CAPS_LATEST("seclabel-device-multiple");
- DO_TEST_FULL("seclabel-dynamic-none-relabel", "", WHEN_INACTIVE,
+ DO_TEST_FULL("seclabel-dynamic-none-relabel", "", ARG_FLAGS,
FLAG_SKIP_CONFIG_ACTIVE,
ARG_QEMU_CAPS, QEMU_CAPS_DEVICE_CIRRUS_VGA,
QEMU_CAPS_SPICE, QEMU_CAPS_LAST,
ARG_END);
diff --git a/tests/testutilsqemu.h b/tests/testutilsqemu.h
index e0d116336e..7845ac7cb6 100644
--- a/tests/testutilsqemu.h
+++ b/tests/testutilsqemu.h
@@ -59,6 +59,7 @@ typedef enum {
FLAG_REAL_CAPS = 1 << 3,
FLAG_SKIP_LEGACY_CPUS = 1 << 4,
FLAG_SLIRP_HELPER = 1 << 5,
+ FLAG_SKIP_CONFIG_ACTIVE = 1 << 6, /* Skip 'active' config test in
qemuxml2xmltest */
} testQemuInfoFlags;
struct testQemuConf {
--
2.41.0