From b7a2c2999aabf2a83ccc164b9729259ea400e747 Mon Sep 17 00:00:00 2001 From: Dan Bungert Date: Thu, 18 Feb 2021 17:35:58 -0700 Subject: [PATCH] Fail testrun on test failure Test failures can go unnoticed, as currently the test runner unconditionally returns exit code 0. Consult the number of test failures and exit code 1 if there are any. --- test/make-tests.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/make-tests.sh b/test/make-tests.sh index f2a3f2a..78e6901 100755 --- a/test/make-tests.sh +++ b/test/make-tests.sh @@ -26,10 +26,11 @@ cat $FILES | grep '^void Test' | echo \ ' -void RunAllTests(void) +int RunAllTests(void) { CuString *output = CuStringNew(); CuSuite* suite = CuSuiteNew(); + int ret = 0; ' cat $FILES | grep '^void Test' | @@ -42,15 +43,16 @@ echo \ ' CuSuiteRun(suite); CuSuiteSummary(suite, output); + if (suite->failCount > 0) ret = 1; CuSuiteDetails(suite, output); printf("%s\n", output->buffer); CuStringDelete(output); CuSuiteDelete(suite); + return ret; } int main(void) { - RunAllTests(); - return 0; + return RunAllTests(); } ' -- 2.37.1