Repository navigation
Pre-filter candidate test classes via DEX bytecode tables. - #2510
Open
copybara-service[bot] wants to merge 1 commit into
Open
copybara-service[bot] wants to merge 1 commit into
copybara-service[bot] wants to merge 1 commit into
Conversation
On-device test discovery loads every non-excluded top-level class in the APK via `Class.forName()` before JUnit inspects annotations or superclasses, causing high startup latency and `ClassLoader` heap exhaustion on large APKs. `DexBytecodeScanner` reads each `classes*.dex` entry in turn (memory-mapped if stored uncompressed, otherwise via `ZipFile`) and checks its string/type tables and `class_def_item` inheritance chains for JUnit3 (`TestCase`, `suite()`) and JUnit4 (`@Test`, `@RunWith`, `@Ignore`) signals before class loading. Marker descriptors are derived from class literals so they match ProGuard/R8-obfuscated APKs. Falls back to `DexFile` scanning if the APK has no JUnit4 marker types or no candidates are found. The scanner is disabled by default. `AndroidClasspathSuite` enables it when the `useDexBytecodeScanner` instrumentation argument is `true` (`-e useDexBytecodeScanner true`). PiperOrigin-RevId: 994609846
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pre-filter candidate test classes via DEX bytecode tables.
On-device test discovery loads every non-excluded top-level class in the APK via
Class.forName()before JUnit inspects annotations or superclasses, causing high startup latency andClassLoaderheap exhaustion on large APKs.DexBytecodeScannerreads eachclasses*.dexentry in turn (memory-mapped if stored uncompressed, otherwise viaZipFile) and checks its string/type tables andclass_def_iteminheritance chains for JUnit3 (TestCase,suite()) and JUnit4 (@Test,@RunWith,@Ignore) signals before class loading. Marker descriptors are derived from class literals so they match ProGuard/R8-obfuscated APKs. Falls back toDexFilescanning if the APK has no JUnit4 marker types or no candidates are found.The scanner is disabled by default.
AndroidClasspathSuiteenables it when theuseDexBytecodeScannerinstrumentation argument istrue(-e useDexBytecodeScanner true).