mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
tests: add testQemuGetLatestCaps
Move the capslatest building from qemuxml2argv to testutilsqemu Reviewed-by: Andrea Bolognani <abologna@redhat.com> Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
2b9d64096f
commit
89effa6159
@ -593,15 +593,8 @@ testInfoSetPaths(struct testQemuInfo *info,
|
||||
static int
|
||||
mymain(void)
|
||||
{
|
||||
int ret = 0, i;
|
||||
int ret = 0;
|
||||
char *fakerootdir;
|
||||
const char *archs[] = {
|
||||
"aarch64",
|
||||
"ppc64",
|
||||
"riscv64",
|
||||
"s390x",
|
||||
"x86_64",
|
||||
};
|
||||
virHashTablePtr capslatest = NULL;
|
||||
|
||||
if (VIR_STRDUP_QUIET(fakerootdir, FAKEROOTDIRTEMPLATE) < 0) {
|
||||
@ -670,24 +663,10 @@ mymain(void)
|
||||
if (VIR_STRDUP(driver.config->nvramDir, "/var/lib/libvirt/qemu/nvram") < 0)
|
||||
return EXIT_FAILURE;
|
||||
|
||||
capslatest = virHashCreate(4, virHashValueFree);
|
||||
capslatest = testQemuGetLatestCaps();
|
||||
if (!capslatest)
|
||||
return EXIT_FAILURE;
|
||||
|
||||
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");
|
||||
|
||||
virFileWrapperAddPrefix(SYSCONFDIR "/qemu/firmware",
|
||||
abs_srcdir "/qemufirmwaredata/etc/qemu/firmware");
|
||||
virFileWrapperAddPrefix(PREFIX "/share/qemu/firmware",
|
||||
|
@ -867,6 +867,43 @@ testQemuGetLatestCapsForArch(const char *dirname,
|
||||
}
|
||||
|
||||
|
||||
virHashTablePtr
|
||||
testQemuGetLatestCaps(void)
|
||||
{
|
||||
const char *archs[] = {
|
||||
"aarch64",
|
||||
"ppc64",
|
||||
"riscv64",
|
||||
"s390x",
|
||||
"x86_64",
|
||||
};
|
||||
virHashTablePtr capslatest;
|
||||
size_t i;
|
||||
|
||||
if (!(capslatest = virHashCreate(4, virHashValueFree)))
|
||||
goto error;
|
||||
|
||||
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)
|
||||
goto error;
|
||||
|
||||
VIR_TEST_VERBOSE("latest caps for %s: %s\n", archs[i], cap);
|
||||
}
|
||||
|
||||
VIR_TEST_VERBOSE("\n");
|
||||
return capslatest;
|
||||
|
||||
error:
|
||||
virHashFree(capslatest);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
testQemuCapsIterate(const char *dirname,
|
||||
const char *suffix,
|
||||
|
@ -93,6 +93,7 @@ int testQemuCapsSetGIC(virQEMUCapsPtr qemuCaps,
|
||||
char *testQemuGetLatestCapsForArch(const char *dirname,
|
||||
const char *arch,
|
||||
const char *suffix);
|
||||
virHashTablePtr testQemuGetLatestCaps(void);
|
||||
|
||||
typedef int (*testQemuCapsIterateCallback)(const char *base,
|
||||
const char *archName,
|
||||
|
Loading…
x
Reference in New Issue
Block a user