[PATCH] trace-utest: return non-zero when tests have failed
Nick Rosbrook <[email protected]> Mon, 15 Jun 2026 09:01:44 -0400
| Newsgroups | org.kernel.vger.linux-trace-devel |
|---|---|
| Message-ID | <[email protected]> |
Otherwise, the exit code cannot be used to catch test failures. Signed-off-by: Nick Rosbrook <[email protected]> --- utest/trace-utest.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/utest/trace-utest.c b/utest/trace-utest.c index 6bb190ee..cef8bb25 100644 --- a/utest/trace-utest.c +++ b/utest/trace-utest.c @@ -37,6 +37,7 @@ int main(int argc, char **argv) { CU_BasicRunMode verbose = CU_BRM_VERBOSE; enum unit_tests tests = RUN_NONE; + bool tests_failed = false; argv0 = argv[0]; @@ -88,6 +89,7 @@ int main(int argc, char **argv) CU_basic_set_mode(verbose); CU_basic_run_tests(); + tests_failed = CU_get_number_of_tests_failed() != 0; CU_cleanup_registry(); - return 0; + return tests_failed ? -1 : 0; } -- 2.53.0