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:
Eric Blake
2013-02-22 15:42:39 -07:00
parent f20b047691
commit dce95297e3
8 changed files with 29 additions and 25 deletions

View File

@@ -1,7 +1,7 @@
/*
* commandhelper.c: Auxiliary program for commandtest
*
* Copyright (C) 2010-2012 Red Hat, Inc.
* Copyright (C) 2010-2013 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -71,9 +71,8 @@ int main(int argc, char **argv) {
origenv++;
}
if (VIR_ALLOC_N(newenv, n) < 0) {
exit(EXIT_FAILURE);
}
if (VIR_ALLOC_N(newenv, n) < 0)
return EXIT_FAILURE;
origenv = environ;
n = i = 0;