mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-11-03 08:24:18 +03:00
tests: uniformly report test failures
testutils.c likes to print summaries after a test completes, including if it failed. But if the test outright exit()s, this summary is skipped. Enforce that we return instead of exit. * cfg.mk (sc_prohibit_exit_in_tests): New syntax check. * tests/commandhelper.c (main): Fix offenders. * tests/qemumonitorjsontest.c (mymain): Likewise. * tests/seclabeltest.c (main): Likewise. * tests/securityselinuxlabeltest.c (mymain): Likewise. * tests/securityselinuxtest.c (mymain): Likewise. * tests/testutils.h (VIRT_TEST_MAIN_PRELOAD): Likewise. * tests/testutils.c (virtTestMain): Likewise. (virtTestCaptureProgramOutput): Use symbolic name.
This commit is contained in:
@@ -317,7 +317,7 @@ virtTestCaptureProgramOutput(const char *const argv[], char **buf, int maxlen)
|
||||
virtTestCaptureProgramExecChild(argv, pipefd[1]);
|
||||
|
||||
VIR_FORCE_CLOSE(pipefd[1]);
|
||||
_exit(1);
|
||||
_exit(EXIT_FAILURE);
|
||||
|
||||
case -1:
|
||||
return -1;
|
||||
@@ -586,7 +586,7 @@ int virtTestMain(int argc,
|
||||
abs_srcdir_cleanup = true;
|
||||
}
|
||||
if (!abs_srcdir)
|
||||
exit(EXIT_AM_HARDFAIL);
|
||||
return EXIT_AM_HARDFAIL;
|
||||
|
||||
progname = last_component(argv[0]);
|
||||
if (STRPREFIX(progname, "lt-"))
|
||||
@@ -603,13 +603,13 @@ int virtTestMain(int argc,
|
||||
|
||||
if (virThreadInitialize() < 0 ||
|
||||
virErrorInitialize() < 0)
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
|
||||
virLogSetFromEnv();
|
||||
if (!getenv("LIBVIRT_DEBUG") && !virLogGetNbOutputs()) {
|
||||
if (virLogDefineOutput(virtTestLogOutput, virtTestLogClose, &testLog,
|
||||
VIR_LOG_DEBUG, VIR_LOG_TO_STDERR, NULL, 0) < 0)
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
#if TEST_OOM
|
||||
|
||||
Reference in New Issue
Block a user