4 #include <CUnit/CUnit.h>
5 #include <CUnit/Basic.h>
8 #include "test_tsort.h"
10 #include "test_process.h"
12 CU_SuiteInfo vlock_test_suites
[] = {
13 { "test_list" , NULL
, NULL
, list_tests
},
14 { "test_tsort", NULL
, NULL
, tsort_tests
},
15 { "test_util", NULL
, NULL
, util_tests
},
16 { "test_process", NULL
, NULL
, process_tests
},
20 int main(int __attribute__((unused
)) argc
, const char *argv
[])
22 char *output_mode
= getenv("VLOCK_TEST_OUTPUT_MODE");
24 if (CU_initialize_registry() != CUE_SUCCESS
) {
25 fprintf(stderr
, "%s: CUnit initialization failed\n", argv
[0]);
29 if (CU_register_suites(vlock_test_suites
) != CUE_SUCCESS
) {
30 fprintf(stderr
, "%s: registering test suites failed: %s\n", argv
[0], CU_get_error_msg());
34 if (output_mode
!= NULL
) {
35 if (strcmp(output_mode
, "verbose") == 0)
36 CU_basic_set_mode(CU_BRM_VERBOSE
);
37 else if (strcmp(output_mode
, "normal") == 0)
38 CU_basic_set_mode(CU_BRM_NORMAL
);
39 else if (strcmp(output_mode
, "silent") == 0)
40 CU_basic_set_mode(CU_BRM_SILENT
);
43 if (CU_basic_run_tests() != CUE_SUCCESS
) {
44 fprintf(stderr
, "%s: running tests failed\n", argv
[0]);
48 if (CU_get_number_of_tests_failed() > 0)
51 CU_cleanup_registry();
55 CU_cleanup_registry();