-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Leak detection in instrumentation tests #633
Conversation
0af646d
to
ae7b225
Compare
defaultConfig { | ||
minSdkVersion rootProject.ext.minSdkVersion | ||
targetSdkVersion rootProject.ext.targetSdkVersion | ||
consumerProguardFiles 'consumer-proguard-rules.pro' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delete this line
@@ -0,0 +1,9 @@ | |||
-dontwarn com.squareup.haha.guava.** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this file. They're already in 'leakcanary-android' artifact.
} | ||
} | ||
|
||
public static class LeakResult { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
final
I love that this is happening! Can I give a nudge on this PR since I'd love to use it? |
No On Wed, Oct 26, 2016 at 9:16 PM Seth Goldenberg [email protected]
|
Having LeakCanary in instrumented tests is very useful (and the only logical use case in certain setups), and the review comments suggest there's not much left to be done. Nevertheless there's no progress in about a year. If you don't have time to get back to this anytime soon, would you mind if I re-send you this PR rebased to the latest |
Is this PR still alive? Was thinking about doing something similar myself, but this solution would be ideal if it comes in an official release... Our instrumentation tests are the most likely place to find memory leaks, but when LeakCanary finds leaks the tests pass as usual (and the app gets uninstalled at the end of connectedCheck). But it's painful to try to wait for dumps and analysis unless it's done the way it is in this PR, at the end of each suite. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is immensely useful and the code looks good.
StrictMode's VMPolicy leak detection is painful to turn on in tests globally as there is no mechanism for whitelisting existing leaks/Play Service shenanigans.
LeakCanary however has the exclusion list.
Hi, is this going to be merged soon? It would be very useful! |
ae7b225
to
d4aa22a
Compare
Just rebased on latest master. This branch has a lot of unrelated changes, I'll try to open smaller PRs first. |
* Added leakcanary-android-instrumentation module, which provides a RunListener to fail a test suite if there are memory leaks when the test suite finishes.
d4aa22a
to
6e90b8a
Compare
Finally managed to cleanup this PR and break appart smaller PRs so that this one focused only on UI tests. Related PRs: |
Added leakcanary-android-instrumentation module, which provides a RunListener to fail a test suite if there are memory leaks when the test suite finishes.