qemucapabilitiestest: Prepare for testing non-x86_64 archs

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Jiri Denemark 2016-04-25 14:19:49 +02:00
parent d90877f7eb
commit 800c98af6f
22 changed files with 26 additions and 22 deletions

View File

@ -95,6 +95,7 @@ fillAllCaps(virDomainCapsPtr domCaps)
static int
fillQemuCaps(virDomainCapsPtr domCaps,
const char *name,
virArch arch,
virQEMUDriverConfigPtr cfg)
{
int ret = -1;
@ -102,8 +103,8 @@ fillQemuCaps(virDomainCapsPtr domCaps,
virQEMUCapsPtr qemuCaps = NULL;
virDomainCapsLoaderPtr loader = &domCaps->os.loader;
if (virAsprintf(&path, "%s/qemucapabilitiesdata/%s.caps",
abs_srcdir, name) < 0 ||
if (virAsprintf(&path, "%s/qemucapabilitiesdata/%s.%s.caps",
abs_srcdir, name, virArchToString(arch)) < 0 ||
!(qemuCaps = qemuTestParseCapabilities(path)))
goto cleanup;
@ -186,7 +187,8 @@ test_virDomainCapsFormat(const void *opaque)
case CAPS_QEMU:
#if WITH_QEMU
if (fillQemuCaps(domCaps, data->capsName, data->capsOpaque) < 0)
if (fillQemuCaps(domCaps, data->capsName, data->arch,
data->capsOpaque) < 0)
goto cleanup;
#endif
break;

View File

@ -30,6 +30,7 @@ typedef struct _testQemuData testQemuData;
typedef testQemuData *testQemuDataPtr;
struct _testQemuData {
virDomainXMLOptionPtr xmlopt;
const char *archName;
const char *base;
};
@ -120,10 +121,10 @@ testQemuCaps(const void *opaque)
qemuMonitorTestPtr mon = NULL;
virQEMUCapsPtr capsProvided = NULL, capsComputed = NULL;
if (virAsprintf(&repliesFile, "%s/qemucapabilitiesdata/%s.replies",
abs_srcdir, data->base) < 0 ||
virAsprintf(&capsFile, "%s/qemucapabilitiesdata/%s.caps",
abs_srcdir, data->base) < 0)
if (virAsprintf(&repliesFile, "%s/qemucapabilitiesdata/%s.%s.replies",
abs_srcdir, data->base, data->archName) < 0 ||
virAsprintf(&capsFile, "%s/qemucapabilitiesdata/%s.%s.caps",
abs_srcdir, data->base, data->archName) < 0)
goto cleanup;
if (virtTestLoadFile(repliesFile, &replies) < 0)
@ -176,23 +177,24 @@ mymain(void)
data.xmlopt = driver.xmlopt;
#define DO_TEST(name) \
do { \
data.base = name; \
if (virtTestRun(name, testQemuCaps, &data) < 0) \
ret = -1; \
#define DO_TEST(arch, name) \
do { \
data.archName = arch; \
data.base = name; \
if (virtTestRun(name "(" arch ")", testQemuCaps, &data) < 0) \
ret = -1; \
} while (0)
DO_TEST("caps_1.2.2-1");
DO_TEST("caps_1.3.1-1");
DO_TEST("caps_1.4.2-1");
DO_TEST("caps_1.5.3-1");
DO_TEST("caps_1.6.0-1");
DO_TEST("caps_1.6.50-1");
DO_TEST("caps_2.1.1-1");
DO_TEST("caps_2.4.0-1");
DO_TEST("caps_2.5.0-1");
DO_TEST("caps_2.6.0-1");
DO_TEST("x86_64", "caps_1.2.2-1");
DO_TEST("x86_64", "caps_1.3.1-1");
DO_TEST("x86_64", "caps_1.4.2-1");
DO_TEST("x86_64", "caps_1.5.3-1");
DO_TEST("x86_64", "caps_1.6.0-1");
DO_TEST("x86_64", "caps_1.6.50-1");
DO_TEST("x86_64", "caps_2.1.1-1");
DO_TEST("x86_64", "caps_2.4.0-1");
DO_TEST("x86_64", "caps_2.5.0-1");
DO_TEST("x86_64", "caps_2.6.0-1");
/*
* Run "tests/qemucapsprobe /path/to/qemu/binary >foo.replies"