Commit aca1fccf authored by Andrew Grieve's avatar Andrew Grieve Committed by Commit Bot

Android: Speed up kitkat test listing for instrumentation tests

When enumerating classes, filter out those that do not have
"Test" suffix.

Spot checked 2 random shards of android-kitkat-arm-rel with and
without this change. Both before shards took 41 seconds to list
tests. Both after shards took 23 seconds.

Change-Id: I35b5521095a9ccea857b8fed6d9d009a7d9c7c7f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1946432
Auto-Submit: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: default avatarEric Stevenson <estevenson@chromium.org>
Commit-Queue: Eric Stevenson <estevenson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#720659}
parent 1dbbf373
...@@ -346,6 +346,15 @@ public class BaseChromiumAndroidJUnitRunner extends AndroidJUnitRunner { ...@@ -346,6 +346,15 @@ public class BaseChromiumAndroidJUnitRunner extends AndroidJUnitRunner {
if (startsWithAny(className, mExcludedPrefixes)) { if (startsWithAny(className, mExcludedPrefixes)) {
continue; continue;
} }
if (!className.endsWith("Test")) {
// Speeds up test listing to filter by name before
// trying to load the class. We have an ErrorProne
// check that enforces this convention:
// //tools/android/errorprone_plugin/src/org/chromium/tools/errorprone/plugin/TestClassNameCheck.java
// As of Dec 2019, this speeds up test listing on
// android-kitkat-arm-rel from 41s -> 23s.
continue;
}
if (!className.contains("$") && loader.loadIfTest(className) != null) { if (!className.contains("$") && loader.loadIfTest(className) != null) {
addTestClass(className); addTestClass(className);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment