Closed awsdert closed 4 years ago
Are you using fork mode to run the tests?
https://libcheck.github.io/check/doc/check_html/check_4.html#No-Fork-Mode
Depending on the platform by default Check forks a process to run each unit test. This prevents one unit test for affecting another unit test's memory.
The forking can be disabled. Alternatively, there is a way to run a setup function before the fork would happen:
https://libcheck.github.io/check/doc/check_html/check_4.html#Test-Fixtures
Thank you, srunner_set_fork_status(sr,CK_NOFORK);
fixed it
To optimize my tests I've been using globals that point to allocated memory, the test that allocates that memory passes just fine but on the following test the memory allocated appears to no longer exist as the global that should be pointing to it has been reset to 0 at that point, I even went as far as putting the
#include <check.h>
part after the declaration of those globals, I even tried putting the object inside main() like this:but it still got reset, why is check interfering with globals it should know nothing about?