* [PATCH] libtraceevent: Have unit test fail when any tests fail
@ 2024-06-14 19:34 Steven Rostedt
0 siblings, 0 replies; only message in thread
From: Steven Rostedt @ 2024-06-14 19:34 UTC (permalink / raw)
To: Linux Trace Devel; +Cc: Paul Mars
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
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/20240329135331.784707-1-paul.mars@canonical.com/
Reported-by: Paul Mars <paul.mars@canonical.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
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 a26e42e..7c4b9b6 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;
+ int failed_tests;
for (;;) {
int c;
@@ -82,6 +83,7 @@ int main(int argc, char **argv)
CU_basic_set_mode(verbose);
CU_basic_run_tests();
+ failed_tests = CU_get_number_of_tests_failed();
CU_cleanup_registry();
- return 0;
+ return failed_tests != 0;
}
--
2.43.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2024-06-14 19:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-14 19:34 [PATCH] libtraceevent: Have unit test fail when any tests fail Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).