From 97019f00c12f0682abcd92edfb000065519f8558 Mon Sep 17 00:00:00 2001 From: Martins Mozeiko Date: Thu, 3 Aug 2023 10:28:16 -0400 Subject: [PATCH] make sanity tests return error code on failure --- tests/sanity_tests.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/sanity_tests.c b/tests/sanity_tests.c index bda41f9..7f18bbd 100644 --- a/tests/sanity_tests.c +++ b/tests/sanity_tests.c @@ -9,6 +9,7 @@ static struct { int number_of_tests; int number_passed; + int return_result; } test_ctx; @@ -29,6 +30,10 @@ BeginTest(char *name) static void TestResult(MD_b32 result) { + if (!result) + { + test_ctx.return_result = 1; + } test_ctx.number_of_tests += 1; test_ctx.number_passed += !!result; printf(result ? "." : "X"); @@ -877,5 +882,5 @@ int main(void) } } - return 0; + return test_ctx.return_result; }