mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
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:
parent
06c1ab8222
commit
aecd5085db
@ -384,7 +384,7 @@ static virCommand *
|
|||||||
testCompareXMLToArgvCreateArgs(virQEMUDriver *drv,
|
testCompareXMLToArgvCreateArgs(virQEMUDriver *drv,
|
||||||
virDomainObj *vm,
|
virDomainObj *vm,
|
||||||
const char *migrateURI,
|
const char *migrateURI,
|
||||||
struct testQemuInfo *info,
|
testQemuInfo *info,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
qemuDomainObjPrivate *priv = vm->privateData;
|
qemuDomainObjPrivate *priv = vm->privateData;
|
||||||
@ -561,7 +561,7 @@ testCompareXMLToArgvValidateSchemaCommand(GStrv args,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
testCompareXMLToArgvValidateSchema(virCommand *cmd,
|
testCompareXMLToArgvValidateSchema(virCommand *cmd,
|
||||||
struct testQemuInfo *info)
|
testQemuInfo *info)
|
||||||
{
|
{
|
||||||
g_auto(GStrv) args = NULL;
|
g_auto(GStrv) args = NULL;
|
||||||
|
|
||||||
@ -579,7 +579,7 @@ testCompareXMLToArgvValidateSchema(virCommand *cmd,
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
testInfoCheckDuplicate(struct testQemuInfo *info)
|
testInfoCheckDuplicate(testQemuInfo *info)
|
||||||
{
|
{
|
||||||
const char *path = info->outfile;
|
const char *path = info->outfile;
|
||||||
|
|
||||||
@ -603,7 +603,7 @@ testInfoCheckDuplicate(struct testQemuInfo *info)
|
|||||||
static int
|
static int
|
||||||
testCompareXMLToArgv(const void *data)
|
testCompareXMLToArgv(const void *data)
|
||||||
{
|
{
|
||||||
struct testQemuInfo *info = (void *) data;
|
testQemuInfo *info = (void *) data;
|
||||||
g_autofree char *migrateURI = NULL;
|
g_autofree char *migrateURI = NULL;
|
||||||
g_auto(virBuffer) actualBuf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) actualBuf = VIR_BUFFER_INITIALIZER;
|
||||||
g_autofree char *actualargv = NULL;
|
g_autofree char *actualargv = NULL;
|
||||||
@ -626,7 +626,7 @@ testCompareXMLToArgv(const void *data)
|
|||||||
/* mark test case as used */
|
/* mark test case as used */
|
||||||
ignore_value(g_hash_table_remove(info->conf->existingTestCases, info->infile));
|
ignore_value(g_hash_table_remove(info->conf->existingTestCases, info->infile));
|
||||||
|
|
||||||
if (testQemuInfoInitArgs((struct testQemuInfo *) info) < 0)
|
if (testQemuInfoInitArgs((testQemuInfo *) info) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (testInfoCheckDuplicate(info) < 0)
|
if (testInfoCheckDuplicate(info) < 0)
|
||||||
@ -812,7 +812,7 @@ testCompareXMLToArgv(const void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
testInfoSetPaths(struct testQemuInfo *info,
|
testInfoSetPaths(testQemuInfo *info,
|
||||||
const char *suffix)
|
const char *suffix)
|
||||||
{
|
{
|
||||||
info->infile = g_strdup_printf("%s/qemuxml2argvdata/%s.xml",
|
info->infile = g_strdup_printf("%s/qemuxml2argvdata/%s.xml",
|
||||||
@ -941,7 +941,7 @@ mymain(void)
|
|||||||
*/
|
*/
|
||||||
# define DO_TEST_FULL(_name, _suffix, ...) \
|
# define DO_TEST_FULL(_name, _suffix, ...) \
|
||||||
do { \
|
do { \
|
||||||
static struct testQemuInfo info = { \
|
static testQemuInfo info = { \
|
||||||
.name = _name, \
|
.name = _name, \
|
||||||
}; \
|
}; \
|
||||||
testQemuInfoSetArgs(&info, &testConf, __VA_ARGS__); \
|
testQemuInfoSetArgs(&info, &testConf, __VA_ARGS__); \
|
||||||
|
@ -20,9 +20,9 @@
|
|||||||
static virQEMUDriver driver;
|
static virQEMUDriver driver;
|
||||||
|
|
||||||
static int
|
static int
|
||||||
testXML2XMLCommon(const struct testQemuInfo *info)
|
testXML2XMLCommon(const testQemuInfo *info)
|
||||||
{
|
{
|
||||||
if (testQemuInfoInitArgs((struct testQemuInfo *) info) < 0)
|
if (testQemuInfoInitArgs((testQemuInfo *) info) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
virFileCacheClear(driver.qemuCapsCache);
|
virFileCacheClear(driver.qemuCapsCache);
|
||||||
@ -37,7 +37,7 @@ testXML2XMLCommon(const struct testQemuInfo *info)
|
|||||||
static int
|
static int
|
||||||
testXML2XMLActive(const void *opaque)
|
testXML2XMLActive(const void *opaque)
|
||||||
{
|
{
|
||||||
const struct testQemuInfo *info = opaque;
|
const testQemuInfo *info = opaque;
|
||||||
|
|
||||||
if (info->flags & FLAG_SKIP_CONFIG_ACTIVE)
|
if (info->flags & FLAG_SKIP_CONFIG_ACTIVE)
|
||||||
return EXIT_AM_SKIP;
|
return EXIT_AM_SKIP;
|
||||||
@ -57,7 +57,7 @@ testXML2XMLActive(const void *opaque)
|
|||||||
static int
|
static int
|
||||||
testXML2XMLInactive(const void *opaque)
|
testXML2XMLInactive(const void *opaque)
|
||||||
{
|
{
|
||||||
const struct testQemuInfo *info = opaque;
|
const testQemuInfo *info = opaque;
|
||||||
|
|
||||||
if (testXML2XMLCommon(info) < 0 ||
|
if (testXML2XMLCommon(info) < 0 ||
|
||||||
testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt,
|
testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt,
|
||||||
@ -84,7 +84,7 @@ testXML2XMLInactive(const void *opaque)
|
|||||||
* both the "active" and "inactive" versions are the same.
|
* both the "active" and "inactive" versions are the same.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
testInfoSetPaths(struct testQemuInfo *info,
|
testInfoSetPaths(testQemuInfo *info,
|
||||||
const char *suffix,
|
const char *suffix,
|
||||||
const char *statesuffix)
|
const char *statesuffix)
|
||||||
{
|
{
|
||||||
@ -148,7 +148,7 @@ mymain(void)
|
|||||||
|
|
||||||
#define DO_TEST_CAPS_INTERNAL(_name, arch, ver, ...) \
|
#define DO_TEST_CAPS_INTERNAL(_name, arch, ver, ...) \
|
||||||
do { \
|
do { \
|
||||||
static struct testQemuInfo info = { \
|
static testQemuInfo info = { \
|
||||||
.name = _name, \
|
.name = _name, \
|
||||||
}; \
|
}; \
|
||||||
testQemuInfoSetArgs(&info, &testConf, \
|
testQemuInfoSetArgs(&info, &testConf, \
|
||||||
|
@ -18,7 +18,7 @@ static virQEMUDriver driver;
|
|||||||
static int
|
static int
|
||||||
testCompareStatusXMLToXMLFiles(const void *opaque)
|
testCompareStatusXMLToXMLFiles(const void *opaque)
|
||||||
{
|
{
|
||||||
const struct testQemuInfo *data = opaque;
|
const testQemuInfo *data = opaque;
|
||||||
virDomainObj *obj = NULL;
|
virDomainObj *obj = NULL;
|
||||||
g_autofree char *actual = NULL;
|
g_autofree char *actual = NULL;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
@ -61,7 +61,7 @@ testCompareStatusXMLToXMLFiles(const void *opaque)
|
|||||||
static const char *statusPath = abs_srcdir "/qemustatusxml2xmldata/";
|
static const char *statusPath = abs_srcdir "/qemustatusxml2xmldata/";
|
||||||
|
|
||||||
static void
|
static void
|
||||||
testInfoSetStatusPaths(struct testQemuInfo *info)
|
testInfoSetStatusPaths(testQemuInfo *info)
|
||||||
{
|
{
|
||||||
info->infile = g_strdup_printf("%s%s-in.xml", statusPath, info->name);
|
info->infile = g_strdup_printf("%s%s-in.xml", statusPath, info->name);
|
||||||
info->outfile = g_strdup_printf("%s%s-out.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) \
|
#define DO_TEST_STATUS(_name) \
|
||||||
do { \
|
do { \
|
||||||
static struct testQemuInfo info = { \
|
static testQemuInfo info = { \
|
||||||
.name = _name, \
|
.name = _name, \
|
||||||
}; \
|
}; \
|
||||||
testQemuInfoSetArgs(&info, &testConf, ARG_END); \
|
testQemuInfoSetArgs(&info, &testConf, ARG_END); \
|
||||||
|
@ -623,7 +623,7 @@ testQemuCapsIterate(const char *suffix,
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
testQemuInfoSetArgs(struct testQemuInfo *info,
|
testQemuInfoSetArgs(testQemuInfo *info,
|
||||||
struct testQemuConf *conf, ...)
|
struct testQemuConf *conf, ...)
|
||||||
{
|
{
|
||||||
va_list argptr;
|
va_list argptr;
|
||||||
@ -900,7 +900,7 @@ testQemuInsertRealCaps(virFileCache *cache,
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
testQemuInfoInitArgs(struct testQemuInfo *info)
|
testQemuInfoInitArgs(testQemuInfo *info)
|
||||||
{
|
{
|
||||||
ssize_t cap;
|
ssize_t cap;
|
||||||
|
|
||||||
@ -959,7 +959,7 @@ testQemuInfoInitArgs(struct testQemuInfo *info)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
testQemuInfoClear(struct testQemuInfo *info)
|
testQemuInfoClear(testQemuInfo *info)
|
||||||
{
|
{
|
||||||
VIR_FREE(info->infile);
|
VIR_FREE(info->infile);
|
||||||
VIR_FREE(info->outfile);
|
VIR_FREE(info->outfile);
|
||||||
|
@ -96,7 +96,7 @@ struct testQemuArgs {
|
|||||||
bool invalidarg;
|
bool invalidarg;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct testQemuInfo {
|
struct _testQemuInfo {
|
||||||
const char *name;
|
const char *name;
|
||||||
char *infile;
|
char *infile;
|
||||||
char *outfile;
|
char *outfile;
|
||||||
@ -114,6 +114,8 @@ struct testQemuInfo {
|
|||||||
struct testQemuConf *conf;
|
struct testQemuConf *conf;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef struct _testQemuInfo testQemuInfo;
|
||||||
|
|
||||||
virDomainXMLOption *testQemuXMLConfInit(void);
|
virDomainXMLOption *testQemuXMLConfInit(void);
|
||||||
|
|
||||||
|
|
||||||
@ -150,11 +152,11 @@ int testQemuCapsIterate(const char *suffix,
|
|||||||
testQemuCapsIterateCallback callback,
|
testQemuCapsIterateCallback callback,
|
||||||
void *opaque);
|
void *opaque);
|
||||||
|
|
||||||
void testQemuInfoSetArgs(struct testQemuInfo *info,
|
void testQemuInfoSetArgs(testQemuInfo *info,
|
||||||
struct testQemuConf *conf,
|
struct testQemuConf *conf,
|
||||||
...);
|
...);
|
||||||
int testQemuInfoInitArgs(struct testQemuInfo *info);
|
int testQemuInfoInitArgs(testQemuInfo *info);
|
||||||
void testQemuInfoClear(struct testQemuInfo *info);
|
void testQemuInfoClear(testQemuInfo *info);
|
||||||
|
|
||||||
int testQemuPrepareHostBackendChardevOne(virDomainDeviceDef *dev,
|
int testQemuPrepareHostBackendChardevOne(virDomainDeviceDef *dev,
|
||||||
virDomainChrSourceDef *chardev,
|
virDomainChrSourceDef *chardev,
|
||||||
|
Loading…
Reference in New Issue
Block a user