Merge "Remove RequiredFeatures Annotation" into gingerbread
diff --git a/CtsHostLibraryList.mk b/CtsHostLibraryList.mk
index 36291d5..ac9a700 100644
--- a/CtsHostLibraryList.mk
+++ b/CtsHostLibraryList.mk
@@ -12,5 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-CTS_HOST_LIBRARY_JARS := \
- $(HOST_OUT_JAVA_LIBRARIES)/CtsTestAnnotationsHostLib.jar
+CTS_HOST_LIBRARY_JARS :=
diff --git a/development/ide/eclipse/.classpath b/development/ide/eclipse/.classpath
index 40ec20e..ac56b05 100644
--- a/development/ide/eclipse/.classpath
+++ b/development/ide/eclipse/.classpath
@@ -2,7 +2,6 @@
<classpath>
<classpathentry kind="src" path="cts/apps/CtsVerifier/src"/>
<classpathentry kind="src" path="cts/apps/CtsVerifier/tests/src"/>
- <classpathentry kind="src" path="cts/libs/annotation/src"/>
<classpathentry kind="src" path="cts/libs/vogar-expect/src"/>
<classpathentry kind="src" path="cts/tests/ApiDemosReferenceTest/src"/>
<classpathentry kind="src" path="cts/tests/ProcessTest/src"/>
diff --git a/libs/annotation/Android.mk b/libs/annotation/Android.mk
deleted file mode 100644
index 3a4dd82..0000000
--- a/libs/annotation/Android.mk
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# Copyright (C) 2010 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.
-#
-
-# Build static Java library for APKs like the CTS tests.
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_MODULE := CtsTestAnnotationsLib
-LOCAL_MODULE_TAGS := optional
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
-# Build the annotations for the host to use.
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_MODULE := CtsTestAnnotationsHostLib
-LOCAL_MODULE_TAGS := optional
-include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/libs/annotation/src/android/annotation/cts/RequiredFeatures.java b/libs/annotation/src/android/annotation/cts/RequiredFeatures.java
deleted file mode 100644
index 8675b34..0000000
--- a/libs/annotation/src/android/annotation/cts/RequiredFeatures.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2010 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.annotation.cts;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation for specifying what features are needed to run a test. The device must have all the
- * features specified by the annotation in order to be executed.
- * <p>
- * Examples:
- * <pre>
- * @RequiredFeatures(PackageManager.FEATURE_WIFI)
- * @RequiredFeatures({PackageManager.FEATURE_TELEPHONY, PackageManager.FEATURE_TELEPHONY_CDMA})
- * </pre>
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.TYPE, ElementType.METHOD})
-public @interface RequiredFeatures {
- String[] value();
-}
diff --git a/tests/Android.mk b/tests/Android.mk
index bdd8b8a..838d01d 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -23,7 +23,6 @@
src/android/os/cts/IEmptyService.aidl
LOCAL_JAVA_LIBRARIES := android.test.runner
-LOCAL_STATIC_JAVA_LIBRARIES := CtsTestAnnotationsLib
LOCAL_JNI_SHARED_LIBRARIES := libcts_jni
diff --git a/tests/core/ctscore.mk b/tests/core/ctscore.mk
index 33fc6f3..337b3f5 100644
--- a/tests/core/ctscore.mk
+++ b/tests/core/ctscore.mk
@@ -18,7 +18,6 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_JAVA_LIBRARIES := android.test.runner bouncycastle
-LOCAL_STATIC_JAVA_LIBRARIES := CtsTestAnnotationsLib
LOCAL_PROGUARD_ENABLED := disabled
diff --git a/tests/core/runner/src/android/test/InstrumentationCtsTestRunner.java b/tests/core/runner/src/android/test/InstrumentationCtsTestRunner.java
index 21eb2a6..5aa2c3b 100644
--- a/tests/core/runner/src/android/test/InstrumentationCtsTestRunner.java
+++ b/tests/core/runner/src/android/test/InstrumentationCtsTestRunner.java
@@ -22,11 +22,8 @@
import dalvik.annotation.BrokenTest;
import dalvik.annotation.SideEffect;
-import android.annotation.cts.RequiredFeatures;
-import android.app.Instrumentation;
import android.app.KeyguardManager;
import android.content.Context;
-import android.content.pm.FeatureInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.test.suitebuilder.TestMethod;
@@ -36,10 +33,7 @@
import java.io.File;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
-import java.util.Collections;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
import java.util.TimeZone;
import junit.framework.AssertionFailedError;
@@ -67,8 +61,6 @@
private static final String REPORT_VALUE_ID = "InstrumentationCtsTestRunner";
- private static final int REPORT_VALUE_RESULT_OMITTED = -3;
-
/**
* True if (and only if) we are running in single-test mode (as opposed to
* batch mode).
@@ -235,8 +227,6 @@
Predicates.not(new HasAnnotation(BrokenTest.class));
builderRequirements.add(brokenTestPredicate);
- builderRequirements.add(getFeaturePredicate());
-
if (!mSingleTest) {
Predicate<TestMethod> sideEffectPredicate =
Predicates.not(new HasAnnotation(SideEffect.class));
@@ -244,64 +234,4 @@
}
return builderRequirements;
}
-
- /**
- * Send back an indication that a test was omitted. InstrumentationTestRunner won't run omitted
- * tests, but CTS needs to know that the test was omitted. Otherwise, it will attempt to rerun
- * the test thinking that ADB must have crashed or something.
- */
- private void sendOmittedStatus(TestMethod t) {
- Bundle bundle = new Bundle();
- bundle.putString(Instrumentation.REPORT_KEY_IDENTIFIER, REPORT_VALUE_ID);
- bundle.putInt(InstrumentationTestRunner.REPORT_KEY_NUM_TOTAL, 1);
- bundle.putInt(InstrumentationTestRunner.REPORT_KEY_NUM_CURRENT, 1);
- bundle.putString(InstrumentationTestRunner.REPORT_KEY_NAME_CLASS,
- t.getEnclosingClassname());
- bundle.putString(InstrumentationTestRunner.REPORT_KEY_NAME_TEST,
- t.getName());
-
- // First status message causes CTS to print out the test name like "Class#test..."
- sendStatus(InstrumentationTestRunner.REPORT_VALUE_RESULT_START, bundle);
-
- // Second status message causes CTS to complete the line like "Class#test...(omitted)"
- sendStatus(REPORT_VALUE_RESULT_OMITTED, bundle);
- }
-
-
- private Predicate<TestMethod> getFeaturePredicate() {
- return new Predicate<TestMethod>() {
- public boolean apply(TestMethod t) {
- if (isValidTest(t)) {
- // InstrumentationTestRunner will run the test and send back results.
- return true;
- } else {
- // InstrumentationTestRunner WON'T run the test, so send back omitted status.
- sendOmittedStatus(t);
- return false;
- }
- }
-
- private boolean isValidTest(TestMethod t) {
- Set<String> features = new HashSet<String>();
- add(features, t.getAnnotation(RequiredFeatures.class));
- add(features, t.getEnclosingClass().getAnnotation(RequiredFeatures.class));
-
- // Run the test only if the device supports all the features.
- PackageManager packageManager = getContext().getPackageManager();
- FeatureInfo[] featureInfos = packageManager.getSystemAvailableFeatures();
- if (featureInfos != null) {
- for (FeatureInfo featureInfo : featureInfos) {
- features.remove(featureInfo.name);
- }
- }
- return features.isEmpty();
- }
-
- private void add(Set<String> features, RequiredFeatures annotation) {
- if (annotation != null) {
- Collections.addAll(features, annotation.value());
- }
- }
- };
- }
}
diff --git a/tests/tests/app/Android.mk b/tests/tests/app/Android.mk
index 46cd43b..a9b75df 100644
--- a/tests/tests/app/Android.mk
+++ b/tests/tests/app/Android.mk
@@ -22,7 +22,6 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_JAVA_LIBRARIES := android.test.runner
-LOCAL_STATIC_JAVA_LIBRARIES := CtsTestAnnotationsLib
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tools/host/etc/cts b/tools/host/etc/cts
index bb1fa2a..ec8ff0b 100755
--- a/tools/host/etc/cts
+++ b/tools/host/etc/cts
@@ -20,7 +20,6 @@
DDMS_LIB=ddmlib-prebuilt.jar
JUNIT_LIB=junit.jar
HOSTTEST_LIB=hosttestlib.jar
-CTS_TEST_ANNOTATIONS_HOST_LIB=CtsTestAnnotationsHostLib.jar
# Checking if "adb" is known by the system
PATH=.:${PATH}
@@ -64,7 +63,6 @@
${ANDROID_ROOT}/${JAR_DIR}/${DDMS_LIB}:\
${ANDROID_ROOT}/${JAR_DIR}/${JUNIT_LIB}:\
${ANDROID_ROOT}/${JAR_DIR}/${HOSTTEST_LIB}:\
-${ANDROID_ROOT}/${JAR_DIR}/${CTS_TEST_ANNOTATIONS_HOST_LIB}:\
${ANDROID_ROOT}/${JAR_DIR}/${CTS_LIB}
# Add path to CTS JAR file in the CTS archive
CTS_LIBS=${CTS_LIBS}:${CTS_DIR}/${CTS_LIB}
diff --git a/tools/host/src/Android.mk b/tools/host/src/Android.mk
index 5ad3998..47a9cb8 100644
--- a/tools/host/src/Android.mk
+++ b/tools/host/src/Android.mk
@@ -21,7 +21,7 @@
LOCAL_JAR_MANIFEST := ../etc/manifest.txt
LOCAL_JAVA_LIBRARIES := \
- ddmlib-prebuilt junit hosttestlib CtsTestAnnotationsHostLib
+ ddmlib-prebuilt junit hosttestlib
LOCAL_MODULE := cts
diff --git a/tools/host/src/com/android/cts/ConsoleUi.java b/tools/host/src/com/android/cts/ConsoleUi.java
index c9b0e1d..ce26d52 100644
--- a/tools/host/src/com/android/cts/ConsoleUi.java
+++ b/tools/host/src/com/android/cts/ConsoleUi.java
@@ -80,7 +80,6 @@
mResultCodeMap.put(CtsTestResult.STR_ERROR, CtsTestResult.CODE_ERROR);
mResultCodeMap.put(CtsTestResult.STR_NOT_EXECUTED, CtsTestResult.CODE_NOT_EXECUTED);
mResultCodeMap.put(CtsTestResult.STR_TIMEOUT, CtsTestResult.CODE_TIMEOUT);
- mResultCodeMap.put(CtsTestResult.STR_OMITTED, CtsTestResult.CODE_OMITTED);
}
public ConsoleUi(TestHost host) {
@@ -1183,9 +1182,9 @@
CUIOutputStream.println("There aren't any test results!");
} else {
CUIOutputStream.println("List of all results: ");
- CUIOutputStream.println("Session\t\tTest result\t\t\t\t\tStart time\t\tEnd time\t"
+ CUIOutputStream.println("Session\t\tTest result\t\t\t\tStart time\t\tEnd time\t"
+ "\tTest plan name\t");
- CUIOutputStream.println("\t\tPass\tFail\tTimeout\tOmitted\tNotExecuted");
+ CUIOutputStream.println("\t\tPass\tFail\tTimeout\tNotExecuted");
for (TestSession session : sessions) {
TestSessionLog log = session.getSessionLog();
@@ -1193,8 +1192,6 @@
CtsTestResult.CODE_PASS).size();
int failNum = log.getTestList(
CtsTestResult.CODE_FAIL).size();
- int omittedNum = log.getTestList(
- CtsTestResult.CODE_OMITTED).size();
int notExecutedNum = log.getTestList(
CtsTestResult.CODE_NOT_EXECUTED).size();
int timeOutNum = log.getTestList(
@@ -1202,7 +1199,6 @@
String resStr = Long.toString(passNum) + "\t" + failNum;
resStr += "\t" + timeOutNum;
- resStr += "\t" + omittedNum;
resStr += "\t" + notExecutedNum;
String startTimeStr =
diff --git a/tools/host/src/com/android/cts/CtsTestResult.java b/tools/host/src/com/android/cts/CtsTestResult.java
index 851b07d..b64863d 100644
--- a/tools/host/src/com/android/cts/CtsTestResult.java
+++ b/tools/host/src/com/android/cts/CtsTestResult.java
@@ -37,14 +37,12 @@
public static final int CODE_FAIL = 2;
public static final int CODE_ERROR = 3;
public static final int CODE_TIMEOUT = 4;
- public static final int CODE_OMITTED = 5;
public static final int CODE_FIRST = CODE_INIT;
- public static final int CODE_LAST = CODE_OMITTED;
+ public static final int CODE_LAST = CODE_TIMEOUT;
public static final String STR_ERROR = "error";
public static final String STR_TIMEOUT = "timeout";
public static final String STR_NOT_EXECUTED = "notExecuted";
- public static final String STR_OMITTED = "omitted";
public static final String STR_FAIL = "fail";
public static final String STR_PASS = "pass";
@@ -57,7 +55,6 @@
sCodeToResultMap.put(CODE_FAIL, STR_FAIL);
sCodeToResultMap.put(CODE_ERROR, STR_ERROR);
sCodeToResultMap.put(CODE_TIMEOUT, STR_TIMEOUT);
- sCodeToResultMap.put(CODE_OMITTED, STR_OMITTED);
sResultToCodeMap = new HashMap<String, Integer>();
for (int code : sCodeToResultMap.keySet()) {
sResultToCodeMap.put(sCodeToResultMap.get(code), code);
diff --git a/tools/host/src/com/android/cts/TestDevice.java b/tools/host/src/com/android/cts/TestDevice.java
index 8460078..672ed37 100644
--- a/tools/host/src/com/android/cts/TestDevice.java
+++ b/tools/host/src/com/android/cts/TestDevice.java
@@ -27,8 +27,8 @@
import com.android.ddmlib.ShellCommandUnresponsiveException;
import com.android.ddmlib.SyncException;
import com.android.ddmlib.SyncService;
-import com.android.ddmlib.SyncService.ISyncProgressMonitor;
import com.android.ddmlib.TimeoutException;
+import com.android.ddmlib.SyncService.ISyncProgressMonitor;
import com.android.ddmlib.log.LogReceiver;
import com.android.ddmlib.log.LogReceiver.ILogListener;
@@ -1486,10 +1486,6 @@
case STATUS_ERROR:
mResultCode = CtsTestResult.CODE_FAIL;
break;
-
- case STATUS_OMITTED:
- mResultCode = CtsTestResult.CODE_OMITTED;
- break;
}
}
@@ -1555,10 +1551,6 @@
case STATUS_PASS:
mResultCode = CtsTestResult.CODE_PASS;
break;
-
- case STATUS_OMITTED:
- mResultCode = CtsTestResult.CODE_OMITTED;
- break;
}
resultLines.removeAll(resultLines);
}
@@ -1610,10 +1602,6 @@
mTest.setResult(new CtsTestResult(
CtsTestResult.CODE_FAIL, mFailedMsg, mStackTrace));
break;
-
- case STATUS_OMITTED:
- mTest.setResult(new CtsTestResult(CtsTestResult.CODE_OMITTED));
- break;
}
}
// report status even if no matching test was found
diff --git a/tools/host/src/com/android/cts/TestSession.java b/tools/host/src/com/android/cts/TestSession.java
index fedd756..e3693d8 100644
--- a/tools/host/src/com/android/cts/TestSession.java
+++ b/tools/host/src/com/android/cts/TestSession.java
@@ -485,15 +485,13 @@
private void displayTestResultSummary() {
int passNum = mSessionLog.getTestList(CtsTestResult.CODE_PASS).size();
int failNum = mSessionLog.getTestList(CtsTestResult.CODE_FAIL).size();
- int omittedNum = mSessionLog.getTestList(CtsTestResult.CODE_OMITTED).size();
int notExecutedNum = mSessionLog.getTestList(CtsTestResult.CODE_NOT_EXECUTED).size();
int timeOutNum = mSessionLog.getTestList(CtsTestResult.CODE_TIMEOUT).size();
- int total = passNum + failNum + omittedNum + notExecutedNum + timeOutNum;
+ int total = passNum + failNum + notExecutedNum + timeOutNum;
println("Test summary: pass=" + passNum
+ " fail=" + failNum
+ " timeOut=" + timeOutNum
- + " omitted=" + omittedNum
+ " notExecuted=" + notExecutedNum
+ " Total=" + total);
}
diff --git a/tools/host/src/com/android/cts/TestSessionLog.java b/tools/host/src/com/android/cts/TestSessionLog.java
index 0b53076..bf5b3e8 100644
--- a/tools/host/src/com/android/cts/TestSessionLog.java
+++ b/tools/host/src/com/android/cts/TestSessionLog.java
@@ -78,7 +78,6 @@
static final String ATTRIBUTE_PASS = "pass";
static final String ATTRIBUTE_FAILED = "failed";
static final String ATTRIBUTE_TIMEOUT = "timeout";
- static final String ATTRIBUTE_OMITTED = "omitted";
static final String ATTRIBUTE_NOT_EXECUTED = "notExecuted";
static final String TAG_DEVICEINFO = "DeviceInfo";
@@ -385,14 +384,12 @@
int passNum = getTestList(CtsTestResult.CODE_PASS).size();
int failNum = getTestList(CtsTestResult.CODE_FAIL).size();
- int omittedNum = getTestList(CtsTestResult.CODE_OMITTED).size();
int notExecutedNum = getTestList(CtsTestResult.CODE_NOT_EXECUTED).size();
int timeOutNum = getTestList(CtsTestResult.CODE_TIMEOUT).size();
Node summaryNode = doc.createElement(TAG_SUMMARY);
root.appendChild(summaryNode);
setAttribute(doc, summaryNode, ATTRIBUTE_PASS, passNum);
setAttribute(doc, summaryNode, ATTRIBUTE_FAILED, failNum);
- setAttribute(doc, summaryNode, ATTRIBUTE_OMITTED, omittedNum);
setAttribute(doc, summaryNode, ATTRIBUTE_NOT_EXECUTED, notExecutedNum);
setAttribute(doc, summaryNode, ATTRIBUTE_TIMEOUT, timeOutNum);
diff --git a/tools/utils/buildCts.py b/tools/utils/buildCts.py
index 7d4b6e0..35a3a11 100755
--- a/tools/utils/buildCts.py
+++ b/tools/utils/buildCts.py
@@ -97,7 +97,6 @@
'libcore/junit/src/main/java', # junit classes
'development/tools/hosttestlib/src', # hosttestlib TestCase extensions
'libcore/dalvik/src/main/java', # test annotations
- 'cts/libs/annotation/src', # cts annotations
'cts/tests/src', # cts test stubs
source_root # the source for this package
]
diff --git a/tools/utils/startcts b/tools/utils/startcts
index b0cb9ef..4db28b2 100755
--- a/tools/utils/startcts
+++ b/tools/utils/startcts
@@ -53,14 +53,13 @@
CTS_LIB=${CTS_ROOT}/tools/cts.jar
JUNIT_LIB=${CTS_ROOT}/tools/junit.jar
HOSTTEST_LIB=${CTS_ROOT}/tools/hosttestlib.jar
-CTS_TEST_ANNOTATIONS_HOST_LIB=${CTS_ROOT}/tools/CtsTestAnnotationsHostLib.jar
checkFile ${DDM_LIB}
checkFile ${CTS_LIB}
checkFile ${JUNIT_LIB}
checkFile ${HOSTTEST_LIB}
-JARS=${CTS_LIB}:${DDM_LIB}:${JUNIT_LIB}:${HOSTTEST_LIB}:${CTS_TEST_ANNOTATIONS_HOST_LIB}
+JARS=${CTS_LIB}:${DDM_LIB}:${JUNIT_LIB}:${HOSTTEST_LIB}
# Add SDK_ROOT to the PATH for backwards compatibility with prior startcts
# commands that required SDK_ROOT to find adb.