diff mbox series

libtraceevent: Make sure unit test binary fails when tests fail

Message ID 20240329135331.784707-1-paul.mars@canonical.com (mailing list archive)
State Superseded
Headers show
Series libtraceevent: Make sure unit test binary fails when tests fail | expand

Commit Message

Paul Mars March 29, 2024, 1:53 p.m. UTC
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(+)

Comments

Steven Rostedt April 12, 2024, 12:35 a.m. UTC | #1
On Fri, 29 Mar 2024 14:53:32 +0100
Paul Mars <paul.mars@canonical.com> wrote:

> 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.

Can you resend with your Signed-off-by?

Thanks,

-- Steve

> ---
>  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;
>  }
diff mbox series

Patch

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;
 }