mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-07-06 09:55:46 +00:00
qemuxml2xmltest: Rework file name generation in 'testInfoSetPaths'
Pass the state-based suffix directly as string. Document the logic how the filename is chosen. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
7ef2846f9b
commit
1522e7f9b7
@ -75,10 +75,22 @@ testXML2XMLInactive(const void *opaque)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* testInfoSetPaths:
|
||||||
|
* @info: test info structure to populate
|
||||||
|
* @suffix: suffix used to create output file name e.g. ".x86-64_latest"
|
||||||
|
* @statesuffix: suffix to create output file name based on tested state ("active" | "inactive")
|
||||||
|
*
|
||||||
|
* This function populates @info with the correct input and output file paths.
|
||||||
|
*
|
||||||
|
* The output file is chosen based on whether a version with @statesuffix exists.
|
||||||
|
* If yes, it's used, if no the @statesuffix is omitted and it's expected that
|
||||||
|
* both the "active" and "inactive" versions are the same.
|
||||||
|
*/
|
||||||
static void
|
static void
|
||||||
testInfoSetPaths(struct testQemuInfo *info,
|
testInfoSetPaths(struct testQemuInfo *info,
|
||||||
const char *suffix,
|
const char *suffix,
|
||||||
int when)
|
const char *statesuffix)
|
||||||
{
|
{
|
||||||
VIR_FREE(info->infile);
|
VIR_FREE(info->infile);
|
||||||
VIR_FREE(info->outfile);
|
VIR_FREE(info->outfile);
|
||||||
@ -88,7 +100,7 @@ testInfoSetPaths(struct testQemuInfo *info,
|
|||||||
|
|
||||||
info->outfile = g_strdup_printf("%s/qemuxml2xmloutdata/%s-%s%s.xml",
|
info->outfile = g_strdup_printf("%s/qemuxml2xmloutdata/%s-%s%s.xml",
|
||||||
abs_srcdir, info->name,
|
abs_srcdir, info->name,
|
||||||
when == WHEN_ACTIVE ? "active" : "inactive", suffix);
|
statesuffix, suffix);
|
||||||
|
|
||||||
if (!virFileExists(info->outfile)) {
|
if (!virFileExists(info->outfile)) {
|
||||||
VIR_FREE(info->outfile);
|
VIR_FREE(info->outfile);
|
||||||
@ -146,12 +158,12 @@ mymain(void)
|
|||||||
testQemuInfoSetArgs(&info, &testConf, __VA_ARGS__); \
|
testQemuInfoSetArgs(&info, &testConf, __VA_ARGS__); \
|
||||||
\
|
\
|
||||||
if (when & WHEN_INACTIVE) { \
|
if (when & WHEN_INACTIVE) { \
|
||||||
testInfoSetPaths(&info, suffix, WHEN_INACTIVE); \
|
testInfoSetPaths(&info, suffix, "inactive"); \
|
||||||
virTestRunLog(&ret, "QEMU XML-2-XML-inactive " _name, testXML2XMLInactive, &info); \
|
virTestRunLog(&ret, "QEMU XML-2-XML-inactive " _name, testXML2XMLInactive, &info); \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
if (when & WHEN_ACTIVE) { \
|
if (when & WHEN_ACTIVE) { \
|
||||||
testInfoSetPaths(&info, suffix, WHEN_ACTIVE); \
|
testInfoSetPaths(&info, suffix, "active"); \
|
||||||
virTestRunLog(&ret, "QEMU XML-2-XML-active " _name, testXML2XMLActive, &info); \
|
virTestRunLog(&ret, "QEMU XML-2-XML-active " _name, testXML2XMLActive, &info); \
|
||||||
} \
|
} \
|
||||||
testQemuInfoClear(&info); \
|
testQemuInfoClear(&info); \
|
||||||
|
Loading…
Reference in New Issue
Block a user