libsepol: make "make test" fails when a CUnit test fails
Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
This commit is contained in:
parent
3666bd9a99
commit
2489b50a91
1 changed files with 7 additions and 4 deletions
|
@ -28,6 +28,7 @@
|
|||
#include <CUnit/Console.h>
|
||||
#include <CUnit/TestDB.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <getopt.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -51,9 +52,10 @@ static void usage(char *progname)
|
|||
printf("\t-i, --interactive\t\tinteractive console\n");
|
||||
}
|
||||
|
||||
static int do_tests(int interactive, int verbose)
|
||||
static bool do_tests(int interactive, int verbose)
|
||||
{
|
||||
CU_pSuite suite = NULL;
|
||||
unsigned int num_failures;
|
||||
|
||||
if (CUE_SUCCESS != CU_initialize_registry())
|
||||
return CU_get_error();
|
||||
|
@ -73,8 +75,9 @@ static int do_tests(int interactive, int verbose)
|
|||
CU_console_run_tests();
|
||||
else
|
||||
CU_basic_run_tests();
|
||||
num_failures = CU_get_number_of_tests_failed();
|
||||
CU_cleanup_registry();
|
||||
return CU_get_error();
|
||||
return CU_get_error() == CUE_SUCCESS && num_failures == 0;
|
||||
|
||||
}
|
||||
|
||||
|
@ -106,12 +109,12 @@ int main(int argc, char **argv)
|
|||
|
||||
/* first do the non-mls tests */
|
||||
mls = 0;
|
||||
if (do_tests(interactive, verbose))
|
||||
if (!do_tests(interactive, verbose))
|
||||
return -1;
|
||||
|
||||
/* then with mls */
|
||||
mls = 1;
|
||||
if (do_tests(interactive, verbose))
|
||||
if (!do_tests(interactive, verbose))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue