mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 20:15:17 +00:00
qemuxml2argvtest: Pass expected state via struct testQemuInfo's 'flags' member
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@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
c2fd8c2b29
commit
cfb0294344
@ -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);
|
||||
|
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user