-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve resource leakage detection testing
This change makes various improvements to the support for testing resource leakage detection. Adds CloseGuard.Tracker to allow tests to track the lifecycle of CloseGuard allocation sites directly. Adds CloseGuardSupport to use CloseGuard.Tracker to provide: * A BiConsumer that can be used to help check that objects which own resources protected by CloseGuard correctly detect resource leakage. * A TestRule that allows tests to check that system code does not leak resources, especially under error conditions. Adds a new ResourceLeakageDetector that uses reflection to access CloseGuardSupport. This can safely be used in code that needs to compile and run on OpenJDK. Adds TestCaseWithRules to allow the TestRule above to be used with JUnit 3 style tests without converting the whole test to JUnit 4 style. Changed libcore.java.lang.ProcessBuilderTest to use TestCase as ProcessBuilder does not have any CloseGuard protected resources. That allows AbstractResourceLeakageDetectorTestCase to be deleted. Changed RandomAccessFileTest to use TestCaseWithRules and ResourceLeakageDetector. Fixed issues that it highlighted, fixed testRandomAccessFileHasCleanupFinalizer test and removed it from expectations/knownfailures.txt. Adds core-test-rules/-hostdex targets to encapsulate TestRule and related classes that can be shared with other projects. Removes the following now unused classes: * CloseGuardMonitor * AbstractResourceLeakageDetectorTest * The old ResourceLeakageDetector and associated test. Bug: 31542223 Test: Ran tests on both Vogar and CTS Change-Id: I8f802b52fdbeac0a30f339a9ceca5d2eaaafd180
- Loading branch information
1 parent
24e3caf
commit fe0ee8e
Showing
12 changed files
with
1,004 additions
and
342 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
119 changes: 0 additions & 119 deletions
119
dalvik/src/test/java/dalvik/system/CloseGuardMonitor.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.