linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libtraceevent: Make sure unit test binary fails when tests fail
@ 2024-03-29 13:53 Paul Mars
  2024-04-12  0:35 ` Steven Rostedt
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Mars @ 2024-03-29 13:53 UTC (permalink / raw)
  To: linux-trace-devel; +Cc: Paul Mars

If tests in the trace-utest binary fails, it returns 0 anyway.

So now make sure failing tests will be easily detected by returning 1.
---
 utest/trace-utest.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/utest/trace-utest.c b/utest/trace-utest.c
index a26e42e..a0a45db 100644
--- a/utest/trace-utest.c
+++ b/utest/trace-utest.c
@@ -82,6 +82,10 @@ int main(int argc, char **argv)
 
 	CU_basic_set_mode(verbose);
 	CU_basic_run_tests();
+	int failed_tests = CU_get_number_of_tests_failed();
 	CU_cleanup_registry();
+	if (failed_tests != 0){
+		return 1;
+	}
 	return 0;
 }
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-04-12  0:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-29 13:53 [PATCH] libtraceevent: Make sure unit test binary fails when tests fail Paul Mars
2024-04-12  0:35 ` 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).