How to suppress problems detected by Valgrind with EXPECT_DEBUG_DEATH Google test macro? #4331
Unanswered
fajlip
asked this question in
Community Help
Replies: 1 comment
-
To avoid these valgrind warnings, I pass |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I’ve run to the problem with Google unit testing framework and valgrind interaction. When I use EXPECT_DEBUG_DEATH macro and memcheck tests code with valgrind I get massive log output.
valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ./tests
Output starts with:
And a lot of stuff like this for every record (there is 690 of them):
59 bytes in 1 blocks are still reachable in loss record 1 of 690
Valgrind does not summarize result as the one with warnings or errors, but as I said it generates tons of output messages.
I found that google test uses clone to spawn child process and if test crashes (in this case on purpose), valgrind thinks that test was not exited correctly. There is a flag
GTEST_DEATH_TEST_USE_FORK
that should fix this. [Link 1]Solutions that did not work for me:
Tried to run cmake with
-DGTEST_DEATH_TEST_USE_FORK=1
, did not have any effect on valgrind output.I’ve also used
GTEST_FLAG_SET(death_test_use_fork, true)
, which gives error: ‘FLAGS_gtest_death_test_use_fork’ is not a member of ‘testing’; yet when I useGTEST_FLAG_SET(death_test_style, "threadsafe")
it compiles – this flag is in the same file and just above death_test_use_fork [Link 1 line 86].. did it just to test that it can be done and compiled.Valgrind version: 3.21.0
Google test version: release 1.12.1
What else could I please do to make valgrind in peace with EXPECT_DEBUG_DEATH?
Link 1: death_test_use_fork
Beta Was this translation helpful? Give feedback.
All reactions