tests: make domaincapstest less anoying to debug

Since 6a077cf2b3 domaincapstest does not run through all cases on
failure but terminates right away. This makes it super annoying to debug
or use in combination with VIR_TEST_REGENERATE_OUTPUT.

Fix it by remembering failure and still running through all cases.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
Peter Krempa 2019-10-25 13:59:46 +02:00
parent d64f31dc1f
commit 63d604088c
2 changed files with 25 additions and 19 deletions

View File

@ -313,6 +313,8 @@ doTestQemu(const char *inputDir G_GNUC_UNUSED,
const char *suffix G_GNUC_UNUSED, const char *suffix G_GNUC_UNUSED,
void *opaque) void *opaque)
{ {
int ret = 0;
if (STREQ(arch, "x86_64")) { if (STREQ(arch, "x86_64")) {
/* For x86_64 we test three combinations: /* For x86_64 we test three combinations:
* *
@ -321,13 +323,16 @@ doTestQemu(const char *inputDir G_GNUC_UNUSED,
* - TCG with default machine * - TCG with default machine
*/ */
if (doTestQemuInternal(version, NULL, arch, if (doTestQemuInternal(version, NULL, arch,
VIR_DOMAIN_VIRT_KVM, opaque) < 0 || VIR_DOMAIN_VIRT_KVM, opaque) < 0)
doTestQemuInternal(version, "q35", arch, ret = -1;
VIR_DOMAIN_VIRT_KVM, opaque) < 0 ||
doTestQemuInternal(version, NULL, arch, if (doTestQemuInternal(version, "q35", arch,
VIR_DOMAIN_VIRT_QEMU, opaque) < 0) { VIR_DOMAIN_VIRT_KVM, opaque) < 0)
return -1; ret = -1;
}
if (doTestQemuInternal(version, NULL, arch,
VIR_DOMAIN_VIRT_QEMU, opaque) < 0)
ret = -1;
} else if (STREQ(arch, "aarch64")) { } else if (STREQ(arch, "aarch64")) {
/* For aarch64 we test two combinations: /* For aarch64 we test two combinations:
* *
@ -335,21 +340,22 @@ doTestQemu(const char *inputDir G_GNUC_UNUSED,
* - KVM with virt machine * - KVM with virt machine
*/ */
if (doTestQemuInternal(version, NULL, arch, if (doTestQemuInternal(version, NULL, arch,
VIR_DOMAIN_VIRT_KVM, opaque) < 0 || VIR_DOMAIN_VIRT_KVM, opaque) < 0)
doTestQemuInternal(version, "virt", arch, ret = -1;
VIR_DOMAIN_VIRT_KVM, opaque) < 0) {
return -1; if (doTestQemuInternal(version, "virt", arch,
} VIR_DOMAIN_VIRT_KVM, opaque) < 0)
ret = -1;
} else if (STRPREFIX(arch, "riscv")) { } else if (STRPREFIX(arch, "riscv")) {
/* Unfortunately we have to skip RISC-V at the moment */ /* Unfortunately we have to skip RISC-V at the moment */
return 0; return 0;
} else { } else {
if (doTestQemuInternal(version, NULL, arch, if (doTestQemuInternal(version, NULL, arch,
VIR_DOMAIN_VIRT_KVM, opaque) < 0) VIR_DOMAIN_VIRT_KVM, opaque) < 0)
return -1; ret = -1;
} }
return 0; return ret;
} }
#endif #endif
@ -431,7 +437,7 @@ mymain(void)
abs_srcdir "/qemufirmwaredata/home/user/.config/qemu/firmware"); abs_srcdir "/qemufirmwaredata/home/user/.config/qemu/firmware");
if (testQemuCapsIterate(".xml", doTestQemu, cfg) < 0) if (testQemuCapsIterate(".xml", doTestQemu, cfg) < 0)
return EXIT_FAILURE; ret = -1;
/* /*
* Run "tests/qemucapsprobe /path/to/qemu/binary >foo.replies" * Run "tests/qemucapsprobe /path/to/qemu/binary >foo.replies"

View File

@ -902,6 +902,7 @@ testQemuCapsIterate(const char *suffix,
DIR *dir = NULL; DIR *dir = NULL;
int rc; int rc;
int ret = -1; int ret = -1;
bool fail = false;
if (!callback) if (!callback)
return 0; return 0;
@ -949,12 +950,11 @@ testQemuCapsIterate(const char *suffix,
* the callback. * the callback.
*/ */
if (callback(TEST_QEMU_CAPS_PATH, "caps", version, if (callback(TEST_QEMU_CAPS_PATH, "caps", version,
archName, suffix + 1, opaque) < 0) { archName, suffix + 1, opaque) < 0)
goto cleanup; fail = true;
}
} }
if (rc < 0) if (rc < 0 || fail)
goto cleanup; goto cleanup;
ret = 0; ret = 0;