testutilsqemu: Create a typedef for struct testQemuInfo

The typedef will come in handy to create an autoptr cleaning function
later on.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2023-12-04 22:28:10 +01:00
parent 06c1ab8222
commit aecd5085db
5 changed files with 25 additions and 23 deletions

View File

@ -384,7 +384,7 @@ static virCommand *
testCompareXMLToArgvCreateArgs(virQEMUDriver *drv,
virDomainObj *vm,
const char *migrateURI,
struct testQemuInfo *info,
testQemuInfo *info,
unsigned int flags)
{
qemuDomainObjPrivate *priv = vm->privateData;
@ -561,7 +561,7 @@ testCompareXMLToArgvValidateSchemaCommand(GStrv args,
static int
testCompareXMLToArgvValidateSchema(virCommand *cmd,
struct testQemuInfo *info)
testQemuInfo *info)
{
g_auto(GStrv) args = NULL;
@ -579,7 +579,7 @@ testCompareXMLToArgvValidateSchema(virCommand *cmd,
static int
testInfoCheckDuplicate(struct testQemuInfo *info)
testInfoCheckDuplicate(testQemuInfo *info)
{
const char *path = info->outfile;
@ -603,7 +603,7 @@ testInfoCheckDuplicate(struct testQemuInfo *info)
static int
testCompareXMLToArgv(const void *data)
{
struct testQemuInfo *info = (void *) data;
testQemuInfo *info = (void *) data;
g_autofree char *migrateURI = NULL;
g_auto(virBuffer) actualBuf = VIR_BUFFER_INITIALIZER;
g_autofree char *actualargv = NULL;
@ -626,7 +626,7 @@ testCompareXMLToArgv(const void *data)
/* mark test case as used */
ignore_value(g_hash_table_remove(info->conf->existingTestCases, info->infile));
if (testQemuInfoInitArgs((struct testQemuInfo *) info) < 0)
if (testQemuInfoInitArgs((testQemuInfo *) info) < 0)
goto cleanup;
if (testInfoCheckDuplicate(info) < 0)
@ -812,7 +812,7 @@ testCompareXMLToArgv(const void *data)
}
static void
testInfoSetPaths(struct testQemuInfo *info,
testInfoSetPaths(testQemuInfo *info,
const char *suffix)
{
info->infile = g_strdup_printf("%s/qemuxml2argvdata/%s.xml",
@ -941,7 +941,7 @@ mymain(void)
*/
# define DO_TEST_FULL(_name, _suffix, ...) \
do { \
static struct testQemuInfo info = { \
static testQemuInfo info = { \
.name = _name, \
}; \
testQemuInfoSetArgs(&info, &testConf, __VA_ARGS__); \

View File

@ -20,9 +20,9 @@
static virQEMUDriver driver;
static int
testXML2XMLCommon(const struct testQemuInfo *info)
testXML2XMLCommon(const testQemuInfo *info)
{
if (testQemuInfoInitArgs((struct testQemuInfo *) info) < 0)
if (testQemuInfoInitArgs((testQemuInfo *) info) < 0)
return -1;
virFileCacheClear(driver.qemuCapsCache);
@ -37,7 +37,7 @@ testXML2XMLCommon(const struct testQemuInfo *info)
static int
testXML2XMLActive(const void *opaque)
{
const struct testQemuInfo *info = opaque;
const testQemuInfo *info = opaque;
if (info->flags & FLAG_SKIP_CONFIG_ACTIVE)
return EXIT_AM_SKIP;
@ -57,7 +57,7 @@ testXML2XMLActive(const void *opaque)
static int
testXML2XMLInactive(const void *opaque)
{
const struct testQemuInfo *info = opaque;
const testQemuInfo *info = opaque;
if (testXML2XMLCommon(info) < 0 ||
testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt,
@ -84,7 +84,7 @@ testXML2XMLInactive(const void *opaque)
* both the "active" and "inactive" versions are the same.
*/
static void
testInfoSetPaths(struct testQemuInfo *info,
testInfoSetPaths(testQemuInfo *info,
const char *suffix,
const char *statesuffix)
{
@ -148,7 +148,7 @@ mymain(void)
#define DO_TEST_CAPS_INTERNAL(_name, arch, ver, ...) \
do { \
static struct testQemuInfo info = { \
static testQemuInfo info = { \
.name = _name, \
}; \
testQemuInfoSetArgs(&info, &testConf, \

View File

@ -18,7 +18,7 @@ static virQEMUDriver driver;
static int
testCompareStatusXMLToXMLFiles(const void *opaque)
{
const struct testQemuInfo *data = opaque;
const testQemuInfo *data = opaque;
virDomainObj *obj = NULL;
g_autofree char *actual = NULL;
int ret = -1;
@ -61,7 +61,7 @@ testCompareStatusXMLToXMLFiles(const void *opaque)
static const char *statusPath = abs_srcdir "/qemustatusxml2xmldata/";
static void
testInfoSetStatusPaths(struct testQemuInfo *info)
testInfoSetStatusPaths(testQemuInfo *info)
{
info->infile = g_strdup_printf("%s%s-in.xml", statusPath, info->name);
info->outfile = g_strdup_printf("%s%s-out.xml", statusPath, info->name);
@ -90,7 +90,7 @@ mymain(void)
#define DO_TEST_STATUS(_name) \
do { \
static struct testQemuInfo info = { \
static testQemuInfo info = { \
.name = _name, \
}; \
testQemuInfoSetArgs(&info, &testConf, ARG_END); \

View File

@ -623,7 +623,7 @@ testQemuCapsIterate(const char *suffix,
void
testQemuInfoSetArgs(struct testQemuInfo *info,
testQemuInfoSetArgs(testQemuInfo *info,
struct testQemuConf *conf, ...)
{
va_list argptr;
@ -900,7 +900,7 @@ testQemuInsertRealCaps(virFileCache *cache,
int
testQemuInfoInitArgs(struct testQemuInfo *info)
testQemuInfoInitArgs(testQemuInfo *info)
{
ssize_t cap;
@ -959,7 +959,7 @@ testQemuInfoInitArgs(struct testQemuInfo *info)
void
testQemuInfoClear(struct testQemuInfo *info)
testQemuInfoClear(testQemuInfo *info)
{
VIR_FREE(info->infile);
VIR_FREE(info->outfile);

View File

@ -96,7 +96,7 @@ struct testQemuArgs {
bool invalidarg;
};
struct testQemuInfo {
struct _testQemuInfo {
const char *name;
char *infile;
char *outfile;
@ -114,6 +114,8 @@ struct testQemuInfo {
struct testQemuConf *conf;
};
typedef struct _testQemuInfo testQemuInfo;
virDomainXMLOption *testQemuXMLConfInit(void);
@ -150,11 +152,11 @@ int testQemuCapsIterate(const char *suffix,
testQemuCapsIterateCallback callback,
void *opaque);
void testQemuInfoSetArgs(struct testQemuInfo *info,
void testQemuInfoSetArgs(testQemuInfo *info,
struct testQemuConf *conf,
...);
int testQemuInfoInitArgs(struct testQemuInfo *info);
void testQemuInfoClear(struct testQemuInfo *info);
int testQemuInfoInitArgs(testQemuInfo *info);
void testQemuInfoClear(testQemuInfo *info);
int testQemuPrepareHostBackendChardevOne(virDomainDeviceDef *dev,
virDomainChrSourceDef *chardev,