From 8dd898fd01358079ff9eed5ef662e3f5e8aadffa Mon Sep 17 00:00:00 2001 From: Phil Glass Date: Wed, 31 Jan 2024 13:26:01 +0000 Subject: [PATCH] Remove Orchestrator's single method fast path --- .../orchestrator/AndroidTestOrchestrator.java | 35 +++++-------------- .../AndroidTestOrchestratorTest.java | 20 ----------- 2 files changed, 8 insertions(+), 47 deletions(-) diff --git a/runner/android_test_orchestrator/java/androidx/test/orchestrator/AndroidTestOrchestrator.java b/runner/android_test_orchestrator/java/androidx/test/orchestrator/AndroidTestOrchestrator.java index b09cf341f..62a92d3b1 100644 --- a/runner/android_test_orchestrator/java/androidx/test/orchestrator/AndroidTestOrchestrator.java +++ b/runner/android_test_orchestrator/java/androidx/test/orchestrator/AndroidTestOrchestrator.java @@ -130,9 +130,6 @@ public final class AndroidTestOrchestrator extends android.app.Instrumentation private static final String TEST_COLLECTION_FILENAME = "testCollection.txt"; private static final int MAX_FILENAME_LENGTH = 255; - private static final Pattern FULLY_QUALIFIED_CLASS_AND_METHOD = - Pattern.compile("[\\w\\.?]+#\\w+"); - private static final List RUNTIME_PERMISSIONS = Arrays.asList(permission.WRITE_EXTERNAL_STORAGE, permission.READ_EXTERNAL_STORAGE); @@ -253,23 +250,14 @@ public void onServiceDisconnected(ComponentName className) { }; private void collectTests() { - String classArg = arguments.getString(AJUR_CLASS_ARGUMENT); - // If we are given a single, fully qualified test then there's no point in test collection. - // Proceed as if we had done collection and gotten the single argument. - if (isSingleMethodTest(classArg)) { - Log.i(TAG, String.format("Single test parameter %s, skipping test collection", classArg)); - callbackLogic.addTest(classArg); - runFinished(); - } else { - Log.i(TAG, String.format("Multiple test parameter %s, starting test collection", classArg)); - executorService.execute( - TestRunnable.testCollectionRunnable( - getContext(), - getSecret(arguments), - arguments, - getOutputStream(), - AndroidTestOrchestrator.this)); - } + Log.i(TAG, "Starting test collection"); + executorService.execute( + TestRunnable.testCollectionRunnable( + getContext(), + getSecret(arguments), + arguments, + getOutputStream(), + AndroidTestOrchestrator.this)); } @VisibleForTesting @@ -293,13 +281,6 @@ static String makeValidFilename(String testName, int maxFilenameLength) { return testName + testRunFilenameSuffix; } - @VisibleForTesting - static boolean isSingleMethodTest(String classArg) { - if (TextUtils.isEmpty(classArg)) { - return false; - } - return FULLY_QUALIFIED_CLASS_AND_METHOD.matcher(classArg).matches(); - } /** Invoked every time the TestRunnable finishes, including after test collection. */ @Override diff --git a/runner/android_test_orchestrator/javatests/androidx/test/orchestrator/AndroidTestOrchestratorTest.java b/runner/android_test_orchestrator/javatests/androidx/test/orchestrator/AndroidTestOrchestratorTest.java index 892d0fc9e..d5c19d205 100644 --- a/runner/android_test_orchestrator/javatests/androidx/test/orchestrator/AndroidTestOrchestratorTest.java +++ b/runner/android_test_orchestrator/javatests/androidx/test/orchestrator/AndroidTestOrchestratorTest.java @@ -27,26 +27,6 @@ /** Unit tests for {@link AndroidTestOrchestrator}. */ @RunWith(AndroidJUnit4.class) public class AndroidTestOrchestratorTest { - - @Test - public void testSingleMethodTest() { - assertThat(AndroidTestOrchestrator.isSingleMethodTest("org.example.class#method"), is(true)); - assertThat(AndroidTestOrchestrator.isSingleMethodTest("org.example.class"), is(false)); - assertThat( - AndroidTestOrchestrator.isSingleMethodTest("org.example.class,org.example.another#method"), - is(false)); - assertThat( - AndroidTestOrchestrator.isSingleMethodTest( - "org.example.class#method,org.example.class#anotherMethod"), - is(false)); - } - - @Test - public void testSingleMethodTest_blankInput() { - assertThat(AndroidTestOrchestrator.isSingleMethodTest(null), is(false)); - assertThat(AndroidTestOrchestrator.isSingleMethodTest(""), is(false)); - } - @Test public void testMakeValidFilename_notTooLong() { final int maxLength = 20;