Skip to content

Improve Test Suite Assertion Failure Handling When Using Sanitizers - #68

Open
kilo52 wants to merge 1 commit into
masterfrom
improve/tests-lsan-assert-fails
Open

Improve Test Suite Assertion Failure Handling When Using Sanitizers#68
kilo52 wants to merge 1 commit into
masterfrom
improve/tests-lsan-assert-fails

Conversation

@kilo52

@kilo52 kilo52 commented Jul 21, 2026

Copy link
Copy Markdown
Member

Adds a standard Unity unity_config.h configuration header file that defines the UNITY_TEST_ABORT macro. The macro simply sets a global boolean flag and continues with the default Unity behaviour when a test assertion fails.

Adds the __lsan_is_turned_off() ASAN hook function to check the global flag and, if set, disable LSAN for the test run.

This is so that when executing the test suite with sanitizer support enabled, regular test assertion failures are reported over memory leaks detected by ASAN. This is because a failed test assertion might result in cleanup code, usually located at the end of a test function, to not be executed, effectively triggering a spurious memory leak error.

Added a standard Unity unity_config.h configuration header file that defines
the UNITY_TEST_ABORT macro. The macro simply sets a global boolean flag and
continues with the default Unity behaviour when a test assertion fails.

Added the __lsan_is_turned_off() ASAN hook function to check the global
flag and, if set, disable LSAN for the test run.
This is so that when executing the test suite with sanitizer support
enabled, regular test assertion failures are reported over memory leaks
detected by ASAN. This is because a failed test assertion might result
in cleanup code, usually located at the end of a test function, to not
be executed, effectively triggering a spurious memory leak error.

[CL]: Improved test suite assertion failure handling
when using sanitizers. [Issue#67]

Signed-off-by: Phil Gaiser <phil.gaiser@raven-computing.com>
@kilo52 kilo52 added Improvement Improvement of an existing feature Internal This affects something internal labels Jul 21, 2026
@kilo52 kilo52 self-assigned this Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Improvement Improvement of an existing feature Internal This affects something internal

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prioritise the Report of Test Assertion Failures Over Memory Leaks When Using ASAN

1 participant