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

Leak detection in instrumentation tests #633

Merged
merged 1 commit into from
Jun 16, 2018

Conversation

pyricau
Copy link
Member

@pyricau pyricau commented Oct 5, 2016

Added leakcanary-android-instrumentation module, which provides a RunListener to fail a test suite if there are memory leaks when the test suite finishes.

@pyricau pyricau added this to the 1.6 milestone Oct 5, 2016
@pyricau pyricau force-pushed the py/crash_burn_instrumentation branch from 0af646d to ae7b225 Compare October 6, 2016 16:55
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
consumerProguardFiles 'consumer-proguard-rules.pro'
Copy link
Collaborator

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.**
Copy link
Collaborator

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 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

final

@goldierox
Copy link

I love that this is happening! Can I give a nudge on this PR since I'd love to use it?

@JakeWharton
Copy link
Collaborator

No

On Wed, Oct 26, 2016 at 9:16 PM Seth Goldenberg [email protected]
wrote:

I love that this is happening! Can I give a nudge on this PR since I'd
love to use it?


You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
#633 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAEEEQh1ZVNtso2XRvcE7V8-isDMoZ5lks5q37U1gaJpZM4KPTX6
.

@jrodbx jrodbx removed this from the 1.6 milestone Jun 30, 2017
@dotdoom
Copy link

dotdoom commented Sep 10, 2017

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 master?

@doc-rj
Copy link

doc-rj commented Sep 20, 2017

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.

Copy link

@kurtisnelson kurtisnelson left a 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.

@Sinapse87
Copy link

Hi, is this going to be merged soon? It would be very useful!

@pyricau
Copy link
Member Author

pyricau commented Apr 23, 2018

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.
@pyricau pyricau force-pushed the py/crash_burn_instrumentation branch from d4aa22a to 6e90b8a Compare June 16, 2018 15:31
@pyricau
Copy link
Member Author

pyricau commented Jun 16, 2018

Finally managed to cleanup this PR and break appart smaller PRs so that this one focused only on UI tests.

Related PRs:

@pyricau pyricau merged commit 0e6f638 into master Jun 16, 2018
@pyricau pyricau added this to the 1.6 milestone Jun 18, 2018
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.

8 participants