const char *prefix G_GNUC_UNUSED,
const char *version,
const char *arch,
+ const char *variant,
const char *suffix G_GNUC_UNUSED,
void *opaque)
{
int ret = 0;
+ /* currently variant tests are not handled here */
+ if (STRNEQ(variant, ""))
+ return 0;
+
if (STREQ(arch, "x86_64")) {
/* For x86_64 we test three combinations:
*
caps_$QEMUVERSION_$ARCHITECTURE.$SUFFIX
+or::
+
+ caps_$QEMUVERSION_$ARCHITECTURE+$VARIANT.$SUFFIX
+
``$QEMUVERSION``
Numeric representation of the qemu version, e.g.: ``7.0.0``
``.replies`` for the dump of the QMP communication used to probe qemu.
``.xml`` for the generated capability dump
+``$VARIANT``
+
+ The variant name is an optional arbitrary string, not containing any dot.
+
+ A variant is an additional named version of capabilities for given version and
+ architecture tuple. This allows for testing special cases which e.g. depend
+ on a specific host platform or operating system feature, which differs from
+ the main tests. Note that in the test code the variant name is an empty string
+ or includes the '+' sign for ease of use.
+
+Known test variants
+-------------------
+
+This section will contain a list of variants that are used in the test suite.
+
Usage in tests
==============
const char *prefix,
const char *version,
const char *archName,
+ const char *variant,
const char *suffix,
void *opaque G_GNUC_UNUSED)
{
- g_autofree char *repliesFile = g_strdup_printf("%s/%s_%s_%s.%s", inputDir, prefix, version, archName, suffix);
+ g_autofree char *repliesFile = g_strdup_printf("%s/%s_%s_%s%s.%s",
+ inputDir, prefix, version,
+ archName, variant, suffix);
return virTestRun(repliesFile, testCapsFile, repliesFile);
}
const char *prefix;
const char *version;
const char *archName;
+ const char *variant;
const char *suffix;
int ret;
};
unsigned int fakeMicrocodeVersion = 0;
const char *p;
- repliesFile = g_strdup_printf("%s/%s_%s_%s.%s",
+ repliesFile = g_strdup_printf("%s/%s_%s_%s%s.%s",
data->inputDir, data->prefix, data->version,
- data->archName, data->suffix);
- capsFile = g_strdup_printf("%s/%s_%s_%s.xml",
+ data->archName, data->variant, data->suffix);
+ capsFile = g_strdup_printf("%s/%s_%s_%s%s.xml",
data->outputDir, data->prefix, data->version,
- data->archName);
+ data->archName, data->variant);
if (!(mon = qemuMonitorTestNewFromFileFull(repliesFile, &data->driver, NULL,
NULL)))
g_autoptr(virQEMUCaps) copy = NULL;
g_autofree char *actual = NULL;
- capsFile = g_strdup_printf("%s/%s_%s_%s.xml",
+ capsFile = g_strdup_printf("%s/%s_%s_%s%s.xml",
data->outputDir, data->prefix, data->version,
- data->archName);
+ data->archName, data->variant);
if (!(orig = qemuTestParseCapabilitiesArch(
virArchFromString(data->archName), capsFile)))
const char *prefix,
const char *version,
const char *archName,
+ const char *variant,
const char *suffix,
void *opaque)
{
data->prefix = prefix;
data->version = version;
data->archName = archName;
+ data->variant = variant,
data->suffix = suffix;
if (virTestRun(title, testQemuCaps, data) < 0)
const char *prefix;
const char *version;
const char *archName;
+ const char *variant;
const char *suffix;
int ret;
};
g_autofree char *capsXml = NULL;
g_autoptr(virCaps) capsProvided = NULL;
- xmlFile = g_strdup_printf("%s/caps.%s.xml", data->outputDir, data->archName);
+ xmlFile = g_strdup_printf("%s/caps.%s%s.xml", data->outputDir, data->archName, data->variant);
- capsFile = g_strdup_printf("%s/%s_%s_%s.%s",
+ capsFile = g_strdup_printf("%s/%s_%s_%s%s.%s",
data->inputDir, data->prefix, data->version,
- data->archName, data->suffix);
+ data->archName, data->variant, data->suffix);
if (virTestLoadFile(capsFile, &capsData) < 0)
return -1;
const char *prefix,
const char *version,
const char *archName,
+ const char *variant,
const char *suffix,
void *opaque)
{
data->prefix = prefix;
data->version = version;
data->archName = archName;
+ data->variant = variant;
data->suffix = suffix;
if (virTestRun(title, testQemuCapsXML, data) < 0)
g_autofree char *tmp = g_strdup(ent->d_name);
char *version = NULL;
char *archName = NULL;
+ g_autofree char *variant = NULL;
+ char *var;
/* Strip the trailing suffix, moving on if it's not present */
if (!virStringStripSuffix(tmp, suffix))
archName[0] = '\0';
archName++;
+ /* Find the 'variant' of the test and split it including the leading '+' */
+ if ((var = strchr(archName, '+'))) {
+ variant = g_strdup(var);
+ var[0] = '\0';
+ } else {
+ variant = g_strdup("");
+ }
+
/* Run the user-provided callback.
*
* We skip the dot that, as verified earlier, starts the suffix
* the callback.
*/
if (callback(TEST_QEMU_CAPS_PATH, "caps", version,
- archName, suffix + 1, opaque) < 0)
+ archName, variant, suffix + 1, opaque) < 0)
fail = true;
}
const char *prefix,
const char *version,
const char *archName,
+ const char *variant,
const char *suffix,
void *opaque);
int testQemuCapsIterate(const char *suffix,