-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
I'd like to use Unity in combination with Address Sanitizer, the problem is that by default ASAN halts the program as soon that it detects a memory error, so failed assertions in tests like:
- allocate some memory
- some Unity assertions that might fail
- free allocated memory
are never reported as failed assertions because ASAN kicks in and halts the program reporting a memory leak. This is misleading because the cause of the failed assertion is lost.
I know I can instruct ASAN to continue after the error, instead of halting (see FAQs; but it's marked as experimental.
I was wondering whether there is a "correct" way to use ASAN with unity, or it's just a bad idea to combine their use. The ideal would be to be able to specify some cleanup code associated with the (group of) assertions, but I cannot find out how this can be done in Unity at the assertion level.
I'm using Unity and ASAN together to check programming assignments, so it makes sense to check also for memory errors in the unit test, and I'd rather prefer avoiding the duplication of the tests.
Thanks for any suggestion