提交 bc4c8383 编写于 作者: B Bjoern Walk 提交者: Ján Tomko

tests: qemuxml2argv: add CAPS_ARCH_LATEST macro

Testing with the latest capabilities is possible with the x86_64 centric
implemented macro CAPS_LATEST. The new macro CAPS_ARCH_LATEST provides
the user the ability to specify the desired architecture when testing with
the latest capabilities.
Signed-off-by: NBjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: NBoris Fiuczynski <fiuczy@linux.ibm.com>
上级 087de2f5
...@@ -621,10 +621,11 @@ testCompareXMLToArgv(const void *data) ...@@ -621,10 +621,11 @@ testCompareXMLToArgv(const void *data)
static int static int
mymain(void) mymain(void)
{ {
int ret = 0; int ret = 0, i;
char *fakerootdir; char *fakerootdir;
bool skipLegacyCPUs = false; bool skipLegacyCPUs = false;
char *capslatest_x86_64 = NULL; const char *archs[] = { "x86_64", "s390x" };
virHashTablePtr capslatest = NULL;
if (VIR_STRDUP_QUIET(fakerootdir, FAKEROOTDIRTEMPLATE) < 0) { if (VIR_STRDUP_QUIET(fakerootdir, FAKEROOTDIRTEMPLATE) < 0) {
fprintf(stderr, "Out of memory\n"); fprintf(stderr, "Out of memory\n");
...@@ -693,12 +694,23 @@ mymain(void) ...@@ -693,12 +694,23 @@ mymain(void)
if (VIR_STRDUP_QUIET(driver.config->memoryBackingDir, "/var/lib/libvirt/qemu/ram") < 0) if (VIR_STRDUP_QUIET(driver.config->memoryBackingDir, "/var/lib/libvirt/qemu/ram") < 0)
return EXIT_FAILURE; return EXIT_FAILURE;
if (!(capslatest_x86_64 = testQemuGetLatestCapsForArch(abs_srcdir "/qemucapabilitiesdata", capslatest = virHashCreate(4, virHashValueFree);
"x86_64", "xml"))) if (!capslatest)
return EXIT_FAILURE; return EXIT_FAILURE;
VIR_TEST_VERBOSE("\nlatest caps x86_64: %s\n", capslatest_x86_64); VIR_TEST_VERBOSE("\n");
for (i = 0; i < ARRAY_CARDINALITY(archs); ++i) {
char *cap = testQemuGetLatestCapsForArch(abs_srcdir "/qemucapabilitiesdata",
archs[i], "xml");
if (!cap || virHashAddEntry(capslatest, archs[i], cap) < 0)
return EXIT_FAILURE;
VIR_TEST_VERBOSE("latest caps for %s: %s\n", archs[i], cap);
}
VIR_TEST_VERBOSE("\n");
/** /**
* The following set of macros allows testing of XML -> argv conversion with a * The following set of macros allows testing of XML -> argv conversion with a
...@@ -746,9 +758,12 @@ mymain(void) ...@@ -746,9 +758,12 @@ mymain(void)
# define DO_TEST_CAPS_VER(name, ver) \ # define DO_TEST_CAPS_VER(name, ver) \
DO_TEST_CAPS_ARCH_VER(name, "x86_64", ver) DO_TEST_CAPS_ARCH_VER(name, "x86_64", ver)
# define DO_TEST_CAPS_ARCH_LATEST(name, arch) \
DO_TEST_CAPS_INTERNAL(name, arch "-latest", NULL, 0, 0, arch, \
virHashLookup(capslatest, arch), true)
# define DO_TEST_CAPS_LATEST(name) \ # define DO_TEST_CAPS_LATEST(name) \
DO_TEST_CAPS_INTERNAL(name, "x86_64-latest", NULL, 0, 0, "x86_64", \ DO_TEST_CAPS_ARCH_LATEST(name, "x86_64")
capslatest_x86_64, true)
/** /**
* The following test macros should be used only in cases when the tests require * The following test macros should be used only in cases when the tests require
...@@ -2948,7 +2963,7 @@ mymain(void) ...@@ -2948,7 +2963,7 @@ mymain(void)
VIR_FREE(driver.config->nbdTLSx509certdir); VIR_FREE(driver.config->nbdTLSx509certdir);
qemuTestDriverFree(&driver); qemuTestDriverFree(&driver);
VIR_FREE(fakerootdir); VIR_FREE(fakerootdir);
VIR_FREE(capslatest_x86_64); virHashFree(capslatest);
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE; return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册