提交 180bf85c 编写于 作者: C Cole Robinson

tests: qemuxml2argv: add testInfoSetPaths

This moves infile and outfile building outside the test case,
which better fits the pattern of qemuxml2xmltest. It also lets us
drop the qemuxml2argtest-specific 'suffix' from testInfo
Reviewed-by: NAndrea Bolognani <abologna@redhat.com>
Signed-off-by: NCole Robinson <crobinso@redhat.com>
上级 2d3ba1bf
......@@ -298,7 +298,6 @@ typedef enum {
struct testInfo {
const char *name;
const char *suffix;
char *infile;
char *outfile;
virQEMUCapsPtr qemuCaps;
......@@ -431,7 +430,6 @@ testCompareXMLToArgv(const void *data)
struct testInfo *info = (void *) data;
char *migrateURI = NULL;
char *actualargv = NULL;
const char *suffix = info->suffix;
unsigned int flags = info->flags;
unsigned int parseFlags = info->parseFlags;
int ret = -1;
......@@ -448,9 +446,6 @@ testCompareXMLToArgv(const void *data)
if (!(conn = virGetConnect()))
goto cleanup;
if (!suffix)
suffix = "";
conn->secretDriver = &fakeSecretDriver;
conn->storageDriver = &fakeStorageDriver;
conn->nwfilterDriver = &fakeNWFilterDriver;
......@@ -471,12 +466,6 @@ testCompareXMLToArgv(const void *data)
if (qemuTestCapsCacheInsert(driver.qemuCapsCache, info->qemuCaps) < 0)
goto cleanup;
if (virAsprintf(&info->infile, "%s/qemuxml2argvdata/%s.xml",
abs_srcdir, info->name) < 0 ||
virAsprintf(&info->outfile, "%s/qemuxml2argvdata/%s%s.args",
abs_srcdir, info->name, suffix) < 0)
goto cleanup;
if (info->migrateFrom &&
!(migrateURI = qemuMigrationDstGetURI(info->migrateFrom,
info->migrateFd)))
......@@ -758,6 +747,20 @@ testInfoClear(struct testInfo *info)
virObjectUnref(info->qemuCaps);
}
static int
testInfoSetPaths(struct testInfo *info,
const char *suffix)
{
if (virAsprintf(&info->infile, "%s/qemuxml2argvdata/%s.xml",
abs_srcdir, info->name) < 0 ||
virAsprintf(&info->outfile, "%s/qemuxml2argvdata/%s%s.args",
abs_srcdir, info->name, suffix ? suffix : "") < 0) {
return -1;
}
return 0;
}
# define FAKEROOTDIRTEMPLATE abs_builddir "/fakerootdir-XXXXXX"
static int
......@@ -883,11 +886,14 @@ mymain(void)
do { \
static struct testInfo info = { \
.name = _name, \
.suffix = _suffix, \
}; \
if (testInfoSetArgs(&info, capslatest, \
__VA_ARGS__, ARG_END) < 0) \
return EXIT_FAILURE; \
if (testInfoSetPaths(&info, _suffix) < 0) { \
VIR_TEST_DEBUG("Failed to generate paths for '%s'", _name); \
return EXIT_FAILURE; \
} \
if (virTestRun("QEMU XML-2-ARGV " _name _suffix, \
testCompareXMLToArgv, &info) < 0) \
ret = -1; \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册