From ddc0882687302f2857f883c49675a9bfa312edb8 Mon Sep 17 00:00:00 2001 From: Romain Bouqueau Date: Tue, 2 Apr 2024 12:30:40 -0400 Subject: [PATCH] UTs: fatal error should not call assert to be able to display the report - CC @aureliendavid --- include/tests.h | 2 +- unittests/tests.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/tests.h b/include/tests.h index feca1bec24..7951a2c96f 100644 --- a/include/tests.h +++ b/include/tests.h @@ -17,7 +17,7 @@ static Bool fatal_ut = GF_TRUE; checks_passed++; \ } else { \ checks_failed++; \ - if (fatal_ut) gf_assert(0); \ + if (fatal_ut) checks_failed|=0x8000000; \ } \ } while (0) diff --git a/unittests/tests.c b/unittests/tests.c index a110a8b2f2..c232e48d62 100644 --- a/unittests/tests.c +++ b/unittests/tests.c @@ -70,6 +70,11 @@ int run_tests(int argc, char *argv[]) printf("Failed\n"); ret = EXIT_FAILURE; tests_failed++; + if (checks_failed & 0x8000000) { + checks_failed &= ~0x8000000; + printf("Failure is fatal. Aborting test execution.\n"); + break; + } } else { printf("Success\n"); tests_passed++;