Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable EXPECT_N_LEAKS() if memleak detection disabled #1009

Merged
merged 1 commit into from Apr 21, 2020

Conversation

bkylerussell
Copy link
Contributor

EXPECT_N_LEAKS() can't be supported when CppUTest is configured with --disable-memory-leak-detection, since there's nothing to make sure we hit the expected number of leaks.

In one sense, it would be nice for tests that use EXPECT_N_LEAKS() to go ahead and continue running with whatever capabilities CppUTest is configured with. This change would allow that behavior.

But on the other hand, I guess someone that really expected leaks might want to see the failure to know that CppUTest wasn't configured like they expected.

Is the intended behavior for tests using EXPECT_N_LEAKS() to fail when CppUTest is configured with --disable-memory-leak-detection, or was this just a miss? Thoughts?

@coveralls
Copy link

coveralls commented Jun 28, 2016

Coverage Status

Coverage increased (+0.0001%) to 99.878% when pulling 768e048 on bkylerussell:memleak into 8f9a013 on cpputest:master.

@basvodde
Copy link
Member

The failure is not intended, but it would sort-of make sense to fail, or at least print a warning.

However, the fix isn't ok. You'd need to work on the check, and if possible, do it runtime and not compile time. Also there is no test provided. So, as is, I won't accept this pull request.

@bkylerussell
Copy link
Contributor Author

Ok, thanks. I really just wanted to get feedback on whether or not a failure was intended. I can fix this up if you think printing a warning would be acceptable while allowing other tests to continue running.

Print a warning message during tests that expect leaks when
CppUTest has been configured with --disable-memory-leak-detection.

This permits the rest of a test's value to remain in effect if
the desired configuration is really to disable memory leak detection.
@bkylerussell
Copy link
Contributor Author

I think I've fixed this up per the previous discussion so that a warning is printed and the change is accompanied by a test. Checks seem to be happy now.

@basvodde basvodde merged commit 6628297 into cpputest:master Apr 21, 2020
@bkylerussell bkylerussell deleted the memleak branch April 22, 2020 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants