Skip to content

Commit 340e2e6

Browse files
committed
libtraceevent: Have unit test fail when any tests fail
If any of the tests of the unit test fails, make sure it returns non-zero to allow tools that use this know that a test failed. Link: https://lore.kernel.org/linux-trace-devel/[email protected]/ Link: https://lore.kernel.org/linux-trace-devel/[email protected] Reported-by: Paul Mars <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent c84155f commit 340e2e6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

utest/trace-utest.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ int main(int argc, char **argv)
3737
{
3838
CU_BasicRunMode verbose = CU_BRM_VERBOSE;
3939
enum unit_tests tests = RUN_NONE;
40+
int failed_tests;
4041

4142
for (;;) {
4243
int c;
@@ -82,6 +83,7 @@ int main(int argc, char **argv)
8283

8384
CU_basic_set_mode(verbose);
8485
CU_basic_run_tests();
86+
failed_tests = CU_get_number_of_tests_failed();
8587
CU_cleanup_registry();
86-
return 0;
88+
return failed_tests != 0;
8789
}

0 commit comments

Comments
 (0)