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 Signed-off-by: Cole Robinson <crobinso@xxxxxxxxxx> --- tests/qemuxml2argvtest.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index ff7bacf8db..a3fee41ea9 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -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,17 @@ 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 +883,12 @@ 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)) \ + return EXIT_FAILURE; \ if (virTestRun("QEMU XML-2-ARGV " _name _suffix, \ testCompareXMLToArgv, &info) < 0) \ ret = -1; \ -- 2.21.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list