tests: qemuxml2argv: Add infrastructure to pass output file suffix

To allow having more than one output file in the qemuxml2argvtest add a
suffix member to the testInfo struct which will allow testing the same
XML file with multiple capabilities files.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Peter Krempa 2018-04-17 16:17:53 +02:00
parent e831821cbc
commit f4f7d0da8b

View File

@ -270,6 +270,7 @@ typedef enum {
struct testInfo { struct testInfo {
const char *name; const char *name;
const char *suffix;
virQEMUCapsPtr qemuCaps; virQEMUCapsPtr qemuCaps;
const char *migrateFrom; const char *migrateFrom;
int migrateFd; int migrateFd;
@ -442,6 +443,7 @@ testCompareXMLToArgv(const void *data)
char *args = NULL; char *args = NULL;
char *migrateURI = NULL; char *migrateURI = NULL;
char *actualargv = NULL; char *actualargv = NULL;
const char *suffix = info->suffix;
unsigned int flags = info->flags; unsigned int flags = info->flags;
unsigned int parseFlags = info->parseFlags; unsigned int parseFlags = info->parseFlags;
int ret = -1; int ret = -1;
@ -458,6 +460,9 @@ testCompareXMLToArgv(const void *data)
if (!(conn = virGetConnect())) if (!(conn = virGetConnect()))
goto cleanup; goto cleanup;
if (!suffix)
suffix = "";
conn->secretDriver = &fakeSecretDriver; conn->secretDriver = &fakeSecretDriver;
conn->storageDriver = &fakeStorageDriver; conn->storageDriver = &fakeStorageDriver;
@ -472,8 +477,8 @@ testCompareXMLToArgv(const void *data)
if (virAsprintf(&xml, "%s/qemuxml2argvdata/%s.xml", if (virAsprintf(&xml, "%s/qemuxml2argvdata/%s.xml",
abs_srcdir, info->name) < 0 || abs_srcdir, info->name) < 0 ||
virAsprintf(&args, "%s/qemuxml2argvdata/%s.args", virAsprintf(&args, "%s/qemuxml2argvdata/%s%s.args",
abs_srcdir, info->name) < 0) abs_srcdir, info->name, suffix) < 0)
goto cleanup; goto cleanup;
if (info->migrateFrom && if (info->migrateFrom &&
@ -657,7 +662,7 @@ mymain(void)
parseFlags, gic, ...) \ parseFlags, gic, ...) \
do { \ do { \
static struct testInfo info = { \ static struct testInfo info = { \
name, NULL, migrateFrom, migrateFd, (flags), parseFlags, \ name, NULL, NULL, migrateFrom, migrateFd, (flags), parseFlags, \
false, NULL \ false, NULL \
}; \ }; \
info.skipLegacyCPUs = skipLegacyCPUs; \ info.skipLegacyCPUs = skipLegacyCPUs; \