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

View File

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