Skip to content

Commit

Permalink
UTs: fatal error should not call assert to be able to display the rep…
Browse files Browse the repository at this point in the history
…ort - CC @aureliendavid
  • Loading branch information
rbouqueau committed Apr 2, 2024
1 parent b792bf2 commit ddc0882
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion include/tests.h
Expand Up @@ -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)

Expand Down
5 changes: 5 additions & 0 deletions unittests/tests.c
Expand Up @@ -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++;
Expand Down

0 comments on commit ddc0882

Please sign in to comment.