summaryrefslogtreecommitdiff
path: root/android_icu4j
diff options
context:
space:
mode:
authorPaul Duffin <paulduffin@google.com>2016-09-05 13:26:19 +0100
committerPaul Duffin <paulduffin@google.com>2016-09-05 13:26:19 +0100
commit4025f1139b94bd50d455a00669c3197ff2525ae2 (patch)
tree058f60a9991b2f1bf19c59cc43ca99dfda17e602 /android_icu4j
parent683055d9b50491dedbadea4e8ffb484e99e4f52b (diff)
downloadicu-4025f1139b94bd50d455a00669c3197ff2525ae2.tar.gz
Remove support for skipping execution
CTSv2 generates a list of tests that will be run by running the tests in a special skip execution mode. Previously, that required specific support within the Runners that ran the tests. Following on from previous change in this bug that is no longer necessary as it generates the list from the Description returned by the Runners. Removes all references to AndroidRunnerParams and so the dummy version provided to allow the tests to be run on the host is no longer necessary. Also removes the unused IcuTestRunnerBuilder. Bug: 30801147 Test: Ran CtsIcuTestCases and ran the tests directly on the host Change-Id: Ieecd817f40179c0baa9fb0b98f760d0019478a32
Diffstat (limited to 'android_icu4j')
-rw-r--r--android_icu4j/Android.mk3
-rw-r--r--android_icu4j/runner/src/host/java/android/support/test/internal/util/AndroidRunnerParams.java26
-rw-r--r--android_icu4j/runner/src/main/java/android/icu/junit/IcuTestFmwkRunner.java47
-rw-r--r--android_icu4j/runner/src/main/java/android/icu/junit/IcuTestRunnerBuilder.java54
4 files changed, 13 insertions, 117 deletions
diff --git a/android_icu4j/Android.mk b/android_icu4j/Android.mk
index c3860f9c6..1ed6cf740 100644
--- a/android_icu4j/Android.mk
+++ b/android_icu4j/Android.mk
@@ -80,9 +80,8 @@ include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := tests
LOCAL_SRC_FILES := \
$(call all-java-files-under,src/main/tests) \
- $(call all-java-files-under,runner/src/main/java) \
$(call all-java-files-under,cts-coverage/src/main/tests) \
- $(call all-java-files-under,runner/src/host/java)
+ $(call all-java-files-under,runner/src/main/java)
LOCAL_JAVA_RESOURCE_DIRS := src/main/tests
LOCAL_STATIC_JAVA_LIBRARIES := \
android-icu4j-host \
diff --git a/android_icu4j/runner/src/host/java/android/support/test/internal/util/AndroidRunnerParams.java b/android_icu4j/runner/src/host/java/android/support/test/internal/util/AndroidRunnerParams.java
deleted file mode 100644
index e6d450129..000000000
--- a/android_icu4j/runner/src/host/java/android/support/test/internal/util/AndroidRunnerParams.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package android.support.test.internal.util;
-
-/**
- * A dummy class used to support running ICU JUnit tests on host.
- */
-public class AndroidRunnerParams {
-
- public boolean isSkipExecution() {
- return false;
- }
-}
diff --git a/android_icu4j/runner/src/main/java/android/icu/junit/IcuTestFmwkRunner.java b/android_icu4j/runner/src/main/java/android/icu/junit/IcuTestFmwkRunner.java
index 965ff1d97..fb9f0ea1f 100644
--- a/android_icu4j/runner/src/main/java/android/icu/junit/IcuTestFmwkRunner.java
+++ b/android_icu4j/runner/src/main/java/android/icu/junit/IcuTestFmwkRunner.java
@@ -17,7 +17,6 @@
package android.icu.junit;
import android.icu.dev.test.TestFmwk;
-import android.support.test.internal.util.AndroidRunnerParams;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -31,28 +30,9 @@ import org.junit.runners.model.Statement;
*/
public class IcuTestFmwkRunner extends IcuTestParentRunner<IcuFrameworkTest> {
- /**
- * A {@link Statement} that does nothing, used when skipping execution.
- */
- private static final Statement EMPTY_STATEMENT = new Statement() {
- @Override
- public void evaluate() throws Throwable {
- }
- };
-
- private final boolean skipExecution;
-
private final List<IcuFrameworkTest> tests;
/**
- * The constructor used when this class is used with {@code @RunWith(...)}.
- */
- public IcuTestFmwkRunner(Class<?> testClass)
- throws Exception {
- this(checkClass(testClass), null);
- }
-
- /**
* Make sure that the supplied test class is supported by this.
*/
private static Class<? extends TestFmwk> checkClass(Class<?> testClass) {
@@ -72,12 +52,14 @@ public class IcuTestFmwkRunner extends IcuTestParentRunner<IcuFrameworkTest> {
return testClass.asSubclass(TestFmwk.class);
}
- public IcuTestFmwkRunner(Class<? extends TestFmwk> testFmwkClass,
- AndroidRunnerParams runnerParams)
+ /**
+ * The constructor used when this class is used with {@code @RunWith(...)}.
+ */
+ public IcuTestFmwkRunner(Class<?> testClass)
throws Exception {
- super(testFmwkClass);
+ super(testClass);
- this.skipExecution = runnerParams != null && runnerParams.isSkipExecution();
+ Class<? extends TestFmwk> testFmwkClass = checkClass(testClass);
// Create a TestFmwk and make sure that it's initialized properly.
TestFmwk testFmwk = TestFmwkUtils.newTestFmwkInstance(testFmwkClass);
@@ -116,17 +98,12 @@ public class IcuTestFmwkRunner extends IcuTestParentRunner<IcuFrameworkTest> {
@Override
protected void runChild(final IcuFrameworkTest child, RunNotifier notifier) {
Description description = describeChild(child);
- Statement statement;
- if (skipExecution) {
- statement = EMPTY_STATEMENT;
- } else {
- statement = new Statement() {
- @Override
- public void evaluate() throws Throwable {
- child.run();
- }
- };
- }
+ Statement statement = new Statement() {
+ @Override
+ public void evaluate() throws Throwable {
+ child.run();
+ }
+ };
runLeaf(statement, description, notifier);
}
}
diff --git a/android_icu4j/runner/src/main/java/android/icu/junit/IcuTestRunnerBuilder.java b/android_icu4j/runner/src/main/java/android/icu/junit/IcuTestRunnerBuilder.java
deleted file mode 100644
index 82c304477..000000000
--- a/android_icu4j/runner/src/main/java/android/icu/junit/IcuTestRunnerBuilder.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.icu.junit;
-
-import android.icu.dev.test.TestFmwk;
-import android.support.test.internal.util.AndroidRunnerParams;
-import org.junit.internal.builders.AnnotatedBuilder;
-import org.junit.runner.Runner;
-import org.junit.runners.model.RunnerBuilder;
-
-/**
- * A {@link RunnerBuilder} used for running ICU test classes derived from {@link TestFmwk}.
- */
-public class IcuTestRunnerBuilder extends RunnerBuilder {
-
- private final AndroidRunnerParams runnerParams;
-
- private final AnnotatedBuilder annotatedBuilder;
-
- public IcuTestRunnerBuilder(AndroidRunnerParams runnerParams) {
- this.runnerParams = runnerParams;
- annotatedBuilder = new AnnotatedBuilder(this);
- }
-
- @Override
- public Runner runnerForClass(Class<?> testClass) throws Throwable {
- // Check for a TestGroup before a TestFmwk class as TestGroup is a subclass of TestFmwk
- if (TestFmwk.TestGroup.class.isAssignableFrom(testClass)) {
- return new IcuTestGroupRunner(testClass.asSubclass(TestFmwk.TestGroup.class), this);
- }
-
- if (TestFmwk.class.isAssignableFrom(testClass)) {
- // Make sure that in the event of an error the resulting Runner an be filtered out.
- return new IcuTestFmwkRunner(testClass.asSubclass(TestFmwk.class), runnerParams);
- }
-
- // Fallback to using the annotation builder to support the extra icu cts tests.
- return annotatedBuilder.safeRunnerForClass(testClass);
- }
-}