From: Paul Mars <paul.mars@canonical.com>
To: linux-trace-devel@vger.kernel.org
Cc: Paul Mars <paul.mars@canonical.com>
Subject: [PATCH] libtraceevent: Make sure unit test binary fails when tests fail
Date: Fri, 29 Mar 2024 14:53:32 +0100 [thread overview]
Message-ID: <20240329135331.784707-1-paul.mars@canonical.com> (raw)
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
next reply other threads:[~2024-03-29 13:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-29 13:53 Paul Mars [this message]
2024-04-12 0:35 ` [PATCH] libtraceevent: Make sure unit test binary fails when tests fail Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240329135331.784707-1-paul.mars@canonical.com \
--to=paul.mars@canonical.com \
--cc=linux-trace-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).