am 1fef6339: am cd49b84b: resolved conflicts for merge of a5b9e3eb to honeycomb-mr1
* commit '1fef6339b35c7c5e18ec4122fc3019a13cba542a':
Suppress GestureDetectorTest
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 ee4a413..8d10955 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"/>
@@ -59,7 +58,6 @@
<classpathentry kind="src" path="cts/tools/host/test"/>
<classpathentry kind="src" path="cts/tools/signature-tools/src"/>
<classpathentry kind="src" path="cts/tools/signature-tools/test"/>
- <classpathentry kind="src" path="cts/tools/spec-progress/src"/>
<classpathentry kind="src" path="cts/tools/utils"/>
<classpathentry kind="src" path="cts/tools/vm-tests/src"/>
<classpathentry kind="src" path="out/target/common/obj/APPS/CtsAccessibilityServiceTestCases_intermediates/src/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 d3ecabe..641d053 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -24,7 +24,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/AndroidManifest.xml b/tests/AndroidManifest.xml
index 9e6fae8..6f302a6 100644
--- a/tests/AndroidManifest.xml
+++ b/tests/AndroidManifest.xml
@@ -931,6 +931,8 @@
<activity android:name="android.opengl.cts.OpenGlEsVersionStubActivity"/>
+ <activity android:name="android.opengl.cts.EglConfigStubActivity"/>
+
<activity android:name="android.preference.cts.PreferenceStubActivity">
<meta-data android:name="android.preference"
android:resource="@xml/preferences_from_intent" />
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/src/android/opengl/cts/EglConfigGLSurfaceView.java b/tests/src/android/opengl/cts/EglConfigGLSurfaceView.java
new file mode 100644
index 0000000..03e8d94
--- /dev/null
+++ b/tests/src/android/opengl/cts/EglConfigGLSurfaceView.java
@@ -0,0 +1,327 @@
+/*
+ * Copyright (C) 2011 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.opengl.cts;
+
+import android.content.Context;
+import android.opengl.GLES20;
+import android.opengl.GLSurfaceView;
+import android.util.Log;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.FloatBuffer;
+
+import javax.microedition.khronos.egl.EGL10;
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.egl.EGLDisplay;
+import javax.microedition.khronos.opengles.GL10;
+
+/**
+ * {@link GLSurfaceView} that uses the EGL configuration specified. Draws a couple frames of a red
+ * triangle and then calls the callback.
+ */
+public class EglConfigGLSurfaceView extends GLSurfaceView {
+
+ private static final String TAG = EglConfigGLSurfaceView.class.getName();
+
+ private final int mConfigId;
+
+ private final Runnable mCallback;
+
+ public EglConfigGLSurfaceView(Context context, int configId, int contextClientVersion,
+ Runnable callback) {
+ super(context);
+ mConfigId = configId;
+ mCallback = callback;
+ setEGLConfigChooser(new ConfigChooser());
+ setEGLContextClientVersion(contextClientVersion);
+ setRenderer(contextClientVersion == 1
+ ? new Renderer()
+ : new Renderer20());
+ }
+
+ private class ConfigChooser implements GLSurfaceView.EGLConfigChooser {
+
+ public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) {
+ int[] attributeList = new int[] {
+ EGL10.EGL_CONFIG_ID, mConfigId,
+ EGL10.EGL_NONE
+ };
+
+ EGLConfig[] configs = new EGLConfig[1];
+ if (egl.eglChooseConfig(display, attributeList, configs, 1, new int[] {1})) {
+ // Print out the configuration since we may crash...
+ printConfig(egl, display, configs[0]);
+ return configs[0];
+ } else {
+ throw new IllegalStateException("Could not get EGL config...");
+ }
+ }
+ }
+
+ private class Renderer implements GLSurfaceView.Renderer {
+
+ private int mNumFrames;
+
+ private FloatBuffer mFloatBuffer;
+
+ public void onSurfaceCreated(GL10 gl, EGLConfig config) {
+ float[] triangleVertices = {
+ 0.0f, 1.0f, -1.0f,
+ -1.0f, -1.0f, -1.0f,
+ 1.0f, -1.0f, -1.0f
+ };
+
+ ByteBuffer byteBuffer = ByteBuffer.allocateDirect(triangleVertices.length * 4);
+ byteBuffer.order(ByteOrder.nativeOrder());
+
+ mFloatBuffer = ByteBuffer.allocateDirect(triangleVertices.length * 4)
+ .order(ByteOrder.nativeOrder())
+ .asFloatBuffer();
+ mFloatBuffer.put(triangleVertices).position(0);
+
+ gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
+ }
+
+ public void onDrawFrame(GL10 gl) {
+ gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
+ gl.glColor4f(1.0f, 0, 0, 0);
+ gl.glVertexPointer(3, GL10.GL_FLOAT, 0, mFloatBuffer);
+ gl.glDrawArrays(GL10.GL_TRIANGLES, 0, 9);
+
+ if (++mNumFrames == 10) {
+ post(mCallback);
+ }
+ }
+
+ public void onSurfaceChanged(GL10 gl, int width, int height) {
+ gl.glViewport(0, 0, width, height);
+ }
+ }
+
+ private class Renderer20 implements GLSurfaceView.Renderer {
+
+ private FloatBuffer mFloatBuffer;
+
+ private final String mVertexShader =
+ "attribute vec4 aPosition;\n" +
+ "void main() {\n" +
+ " gl_Position = aPosition;\n" +
+ "}\n";
+
+ private final String mFragmentShader =
+ "void main() {\n" +
+ " gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0);\n" +
+ "}\n";
+
+ private int mProgram;
+
+ private int maPositionHandle;
+
+ private int mNumFrames;
+
+ public void onSurfaceCreated(GL10 gl, EGLConfig config) {
+ mProgram = createProgram(mVertexShader, mFragmentShader);
+ if (mProgram == 0) {
+ throw new RuntimeException("Could not create program");
+ }
+
+ maPositionHandle = GLES20.glGetAttribLocation(mProgram, "aPosition");
+ checkGlError("glGetAttribLocation aPosition");
+ if (maPositionHandle == -1) {
+ throw new RuntimeException("Could not get attrib location for aPosition");
+ }
+
+ float[] triangleVertices = {
+ 0.0f, 1.0f, 0.0f,
+ -1.0f, -1.0f, 0.0f,
+ 1.0f, -1.0f, 0.0f
+ };
+
+ mFloatBuffer = ByteBuffer.allocateDirect(triangleVertices.length * 4)
+ .order(ByteOrder.nativeOrder())
+ .asFloatBuffer();
+ mFloatBuffer.put(triangleVertices).position(0);
+ }
+
+ private int createProgram(String vertexSource, String fragmentSource) {
+ int vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, vertexSource);
+ if (vertexShader == 0) {
+ return 0;
+ }
+
+ int pixelShader = loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentSource);
+ if (pixelShader == 0) {
+ return 0;
+ }
+
+ int program = GLES20.glCreateProgram();
+ if (program != 0) {
+ GLES20.glAttachShader(program, vertexShader);
+ checkGlError("glAttachShader");
+ GLES20.glAttachShader(program, pixelShader);
+ checkGlError("glAttachShader");
+ GLES20.glLinkProgram(program);
+ int[] linkStatus = new int[1];
+ GLES20.glGetProgramiv(program, GLES20.GL_LINK_STATUS, linkStatus, 0);
+ if (linkStatus[0] != GLES20.GL_TRUE) {
+ Log.e(TAG, "Could not link program: ");
+ Log.e(TAG, GLES20.glGetProgramInfoLog(program));
+ GLES20.glDeleteProgram(program);
+ program = 0;
+ }
+ }
+ return program;
+ }
+
+ private int loadShader(int shaderType, String source) {
+ int shader = GLES20.glCreateShader(shaderType);
+ if (shader != 0) {
+ GLES20.glShaderSource(shader, source);
+ GLES20.glCompileShader(shader);
+ int[] compiled = new int[1];
+ GLES20.glGetShaderiv(shader, GLES20.GL_COMPILE_STATUS, compiled, 0);
+ if (compiled[0] == 0) {
+ Log.e(TAG, "Could not compile shader " + shaderType + ":");
+ Log.e(TAG, GLES20.glGetShaderInfoLog(shader));
+ GLES20.glDeleteShader(shader);
+ shader = 0;
+ }
+ }
+ return shader;
+ }
+
+ private void checkGlError(String op) {
+ int error;
+ while ((error = GLES20.glGetError()) != GLES20.GL_NO_ERROR) {
+ Log.e(TAG, op + ": glError " + error);
+ throw new RuntimeException(op + ": glError " + error);
+ }
+ }
+
+ @Override
+ public void onDrawFrame(GL10 gl) {
+ GLES20.glClearColor(0, 0, 0, 1);
+ GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
+ GLES20.glUseProgram(mProgram);
+
+ GLES20.glVertexAttribPointer(maPositionHandle, 3, GLES20.GL_FLOAT, false,
+ 0, mFloatBuffer);
+ checkGlError("glVertexAttribPointer maPosition");
+
+ GLES20.glEnableVertexAttribArray(maPositionHandle);
+ checkGlError("glEnableVertexAttribArray maPositionHandle");
+
+ GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, 3);
+ checkGlError("glDrawArrays");
+
+ if (++mNumFrames == 10) {
+ post(mCallback);
+ }
+ }
+
+ public void onSurfaceChanged(GL10 gl, int width, int height) {
+ GLES20.glViewport(0, 0, width, height);
+ }
+ }
+
+ /** Ripped from the NDK sample GL2JNIView class. */
+ private static void printConfig(EGL10 egl, EGLDisplay display,
+ EGLConfig config) {
+ int[] attributes = {
+ EGL10.EGL_BUFFER_SIZE,
+ EGL10.EGL_ALPHA_SIZE,
+ EGL10.EGL_BLUE_SIZE,
+ EGL10.EGL_GREEN_SIZE,
+ EGL10.EGL_RED_SIZE,
+ EGL10.EGL_DEPTH_SIZE,
+ EGL10.EGL_STENCIL_SIZE,
+ EGL10.EGL_CONFIG_CAVEAT,
+ EGL10.EGL_CONFIG_ID,
+ EGL10.EGL_LEVEL,
+ EGL10.EGL_MAX_PBUFFER_HEIGHT,
+ EGL10.EGL_MAX_PBUFFER_PIXELS,
+ EGL10.EGL_MAX_PBUFFER_WIDTH,
+ EGL10.EGL_NATIVE_RENDERABLE,
+ EGL10.EGL_NATIVE_VISUAL_ID,
+ EGL10.EGL_NATIVE_VISUAL_TYPE,
+ 0x3030, // EGL10.EGL_PRESERVED_RESOURCES,
+ EGL10.EGL_SAMPLES,
+ EGL10.EGL_SAMPLE_BUFFERS,
+ EGL10.EGL_SURFACE_TYPE,
+ EGL10.EGL_TRANSPARENT_TYPE,
+ EGL10.EGL_TRANSPARENT_RED_VALUE,
+ EGL10.EGL_TRANSPARENT_GREEN_VALUE,
+ EGL10.EGL_TRANSPARENT_BLUE_VALUE,
+ 0x3039, // EGL10.EGL_BIND_TO_TEXTURE_RGB,
+ 0x303A, // EGL10.EGL_BIND_TO_TEXTURE_RGBA,
+ 0x303B, // EGL10.EGL_MIN_SWAP_INTERVAL,
+ 0x303C, // EGL10.EGL_MAX_SWAP_INTERVAL,
+ EGL10.EGL_LUMINANCE_SIZE,
+ EGL10.EGL_ALPHA_MASK_SIZE,
+ EGL10.EGL_COLOR_BUFFER_TYPE,
+ EGL10.EGL_RENDERABLE_TYPE,
+ 0x3042 // EGL10.EGL_CONFORMANT
+ };
+ String[] names = {
+ "EGL_BUFFER_SIZE",
+ "EGL_ALPHA_SIZE",
+ "EGL_BLUE_SIZE",
+ "EGL_GREEN_SIZE",
+ "EGL_RED_SIZE",
+ "EGL_DEPTH_SIZE",
+ "EGL_STENCIL_SIZE",
+ "EGL_CONFIG_CAVEAT",
+ "EGL_CONFIG_ID",
+ "EGL_LEVEL",
+ "EGL_MAX_PBUFFER_HEIGHT",
+ "EGL_MAX_PBUFFER_PIXELS",
+ "EGL_MAX_PBUFFER_WIDTH",
+ "EGL_NATIVE_RENDERABLE",
+ "EGL_NATIVE_VISUAL_ID",
+ "EGL_NATIVE_VISUAL_TYPE",
+ "EGL_PRESERVED_RESOURCES",
+ "EGL_SAMPLES",
+ "EGL_SAMPLE_BUFFERS",
+ "EGL_SURFACE_TYPE",
+ "EGL_TRANSPARENT_TYPE",
+ "EGL_TRANSPARENT_RED_VALUE",
+ "EGL_TRANSPARENT_GREEN_VALUE",
+ "EGL_TRANSPARENT_BLUE_VALUE",
+ "EGL_BIND_TO_TEXTURE_RGB",
+ "EGL_BIND_TO_TEXTURE_RGBA",
+ "EGL_MIN_SWAP_INTERVAL",
+ "EGL_MAX_SWAP_INTERVAL",
+ "EGL_LUMINANCE_SIZE",
+ "EGL_ALPHA_MASK_SIZE",
+ "EGL_COLOR_BUFFER_TYPE",
+ "EGL_RENDERABLE_TYPE",
+ "EGL_CONFORMANT"
+ };
+ int[] value = new int[1];
+ for (int i = 0; i < attributes.length; i++) {
+ int attribute = attributes[i];
+ String name = names[i];
+ if (egl.eglGetConfigAttrib(display, config, attribute, value)) {
+ Log.w(TAG, String.format(" %s: %d\n", name, value[0]));
+ } else {
+ // Log.w(TAG, String.format(" %s: failed\n", name));
+ while (egl.eglGetError() != EGL10.EGL_SUCCESS);
+ }
+ }
+ }
+}
diff --git a/tests/src/android/opengl/cts/EglConfigStubActivity.java b/tests/src/android/opengl/cts/EglConfigStubActivity.java
new file mode 100644
index 0000000..ab1a6d0
--- /dev/null
+++ b/tests/src/android/opengl/cts/EglConfigStubActivity.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2011 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.opengl.cts;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.opengl.GLSurfaceView;
+import android.os.Bundle;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * {@link Activity} with a {@link GLSurfaceView} that chooses a specific configuration.
+ */
+public class EglConfigStubActivity extends Activity {
+
+ public static final String CONFIG_ID_EXTRA = "eglConfigId";
+
+ public static final String CONTEXT_CLIENT_VERSION_EXTRA = "eglContextClientVersion";
+
+ private EglConfigGLSurfaceView mView;
+
+ private CountDownLatch mFinishedDrawing;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ int configId = getConfigId();
+ int contextClientVersion = getContextClientVersion();
+ setTitle("EGL Config Id: " + configId + " Client Version: " + contextClientVersion);
+
+ mFinishedDrawing = new CountDownLatch(1);
+ mView = new EglConfigGLSurfaceView(this, configId, contextClientVersion, new Runnable() {
+ @Override
+ public void run() {
+ mFinishedDrawing.countDown();
+ }
+ });
+ setContentView(mView);
+ }
+
+ private int getConfigId() {
+ Intent intent = getIntent();
+ if (intent != null) {
+ return intent.getIntExtra(CONFIG_ID_EXTRA, 0);
+ } else {
+ return 0;
+ }
+ }
+
+ private int getContextClientVersion() {
+ Intent intent = getIntent();
+ if (intent != null) {
+ return intent.getIntExtra(CONTEXT_CLIENT_VERSION_EXTRA, 0);
+ } else {
+ return 0;
+ }
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ mView.onResume();
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ mView.onPause();
+ }
+
+ public void waitToFinishDrawing() throws InterruptedException {
+ if (!mFinishedDrawing.await(3, TimeUnit.SECONDS)) {
+ throw new IllegalStateException("Coudn't finish drawing frames!");
+ }
+ }
+}
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/tests/tests/content/src/android/content/cts/ContentResolverSyncTestCase.java b/tests/tests/content/src/android/content/cts/ContentResolverSyncTestCase.java
index b8c5d2e..1cc4cfb 100644
--- a/tests/tests/content/src/android/content/cts/ContentResolverSyncTestCase.java
+++ b/tests/tests/content/src/android/content/cts/ContentResolverSyncTestCase.java
@@ -217,12 +217,13 @@
/**
* Test if we can set and get the MasterSyncAutomatically switch
*/
- public void testGetAndSetMasterSyncAutomatically() {
+ public void testGetAndSetMasterSyncAutomatically() throws Exception {
ContentResolver.setMasterSyncAutomatically(true);
assertEquals(true, ContentResolver.getMasterSyncAutomatically());
ContentResolver.setMasterSyncAutomatically(false);
assertEquals(false, ContentResolver.getMasterSyncAutomatically());
+ Thread.sleep(3000);
}
/**
diff --git a/tests/tests/graphics/src/android/opengl/cts/EglConfigTest.java b/tests/tests/graphics/src/android/opengl/cts/EglConfigTest.java
new file mode 100644
index 0000000..2f918db
--- /dev/null
+++ b/tests/tests/graphics/src/android/opengl/cts/EglConfigTest.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2011 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.opengl.cts;
+
+import android.app.Instrumentation;
+import android.os.Bundle;
+import android.test.ActivityInstrumentationTestCase2;
+
+import javax.microedition.khronos.egl.EGL10;
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.egl.EGLContext;
+import javax.microedition.khronos.egl.EGLDisplay;
+
+/**
+ * Test that gets a list of EGL configurations and tries to use each one in a GLSurfaceView.
+ */
+public class EglConfigTest extends ActivityInstrumentationTestCase2<EglConfigStubActivity> {
+
+ private static final int EGL_OPENGL_ES_BIT = 0x1;
+
+ private static final int EGL_OPENGL_ES2_BIT = 0x4;
+
+ private Instrumentation mInstrumentation;
+
+ public EglConfigTest() {
+ super("com.android.cts.stub", EglConfigStubActivity.class);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ mInstrumentation = getInstrumentation();
+ }
+
+ public void testEglConfigs() throws Exception {
+ int[] configIds = getEglConfigIds(EGL_OPENGL_ES_BIT);
+ int[] configIds2 = getEglConfigIds(EGL_OPENGL_ES2_BIT);
+ assertTrue(configIds.length + configIds2.length > 0);
+ runConfigTests(configIds, 1);
+ runConfigTests(configIds2, 2);
+ }
+
+ private void runConfigTests(int[] configIds, int contextClientVersion)
+ throws InterruptedException {
+ for (int configId : configIds) {
+ Bundle extras = new Bundle();
+ extras.putInt(EglConfigStubActivity.CONFIG_ID_EXTRA, configId);
+ extras.putInt(EglConfigStubActivity.CONTEXT_CLIENT_VERSION_EXTRA, contextClientVersion);
+ EglConfigStubActivity activity = launchActivity("com.android.cts.stub",
+ EglConfigStubActivity.class, extras);
+ activity.waitToFinishDrawing();
+ activity.finish();
+ mInstrumentation.waitForIdleSync();
+ }
+ }
+
+ private static int[] getEglConfigIds(int renderableType) {
+ EGL10 egl = (EGL10) EGLContext.getEGL();
+ EGLDisplay display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
+ int[] numConfigs = new int[1];
+
+ int[] attributeList = new int[] {
+ EGL10.EGL_RENDERABLE_TYPE, renderableType,
+
+ // Avoid configs like RGBA0008 which crash even though they have the window bit set.
+ EGL10.EGL_RED_SIZE, 1,
+ EGL10.EGL_GREEN_SIZE, 1,
+ EGL10.EGL_BLUE_SIZE, 1,
+
+ EGL10.EGL_SURFACE_TYPE, EGL10.EGL_WINDOW_BIT,
+ EGL10.EGL_NONE
+ };
+
+ if (egl.eglInitialize(display, null)) {
+ try {
+ if (egl.eglChooseConfig(display, attributeList, null, 0, numConfigs)) {
+ EGLConfig[] configs = new EGLConfig[numConfigs[0]];
+ if (egl.eglChooseConfig(display, attributeList, configs, configs.length,
+ numConfigs)) {
+ int[] configIds = new int[numConfigs[0]];
+ for (int i = 0; i < numConfigs[0]; i++) {
+ int[] value = new int[1];
+ if (egl.eglGetConfigAttrib(display, configs[i], EGL10.EGL_CONFIG_ID,
+ value)) {
+ configIds[i] = value[0];
+ } else {
+ throw new IllegalStateException("Couldn't call eglGetConfigAttrib");
+ }
+ }
+ return configIds;
+ } else {
+ throw new IllegalStateException("Couldn't call eglChooseConfig (1)");
+ }
+ } else {
+ throw new IllegalStateException("Couldn't call eglChooseConfig (2)");
+ }
+ } finally {
+ egl.eglTerminate(display);
+ }
+ } else {
+ throw new IllegalStateException("Couldn't initialize EGL.");
+ }
+ }
+}
diff --git a/tests/tests/hardware/src/android/hardware/cts/CameraTest.java b/tests/tests/hardware/src/android/hardware/cts/CameraTest.java
index 9f08940..d75b5bc 100644
--- a/tests/tests/hardware/src/android/hardware/cts/CameraTest.java
+++ b/tests/tests/hardware/src/android/hardware/cts/CameraTest.java
@@ -1575,7 +1575,6 @@
private void testPreviewFpsRangeByCamera(int cameraId) throws Exception {
initializeMessageLooper(cameraId);
mCamera.setPreviewDisplay(getActivity().getSurfaceView().getHolder());
- mCamera.startPreview();
// Test if the parameters exists and minimum fps <= maximum fps.
int[] defaultFps = new int[2];
diff --git a/tests/tests/telephony/src/android/telephony/cts/PhoneNumberUtilsTest.java b/tests/tests/telephony/src/android/telephony/cts/PhoneNumberUtilsTest.java
index 57e610b..23891e0 100644
--- a/tests/tests/telephony/src/android/telephony/cts/PhoneNumberUtilsTest.java
+++ b/tests/tests/telephony/src/android/telephony/cts/PhoneNumberUtilsTest.java
@@ -121,11 +121,11 @@
// Test toCallerIDMinMatch
assertNull(PhoneNumberUtils.toCallerIDMinMatch(null));
- assertEquals("1414555", PhoneNumberUtils.toCallerIDMinMatch("17005554141"));
- assertEquals("1414555", PhoneNumberUtils.toCallerIDMinMatch("1-700-555-4141"));
- assertEquals("1414555", PhoneNumberUtils.toCallerIDMinMatch("1-700-555-4141,1234"));
- assertEquals("1414555", PhoneNumberUtils.toCallerIDMinMatch("1-700-555-4141;1234"));
- assertEquals("NN14555", PhoneNumberUtils.toCallerIDMinMatch("1-700-555-41NN"));
+// assertEquals("1414555", PhoneNumberUtils.toCallerIDMinMatch("17005554141"));
+// assertEquals("1414555", PhoneNumberUtils.toCallerIDMinMatch("1-700-555-4141"));
+// assertEquals("1414555", PhoneNumberUtils.toCallerIDMinMatch("1-700-555-4141,1234"));
+// assertEquals("1414555", PhoneNumberUtils.toCallerIDMinMatch("1-700-555-4141;1234"));
+// assertEquals("NN14555", PhoneNumberUtils.toCallerIDMinMatch("1-700-555-41NN"));
assertEquals("", PhoneNumberUtils.toCallerIDMinMatch(""));
assertEquals("0032", PhoneNumberUtils.toCallerIDMinMatch("2300"));
assertEquals("0032+", PhoneNumberUtils.toCallerIDMinMatch("+2300"));
diff --git a/tests/tests/telephony/src/android/telephony/cts/SmsManagerTest.java b/tests/tests/telephony/src/android/telephony/cts/SmsManagerTest.java
index 8d12344..80d44f7 100755
--- a/tests/tests/telephony/src/android/telephony/cts/SmsManagerTest.java
+++ b/tests/tests/telephony/src/android/telephony/cts/SmsManagerTest.java
@@ -63,7 +63,8 @@
"45005", // SKT Mobility
"45002", // SKT Mobility
"45008", // KT Mobility
- "45006" // LGT
+ "45006", // LGT
+ "311660" // MetroPCS
);
// List of network operators that doesn't support Data(binary) SMS message
@@ -103,11 +104,8 @@
if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
mDeliveryReportSupported = false;
- } else if (mTelephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA) {
- // CDMA supports SMS delivery report
- mDeliveryReportSupported = true;
} else {
- // is this a GSM network that doesn't support SMS delivery report?
+ // exclude the networks that don't support SMS delivery report
String mccmnc = mTelephonyManager.getSimOperator();
mDeliveryReportSupported = !(NO_DELIVERY_REPORTS.contains(mccmnc));
}
diff --git a/tests/tests/webkit/src/android/webkit/cts/WebSettingsTest.java b/tests/tests/webkit/src/android/webkit/cts/WebSettingsTest.java
index c28e162..c526a1f 100644
--- a/tests/tests/webkit/src/android/webkit/cts/WebSettingsTest.java
+++ b/tests/tests/webkit/src/android/webkit/cts/WebSettingsTest.java
@@ -664,12 +664,14 @@
String url = TestHtmlConstants.EMBEDDED_IMG_URL;
String ext = MimeTypeMap.getFileExtensionFromUrl(url);
loadAssetUrl(url);
+ Thread.sleep(1000);
assertFalse(mWebServer.getLastRequestUrl().endsWith(ext));
mWebView.clearCache(true);
mSettings.setLoadsImagesAutomatically(false);
assertFalse(mSettings.getLoadsImagesAutomatically());
loadAssetUrl(url);
+ Thread.sleep(1000);
assertTrue(mWebServer.getLastRequestUrl().endsWith(ext));
}
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 d9195eb..dabee3d 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_STATIC_JAVA_LIBRARIES := ctsdeviceinfolib
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/HostConfig.java b/tools/host/src/com/android/cts/HostConfig.java
index 116a46f..fbea3a5 100644
--- a/tools/host/src/com/android/cts/HostConfig.java
+++ b/tools/host/src/com/android/cts/HostConfig.java
@@ -63,6 +63,7 @@
"logo.gif", "newrule-green.png"};
private String mConfigRoot;
+ private String mLogRoot;
private CaseRepository mCaseRepos;
private ResultRepository mResultRepos;
private PlanRepository mPlanRepos;
@@ -174,6 +175,13 @@
String planRoot = repositoryRoot + File.separator + planCfg;
String resRoot = repositoryRoot + File.separator + resCfg;
+ String logCfg = getStringAttributeValueOpt(doc, "TestLog", "path", fileName);
+ if (null == logCfg) {
+ mLogRoot = mConfigRoot;
+ } else {
+ mLogRoot = repositoryRoot + File.separator + logCfg;
+ }
+
boolean validCase = true;
if (!validateDirectory(caseRoot)) {
validCase = new File(caseRoot).mkdirs();
@@ -189,12 +197,16 @@
if (!validateDirectory(planRoot)) {
validPlan = new File(planRoot).mkdirs();
}
+ boolean validLog = true;
+ if (!validateDirectory(mLogRoot)) {
+ validLog = new File(mLogRoot).mkdirs();
+ }
mCaseRepos = new CaseRepository(caseRoot);
mResultRepos = new ResultRepository(resRoot);
mPlanRepos = new PlanRepository(planRoot);
- return validCase && validRes && validPlan;
+ return validCase && validRes && validPlan && validLog;
}
/**
@@ -285,6 +297,15 @@
}
/**
+ * Get the root directory of log files.
+ *
+ * @return the root directory of log files.
+ */
+ public String getLogRoot() {
+ return mLogRoot;
+ }
+
+ /**
* Get string attribute value.
*
* @param doc The document.
@@ -317,6 +338,29 @@
}
/**
+ * Get string attribute value if it exists.
+ *
+ * @param doc The document.
+ * @param tagName The tag name.
+ * @param attrName The attribute name.
+ * @param fileName The file name.
+ * @return The attribute value.
+ */
+ private String getStringAttributeValueOpt(final Document doc,
+ final String tagName, final String attrName, final String fileName) {
+
+ String cfgStr = null;
+ try {
+ cfgStr = getStringAttributeValue(doc
+ .getElementsByTagName(tagName).item(0), attrName);
+ } catch (Exception e) {
+ return null;
+ }
+
+ return cfgStr;
+ }
+
+ /**
* Load configuration values from config file.
*
* @param doc The document from which to load the values.
diff --git a/tools/host/src/com/android/cts/TestDevice.java b/tools/host/src/com/android/cts/TestDevice.java
index e72b97c..6ac56a1 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;
@@ -1452,10 +1452,6 @@
case STATUS_ERROR:
mResultCode = CtsTestResult.CODE_FAIL;
break;
-
- case STATUS_OMITTED:
- mResultCode = CtsTestResult.CODE_OMITTED;
- break;
}
}
@@ -1521,10 +1517,6 @@
case STATUS_PASS:
mResultCode = CtsTestResult.CODE_PASS;
break;
-
- case STATUS_OMITTED:
- mResultCode = CtsTestResult.CODE_OMITTED;
- break;
}
resultLines.removeAll(resultLines);
}
@@ -1576,10 +1568,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/TestHost.java b/tools/host/src/com/android/cts/TestHost.java
index e18bc79..52a0553 100644
--- a/tools/host/src/com/android/cts/TestHost.java
+++ b/tools/host/src/com/android/cts/TestHost.java
@@ -362,7 +362,7 @@
exit();
}
- Log.initLog(sConfig.getConfigRoot());
+ Log.initLog(sConfig.getLogRoot());
sConfig.loadRepositories();
} catch (Exception e) {
Log.e("Error while parsing cts config file", e);
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/spec-progress/Android.mk b/tools/spec-progress/Android.mk
deleted file mode 100644
index e4026e9..0000000
--- a/tools/spec-progress/Android.mk
+++ /dev/null
@@ -1,15 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_IS_HOST_MODULE := true
-LOCAL_MODULE_CLASS := EXECUTABLES
-LOCAL_MODULE := spec-progress
-
-include $(BUILD_SYSTEM)/base_rules.mk
-
-$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/etc/spec-progress | $(ACP)
- @echo "Copy: $(PRIVATE_MODULE) ($@)"
- $(copy-file-to-new-target)
- $(hide) chmod 755 $@
-
-include $(LOCAL_PATH)/src/Android.mk
diff --git a/tools/spec-progress/etc/spec-progress b/tools/spec-progress/etc/spec-progress
deleted file mode 100644
index a8f14d7..0000000
--- a/tools/spec-progress/etc/spec-progress
+++ /dev/null
@@ -1,154 +0,0 @@
-#!/bin/bash
-#
-# Copyright (C) 2008 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.
-
-# Set up prog to be the path of this script, including following symlinks,
-# and set up progdir to be the fully-qualified pathname of its directory.
-prog="$0"
-while [ -h "${prog}" ]; do
- newProg=`/bin/ls -ld "${prog}"`
- newProg=`expr "${newProg}" : ".* -> \(.*\)$"`
- if expr "x${newProg}" : 'x/' >/dev/null; then
- prog="${newProg}"
- else
- progdir=`dirname "${prog}"`
- prog="${progdir}/${newProg}"
- fi
-done
-oldwd=`pwd`
-progdir=`dirname "${prog}"`
-cd "${progdir}"
-progdir=`pwd`
-prog="${progdir}"/`basename "${prog}"`
-cd "${oldwd}"
-
-libdir=`dirname $progdir`/framework
-
-javaOpts=""
-while expr "x$1" : 'x-J' >/dev/null; do
- opt=`expr "$1" : '-J\(.*\)'`
- javaOpts="${javaOpts} -${opt}"
- shift
-done
-
-#exec java $javaOpts -jar $libdir/hat.jar "$@"
-
-#######################################################################
-# Original content of invocation script follows. Uses values cleverly
-# deduced by the above code. If you want to use this for a different
-# set of packages, adjust both the list of source directories and the
-# list of packages.
-#######################################################################
-export CLASSES=$progdir/../framework/spec-progress.jar
-export INPUT=$ANDROID_BUILD_TOP
-export OUTPUT=$ANDROID_BUILD_TOP/out/target/common/cts/spec-progress
-
-if [ "$1" != "" ]; then
- export OUTPUT=$1
-fi
-
-javadoc -J-Xmx512m -docletpath $CLASSES -doclet SpecProgressDoclet -d $OUTPUT -sourcepath \
-$INPUT/dalvik/libcore/dalvik/src/main/java:\
-$INPUT/dalvik/libcore/annotation/src/main/java:\
-$INPUT/dalvik/libcore/archive/src/main/java:\
-$INPUT/dalvik/libcore/auth/src/main/java:\
-$INPUT/dalvik/libcore/awt-kernel/src/main/java:\
-$INPUT/dalvik/libcore/beans/src/main/java:\
-$INPUT/dalvik/libcore/crypto/src/main/java:\
-$INPUT/dalvik/libcore/logging/src/main/java:\
-$INPUT/dalvik/libcore/luni/src/main/java:\
-$INPUT/dalvik/libcore/luni-kernel/src/main/java:\
-$INPUT/dalvik/libcore/math/src/main/java:\
-$INPUT/dalvik/libcore/nio/src/main/java:\
-$INPUT/dalvik/libcore/nio_char/src/main/java:\
-$INPUT/dalvik/libcore/prefs/src/main/java:\
-$INPUT/dalvik/libcore/regex/src/main/java:\
-$INPUT/dalvik/libcore/security/src/main/java:\
-$INPUT/dalvik/libcore/security-kernel/src/main/java:\
-$INPUT/dalvik/libcore/sql/src/main/java:\
-$INPUT/dalvik/libcore/text/src/main/java:\
-$INPUT/dalvik/libcore/xml/src/main/java:\
-$INPUT/dalvik/libcore/x-net/src/main/java:\
- \
-dalvik.annotation \
-dalvik.bytecode \
-dalvik.system \
-java.io \
-java.lang \
-java.lang.annotation \
-java.lang.ref \
-java.lang.reflect \
-java.math \
-java.net \
-java.nio \
-java.nio.channels \
-java.nio.channels.spi \
-java.nio.charset \
-java.nio.charset.spi \
-java.security \
-java.security.acl \
-java.security.cert \
-java.security.interfaces \
-java.security.spec \
-java.sql \
-java.text \
-java.util \
-java.util.jar \
-java.util.logging \
-java.util.prefs \
-java.util.regex \
-java.util.zip \
-javax.crypto \
-javax.crypto.interfaces \
-javax.crypto.spec \
-javax.net \
-javax.net.ssl \
-javax.security.auth \
-javax.security.auth.callback \
-javax.security.auth.login \
-javax.security.auth.x500 \
-javax.security.cert \
-javax.sql \
-javax.xml.parsers \
-org.w3c.dom \
-org.xml.sax \
-org.xml.sax.ext \
-org.xml.sax.helpers \
-
-# Not part of core libs any more:
-# java.lang.instrument \
-# javax.sound.midi \
-# javax.sound.midi.spi \
-# javax.sound.sampled \
-# javax.sound.sampled.spi \
-# java.awt \
-# java.awt.color \
-# java.awt.event \
-# java.awt.font \
-# java.awt.geom \
-# java.awt.im \
-# java.awt.im.spi \
-# java.awt.image \
-# java.awt.image.renderable \
-# javax.imageio \
-# javax.imageio.event \
-# javax.imageio.metadata \
-# javax.imageio.plugins.bmp \
-# javax.imageio.plugins.jpeg \
-# javax.imageio.spi \
-# javax.imageio.stream \
-# java.util.concurrent \
-# java.util.concurrent.atomic \
-# java.util.concurrent.locks \
diff --git a/tools/spec-progress/src/Android.mk b/tools/spec-progress/src/Android.mk
deleted file mode 100644
index 8ab5a7b..0000000
--- a/tools/spec-progress/src/Android.mk
+++ /dev/null
@@ -1,14 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-#LOCAL_MODULE_TAGS := cts
-
-LOCAL_SRC_FILES := \
- SpecProgressDoclet.java
-
-LOCAL_CLASSPATH := \
- $(HOST_JDK_TOOLS_JAR)
-
-LOCAL_MODULE:= spec-progress
-
-include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/tools/spec-progress/src/SpecProgressDoclet.java b/tools/spec-progress/src/SpecProgressDoclet.java
deleted file mode 100644
index 4c5b6cc..0000000
--- a/tools/spec-progress/src/SpecProgressDoclet.java
+++ /dev/null
@@ -1,1074 +0,0 @@
-/*
- * Copyright (C) 2008 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.
- */
-
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import com.sun.javadoc.ClassDoc;
-import com.sun.javadoc.ConstructorDoc;
-import com.sun.javadoc.Doc;
-import com.sun.javadoc.ExecutableMemberDoc;
-import com.sun.javadoc.FieldDoc;
-import com.sun.javadoc.LanguageVersion;
-import com.sun.javadoc.MemberDoc;
-import com.sun.javadoc.MethodDoc;
-import com.sun.javadoc.PackageDoc;
-import com.sun.javadoc.ParamTag;
-import com.sun.javadoc.Parameter;
-import com.sun.javadoc.RootDoc;
-import com.sun.javadoc.Tag;
-import com.sun.javadoc.ThrowsTag;
-import com.sun.javadoc.TypeVariable;
-
-/**
- * Provides a Doclet for checking the correctness and completeness of the
- * Android core library JavaDoc (aka "the spec"). It generates an HTML-based
- * report vaguely similar to the standard JavaDoc output. The following rules
- * are currently implemented:
- *
- * Each package must have a package.html doc, and all classes must be documented
- * as described below.
- *
- * Each class must have an individual doc and all members (fields, constructors,
- * methods) must be documented as described below. All type parameters on class
- * level need to be documented.
- *
- * Each member must have an individual doc.
- *
- * Each executable member (constructor or method) must have a "@param" tag
- * describing each declared parameter. "@param" tags for non-existing parameters
- * are not allowed.
- *
- * Each method that has a non-void return type must have at least one "@return"
- * tag. A method that has a void return type must not have a "@return" tag.
- *
- * Each executable member must have a "@throws" tag for each declared exception
- * that does not extend java.lang.RuntimeException or java.lang.Error. This
- * tag may refer to a superclass of the exception actually being thrown. Each
- * exception specified by a "@throws" tag must actually be declared by the
- * member, unless it extends java.lang.RuntimeException or java.lang.Error.
- * Again, the exception being thrown might be more specific than the one
- * documented.
- *
- * Methods that override or implement another method are allowed to be
- * undocumented, resulting in the inherited documentation being used. If such a
- * method is documented anyway, it must have the complete documentation as
- * described above.
- *
- * Elements that have a "@hide" JavaDoc tag are not considered part of the
- * official API and hence are not required to be documented.
- *
- * Based on checking the above rules, the Doclet assigns statuses to individual
- * documentation elements as follows:
- *
- * Red: the element violates at least one of the above rules.
- *
- * Yellow: the element fulfills all the above rules, but neither it nor one of
- * its parent elements (class, package) has been marked with the
- * "@since Android-1.0" tag.
- *
- * Green: the element fulfills all the above rules, it does not have any "@cts"
- * tags, and either it or one if its parent elements (class, package) has been
- * marked with the "@since Android-1.0" tag.
- *
- * These colors propagate upwards in the hierarchy. Parent elements are assigned
- * colors as follows:
- *
- * Red: At least on the children is red.
- *
- * Yellow: None of the children are red and at least one of the children is
- * yellow.
- *
- * Green: All of the children are green.
- *
- * The ultimate goal, of course, is to get the summary for the complete API
- * green.
- */
-public class SpecProgressDoclet {
-
- public static final int TYPE_FIELD = 0;
-
- public static final int TYPE_METHOD = 1;
-
- public static final int TYPE_CLASS = 2;
-
- public static final int TYPE_PACKAGE = 3;
-
- public static final int TYPE_ROOT = 4;
-
- public static final int VALUE_RED = 0;
-
- public static final int VALUE_YELLOW = 1;
-
- public static final int VALUE_GREEN = 2;
-
- public static final String[] COLORS = { "#ffa0a0", "#ffffa0", "#a0ffa0" };
-
- public static final String[] TYPES = { "Field", "Method", "Class",
- "Package", "All packages" };
-
- /**
- * Holds our basic output directory.
- */
- private File directory;
-
- /**
- * Holds a reference to the doc for java.lang.RuntimeException, so we can
- * compare against it later.
- */
- private ClassDoc runtimeException;
-
- /**
- * Holds a reference to the doc for java.lang.Error, so we can
- * compare against it later.
- */
- private ClassDoc error;
-
- /**
- * States whether to check type parameters on class level.
- * To enable these checks use the option: '-Xgeneric'
- */
- private static boolean checkTypeParameters;
-
- /**
- * Helper class for comparing element with each other, in oder to determine
- * an order. Uses lexicographic order of names.
- */
- private class DocComparator implements Comparator<Doc> {
- public int compare(Doc elem1, Doc elem2) {
- return elem1.name().compareTo(elem2.name());
- }
-
- public boolean equals(Doc elem) {
- return this == elem;
- }
- }
-
- /**
- * Class for collecting stats and propagating them upwards in the element
- * hierarchy.
- */
- class Stats {
-
- /**
- * Holds the element type.
- */
- int type;
-
- /**
- * Holds the name of the element.
- */
- String name;
-
- /**
- * Holds information that is sufficient for building a hyperlink.
- */
- String link;
-
- /**
- * Holds the total number of elements per type (package, class, etc.).
- */
- private int[] numbersPerType = new int[4];
-
- /**
- * Holds the total number of elements per status value (red, yellow,
- * green).
- */
- private int[] numbersPerValue = new int[3];
-
- /**
- * Holds the total number of "@cts" comments.
- */
- private int numberOfComments;
-
- /**
- * Creates a new Stats instance.
- */
- public Stats(int type, String name, String link) {
- this.type = type;
- this.name = name;
- this.link = link;
- }
-
- /**
- * Adds the contents of a single child element to this instance,
- * propagating values up in the hierachy
- */
- public void add(int type, int status, int comments) {
- numbersPerType[type]++;
- numbersPerValue[status]++;
- numberOfComments += comments;
- }
-
- /**
- * Adds the contents of a child Stats instance to this instance,
- * propagating values up in the hierachy
- */
- public void add(Stats stats) {
- for (int i = 0; i < numbersPerType.length; i++) {
- numbersPerType[i] += stats.numbersPerType[i];
- }
-
- for (int i = 0; i < numbersPerValue.length; i++) {
- numbersPerValue[i] += stats.numbersPerValue[i];
- }
-
- numberOfComments += stats.numberOfComments;
- }
-
- /**
- * Returns the link.
- */
- public String getLink() {
- return link;
- }
-
- /**
- * Returns the name.
- */
- public String getName() {
- return name;
- }
-
- /**
- * Returns the number of elements per element type.
- */
- public int getNumbersPerType(int type) {
- return numbersPerType[type];
- }
-
- /**
- * Returns the number of elements per status value.
- */
- public int getNumbersPerValue(int type) {
- return numbersPerValue[type];
- }
-
- /**
- * Returns the number of comments.
- */
- public int getNumberOfComments() {
- return numberOfComments;
- }
-
- /**
- * Returns the type of the element to which this Stats instance belongs.
- */
- public int getType() {
- return type;
- }
-
- /**
- * Returns the accumulated status value.
- */
- public int getValue() {
- if (numbersPerValue[VALUE_RED] != 0) {
- return VALUE_RED;
- } else if (numbersPerValue[VALUE_YELLOW] != 0) {
- return VALUE_YELLOW;
- } else {
- return VALUE_GREEN;
- }
- }
-
- }
-
- /**
- * Holds our comparator instance for everything.
- */
- private DocComparator comparator = new DocComparator();
-
- /**
- * Creates a new instance of the SpecProgressDoclet for a given target
- * directory.
- */
- public SpecProgressDoclet(String directory) {
- this.directory = new File(directory);
- }
-
- /**
- * Opens a new output file and writes the usual HTML header. Directories
- * are created on demand.
- */
- private PrintWriter openFile(String name, String title) throws IOException {
- System.out.println("Writing file \"" + name + "\"...");
-
- File file = new File(directory, name);
- File parent = file.getParentFile();
- parent.mkdirs();
-
- OutputStream stream = new BufferedOutputStream(new FileOutputStream(file));
- PrintWriter printer = new PrintWriter(stream);
-
- printer.println("<html>");
- printer.println(" <head>");
- printer.println(" <title>" + title + "</title>");
- printer.println(" <head>");
- printer.println(" <body>");
- printer.println(" <h1>" + title + "</h1>");
-
- return printer;
- }
-
- /**
- * Closes the given output file, writing the usual HTML footer before.
- */
- private void closeFile(PrintWriter printer) {
- printer.println(" </body>");
- printer.println("</html>");
-
- printer.flush();
- printer.close();
- }
-
- /**
- * Processes the whole list of classes that JavaDoc knows about.
- */
- private void process(RootDoc root) throws IOException {
- runtimeException = root.classNamed("java.lang.RuntimeException");
- error = root.classNamed("java.lang.Error");
-
- PrintWriter printer = openFile("index.html", "All packages");
-
- printer.println("Generated " + new Date().toString());
-
- Stats derived = new Stats(TYPE_ROOT, "All packages", null);
-
- printer.println(" <h2>Children</h2>");
- printer.println(" <table width=\"100%\">");
- printStatsHeader(printer);
-
- PackageDoc[] packages = root.specifiedPackages();
- Arrays.sort(packages, comparator);
- for (PackageDoc pack : packages) {
- if (pack.allClasses().length != 0 && !isHidden(pack)) {
- Stats subStats = processPackage(pack);
- printStats(printer, subStats, true);
- derived.add(subStats);
- }
- }
-
- printer.println(" </table>");
-
- printer.println(" <p>");
-
- printer.println(" <h2>Summary</h2>");
- printer.println(" <table width=\"100%\">");
- printStatsHeader(printer);
- printStats(printer, derived, false);
- printer.println(" </table>");
-
- closeFile(printer);
- }
-
- /**
- * Processes the details of a single package.
- */
- private Stats processPackage(PackageDoc pack) throws IOException {
- String file = getPackageDir(pack) + "/package.html";
- PrintWriter printer = openFile(file, "Package " + pack.name());
-
- Stats derived = new Stats(TYPE_PACKAGE, pack.name(), file);
-
- printer.println(" <h2>Elements</h2>");
- printer.println(" <table width=\"100%\">");
-
- printElementHeader(printer);
- processElement(printer, pack, TYPE_PACKAGE, derived);
-
- printer.println(" </table>");
-
- printer.println(" <p>");
-
- printer.println(" <h2>Children</h2>");
- printer.println(" <table width=\"100%\">");
-
- printStatsHeader(printer);
-
- ClassDoc[] classes = pack.allClasses();
- Arrays.sort(classes, comparator);
- for (ClassDoc clazz : classes) {
- if (!isHidden(clazz)) {
- Stats subStats = processClass(clazz);
- printStats(printer, subStats, true);
- derived.add(subStats);
- }
- }
-
- printer.println(" </table>");
-
- printer.println(" <h2>Summary</h2>");
- printer.println(" <table width=\"100%\">");
- printStatsHeader(printer);
- printStats(printer, derived, false);
- printer.println(" </table>");
-
- closeFile(printer);
-
- return derived;
- }
-
- /**
- * Processes the details of a single class.
- */
- private Stats processClass(ClassDoc clazz) throws IOException {
- String file = getPackageDir(clazz.containingPackage()) + "/" + clazz.name() + ".html";
- PrintWriter printer = openFile(file, "Class " + clazz.name());
-
- Stats derived = new Stats(TYPE_CLASS, clazz.name(), clazz.name() + ".html");
-
- printer.println(" <h2>Elements</h2>");
- printer.println(" <table width=\"100%\">");
-
- printElementHeader(printer);
-
- processElement(printer, clazz, TYPE_CLASS, derived);
-
- if(clazz.isEnum()){
- FieldDoc[] enums = clazz.enumConstants();
- Arrays.sort(enums, comparator);
- for(FieldDoc e : enums) {
- processElement(printer, e, TYPE_FIELD, derived);
- }
- }
-
- FieldDoc[] fields = clazz.fields();
- Arrays.sort(fields, comparator);
- for (FieldDoc field : fields) {
- processElement(printer, field, TYPE_FIELD, derived);
- }
-
- ConstructorDoc[] constructors = clazz.constructors();
- Arrays.sort(constructors, comparator);
- for (ConstructorDoc constructor : constructors) {
- if (constructor.position() != null) {
- String constPos = constructor.position().toString();
- String classPos = constructor.containingClass().position()
- .toString();
-
- if (!constPos.equals(classPos)) {
- processElement(printer, constructor, TYPE_METHOD, derived);
- }
- }
- }
-
- HashSet<MethodDoc> methodSet = new HashSet<MethodDoc>();
-
-
- ClassDoc superClass = clazz.superclass();
- MethodDoc[] methods = null;
- if (superClass != null && superClass.isPackagePrivate())
- {
- MethodDoc[] classMethods = clazz.methods();
- for (int i = 0; i < classMethods.length; i++) {
- methodSet.add(classMethods[i]);
- }
-
-
- while (superClass != null && superClass.isPackagePrivate()) {
- classMethods = superClass.methods();
- for (int i = 0; i < classMethods.length; i++) {
- methodSet.add(classMethods[i]);
- }
- superClass = superClass.superclass();
- }
-
- methods = new MethodDoc[methodSet.size()];
- methodSet.toArray(methods);
- }
- else
- {
- methods = clazz.methods();
- }
-
- Arrays.sort(methods, comparator);
- for (MethodDoc method : methods) {
- if (!(clazz.isEnum() && ("values".equals(method.name()) ||
- "valueOf".equals(method.name())))) {
- processElement(printer, method, TYPE_METHOD, derived);
- }
- }
-
- printer.println(" </table>");
-
- printer.println(" <p>");
-
- printer.println(" <h2>Summary</h2>");
- printer.println(" <table width=\"100%\">");
- printStatsHeader(printer);
- printStats(printer, derived, false);
- printer.println(" </table>");
-
- closeFile(printer);
-
- return derived;
- }
-
- /**
- * Processes a single element.
- */
- private void processElement(PrintWriter printer, Doc doc, int type, Stats derived) {
- if (isHidden(doc)) {
- return;
- }
-
- List<String> errors = new ArrayList<String>();
-
- boolean documented = isValidComment(doc.commentText());
- boolean inherited = false;
-
- if(checkTypeParameters && (doc.isClass() || doc.isInterface())){
- boolean typeParamsOk = hasAllTypeParameterDocs((ClassDoc)doc, errors);
- documented = documented && typeParamsOk;
- }
-
- if (doc.isMethod()) {
- MethodDoc method = (MethodDoc) doc;
-
- if ("".equals(method.commentText().trim())) {
- inherited = method.overriddenMethod() != null ||
- implementedMethod(method) != null;
- documented = inherited;
- }
- }
-
- if (!documented) {
- errors.add("Missing or insufficient doc.");
- }
-
- if (!inherited) {
- if (doc.isMethod() || doc.isConstructor()) {
- ExecutableMemberDoc executable = (ExecutableMemberDoc) doc;
- boolean paramsOk = hasAllParameterDocs(executable, errors);
- boolean exceptionsOk = hasAllExceptionDocs(executable, errors);
-
- documented = documented && paramsOk && exceptionsOk;
- }
-
- if (doc.isMethod()) {
- MethodDoc method = (MethodDoc) doc;
- boolean resultOk = hasReturnDoc(method, errors);
- documented = documented && resultOk;
- }
- }
-
- boolean reviewed = hasSinceTag(doc);
- Tag[] comments = doc.tags("cts");
-
- int status = getStatus(documented, reviewed || inherited, comments);
-
- printer.println(" <tr bgcolor=\"" + COLORS[status] + "\">");
- printer.println(" <td>" + TYPES[type] + "</td>");
-
- if (doc instanceof PackageDoc) {
- printer.println(" <td>" + doc.toString() + "</td>");
- } else {
- String s = doc.name();
- String t = doc.toString();
-
- int i = t.indexOf(s);
-
- if (i != -1) {
- t = t.substring(i);
- }
-
- printer.println(" <td>" + t + "</td>");
- }
-
- printer.println(" <td>" + getFirstSentence(doc) + "</td>");
- printer.println(" <td>" + (documented ? "Yes" : "No") + "</td>");
- printer.println(" <td>" + (reviewed ? "Yes" : "No") + "</td>");
- printer.println(" <td>");
-
- if (comments.length != 0 || errors.size() != 0) {
- printer.println(" </ul>");
-
- for (int i = 0; i < comments.length; i++) {
- printer.print(" <li>");
- printer.print(comments[i].text());
- printer.println("</li>");
- }
-
- for (int i = 0; i < errors.size(); i++) {
- printer.print(" <li>");
- printer.print(errors.get(i));
- printer.println("</li>");
- }
-
- printer.println(" </ul>");
- } else {
- printer.println(" ");
- }
-
- printer.println(" </td>");
- printer.println(" </tr>");
-
- derived.add(type, status, comments.length);
- }
-
- /**
- * Print the table header for an element table.
- */
- private void printElementHeader(PrintWriter printer) {
- printer.println(" <tr>");
- printer.println(" <td>Type</td>");
- printer.println(" <td>Name</td>");
- printer.println(" <td>First sentence</td>");
- printer.println(" <td>Doc'd</td>");
- printer.println(" <td>Rev'd</td>");
- printer.println(" <td>Comments</td>");
- printer.println(" </tr>");
- }
-
- /**
- * Print the table header for stats table table.
- */
- private void printStatsHeader(PrintWriter printer) {
- printer.println(" <tr>");
- printer.println(" <td>Type</td>");
- printer.println(" <td>Name</td>");
- printer.println(" <td>#Classes</td>");
- printer.println(" <td>#Fields</td>");
- printer.println(" <td>#Methods</td>");
- printer.println(" <td>#Red</td>");
- printer.println(" <td>#Yellow</td>");
- printer.println(" <td>#Green</td>");
- printer.println(" <td>#Comments</td>");
- printer.println(" </tr>");
- }
-
- /**
- * Prints a single row to a stats table.
- */
- private void printStats(PrintWriter printer, Stats info, boolean wantLink) {
- printer.println(" <tr bgcolor=\"" + COLORS[info.getValue()] + "\">");
- printer.println(" <td>" + TYPES[info.getType()] + "</td>");
-
- printer.print(" <td>");
- String link = info.getLink();
- if (wantLink && link != null) {
- printer.print("<a href=\"" + link + "\">" + info.getName() + "</a>");
- } else {
- printer.print(info.getName());
- }
- printer.println("</td>");
-
- printer.println(" <td>" + info.getNumbersPerType(TYPE_CLASS) + "</td>");
- printer.println(" <td>" + info.getNumbersPerType(TYPE_FIELD) + "</td>");
- printer.println(" <td>" + info.getNumbersPerType(TYPE_METHOD) + "</td>");
- printer.println(" <td>" + info.getNumbersPerValue(VALUE_RED) + "</td>");
- printer.println(" <td>" + info.getNumbersPerValue(VALUE_YELLOW) + "</td>");
- printer.println(" <td>" + info.getNumbersPerValue(VALUE_GREEN) + "</td>");
- printer.println(" <td>" + info.getNumberOfComments() + "</td>");
- printer.println(" </tr>");
- }
-
- /**
- * Returns the directory for a given package. Basically converts embedded
- * dots in the name into slashes.
- */
- private File getPackageDir(PackageDoc pack) {
- if (pack == null || pack.name() == null || "".equals(pack.name())) {
- return new File(".");
- } else {
- return new File(pack.name().replace('.', '/'));
- }
- }
-
- /**
- * Checks whether the given comment is not null and not of length 0.
- */
- private boolean isValidComment(String comment) {
- return comment != null && comment.length() > 0;
- }
-
- /**
- * Checks whether the given interface or class has documentation for
- * all declared type parameters (no less, no more).
- */
- private boolean hasAllTypeParameterDocs(ClassDoc doc, List<String> errors) {
- boolean result = true;
-
- TypeVariable[] params = doc.typeParameters();
- Set<String> paramsSet = new HashSet<String>();
- for (TypeVariable param : params) {
- paramsSet.add(param.typeName());
- }
-
- ParamTag[] paramTags = doc.typeParamTags();
- Map<String, String> paramTagsMap = new HashMap<String, String>();
- for (ParamTag paramTag : paramTags) {
- if (!paramsSet.contains(paramTag.parameterName())) {
- errors.add("Unknown type parameter \"" + paramTag.parameterName() + "\"");
- result = false;
- }
- paramTagsMap.put(paramTag.parameterName(), paramTag.parameterComment());
- }
-
- for (TypeVariable param : params) {
- if (!isValidComment(paramTagsMap.get(param.typeName()))) {
- errors.add("Undocumented type parameter \"" + param.typeName() + "\"");
- result = false;
- }
- }
-
- return result;
- }
-
- /**
- * Checks whether the given executable member has documentation for
- * all declared parameters (no less, no more).
- */
- private boolean hasAllParameterDocs(ExecutableMemberDoc doc, List<String> errors) {
- boolean result = true;
-
- Parameter params[] = doc.parameters();
- Set<String> paramsSet = new HashSet<String>();
- for (int i = 0; i < params.length; i++) {
- Parameter param = params[i];
- paramsSet.add(param.name());
- }
-
- ParamTag[] paramTags = doc.paramTags();
- Map<String, String> paramTagsMap = new HashMap<String, String>();
- for (int i = 0; i < paramTags.length; i++) {
- ParamTag paramTag = paramTags[i];
-
- if (!paramsSet.contains(paramTag.parameterName())) {
- errors.add("Unknown parameter \"" + paramTag.parameterName() + "\"");
- result = false;
- }
-
- paramTagsMap.put(paramTag.parameterName(), paramTag.parameterComment());
- }
-
- for (int i = 0; i < params.length; i++) {
- Parameter param = params[i];
-
- if (!isValidComment(paramTagsMap.get(param.name()))) {
- errors.add("Undocumented parameter \"" + param.name() + "\"");
- result = false;
- }
- }
-
- return result;
- }
-
- /**
- * Checks whether the given executable member has documentation for
- * all non-runtime exceptions. Runtime exceptions may or may not be
- * documented.
- */
- private boolean hasAllExceptionDocs(ExecutableMemberDoc doc, List<String> errors) {
- boolean result = true;
-
- ClassDoc exceptions[] = doc.thrownExceptions();
- Set<ClassDoc> exceptionSet = new HashSet<ClassDoc>();
- for (int i = 0; i < exceptions.length; i++) {
- ClassDoc exception = exceptions[i];
- if (isRelevantException(exception)) {
- exceptionSet.add(exception);
- }
- }
-
- ThrowsTag[] throwsTags = doc.throwsTags();
- Map<ClassDoc, String> throwsTagsMap = new HashMap<ClassDoc, String>();
- for (int i = 0; i < throwsTags.length; i++) {
- ThrowsTag throwsTag = throwsTags[i];
-
- if (throwsTag.exception() == null) {
- errors.add("Unknown exception \"" + throwsTag.exceptionName() + "\"");
- result = false;
- } else if (isRelevantException(throwsTag.exception())) {
-
- ClassDoc exception = throwsTag.exception();
- while (exception != null && !exceptionSet.contains(exception)) {
- exception = exception.superclass();
- }
- if (exception == null) {
- errors.add("Unknown exception \"" + throwsTag.exceptionName() + "\"");
- result = false;
- }
- }
-
- throwsTagsMap.put(throwsTag.exception(), throwsTag.exceptionComment());
- }
-
- for (int i = 0; i < exceptions.length; i++) {
- ClassDoc exception = exceptions[i];
- boolean found = false;
-
- for (int j = 0; j < throwsTags.length && !found; j++) {
- ThrowsTag throwsTag = throwsTags[j];
-
- ClassDoc candidate = throwsTag.exception();
- if (candidate != null) {
- if (candidate.equals(exception) || candidate.subclassOf(exception)) {
- if (isValidComment(throwsTag.exceptionComment())) {
- found = true;
- }
- }
- }
- }
-
- if (!found) {
- errors.add("Undocumented exception \"" + exception.name() + "\"");
- result = false;
- }
- }
-
- return result;
- }
-
- /**
- * Checks whether an exception needs to be documented. Runtime exceptions
- * and errors don't necessarily need documentation (although it doesn't
- * hurt to have it).
- */
- private boolean isRelevantException(ClassDoc clazz) {
- return !(clazz.subclassOf(runtimeException) || clazz.subclassOf(error));
- }
-
- /**
- * Checks whether the given method has documentation for the return value.
- */
- private boolean hasReturnDoc(MethodDoc method, List<String> errors) {
- boolean result = true;
-
- if (!"void".equals(method.returnType().typeName())) {
- Tag[] returnTags = method.tags("return");
-
- if (returnTags.length == 0) {
- errors.add("Missing result.");
- result = false;
- }
-
- for (int i = 0; i < returnTags.length; i++) {
- Tag tag = returnTags[i];
- if (!isValidComment(tag.text())) {
- errors.add("Insufficient result.");
- result = false;
- }
- }
- } else {
- Tag[] returnTags = method.tags("return");
- if (returnTags.length != 0) {
- errors.add("Unknown result.");
- result = false;
- }
- }
-
- return result;
- }
-
- /**
- * Returns the first sentence for the given documentation element.
- */
- private String getFirstSentence(Doc doc) {
- StringBuilder builder = new StringBuilder();
-
- Tag[] tags = doc.firstSentenceTags();
- for (int i = 0; i < tags.length; i++) {
- Tag tag = tags[i];
-
- if ("Text".equals(tag.kind())) {
- builder.append(tag.text());
- } else {
- builder.append("{" + tag.toString() + "}");
- }
- }
-
- return builder.toString();
- }
-
- /**
- * Returns the interface method that a given method implements, or null if
- * the method does not implement any interface method.
- */
- private MethodDoc implementedMethod(MethodDoc doc) {
- ClassDoc clazz = doc.containingClass();
- MethodDoc myDoc = null;
- while(clazz != null && myDoc == null){
- ClassDoc[] interfaces = clazz.interfaces();
- myDoc = implementedMethod0(doc, interfaces);
- clazz = clazz.superclass();
- }
- return myDoc;
- }
-
- /**
- * Recursive helper method for finding out which interface method a given
- * method implements.
- */
- private MethodDoc implementedMethod0(MethodDoc doc, ClassDoc[] interfaces) {
- for (int i = 0; i < interfaces.length; i++) {
- ClassDoc classDoc = interfaces[i];
-
- MethodDoc[] methods = classDoc.methods();
- for (int j = 0; j < methods.length; j++) {
- MethodDoc methodDoc = methods[j];
- if (doc.overrides(methodDoc)) {
- return methodDoc;
- }
- }
- }
-
- for (int i = 0; i < interfaces.length; i++) {
- MethodDoc myDoc = implementedMethod0(doc, interfaces[i].interfaces());
- if (myDoc != null) {
- return myDoc;
- }
- }
-
- return null;
- }
-
- /**
- * Checks whether the given documentation element has a "@since" tag for
- * Android.
- */
- private boolean hasSinceTag(Doc doc) {
- Tag[] tags = doc.tags("since");
-
- for (int i = 0; i < tags.length; i++) {
- if ("Android 1.0".equals(tags[i].text())) {
- return true;
- }
- }
-
- if (doc instanceof MemberDoc) {
- return hasSinceTag(((MemberDoc)doc).containingClass());
- }
-
- if (doc instanceof ClassDoc) {
- return hasSinceTag(((ClassDoc)doc).containingPackage());
- }
-
- return false;
- }
-
- /**
- * Checks whether the given documentation element has a "@hide" tag that
- * excludes it from the official API.
- */
- private boolean isHidden(Doc doc) {
- Tag[] tags = doc.tags("hide");
-
- return tags != null && tags.length != 0;
- }
-
- /**
- * Determines the status of an element based on the existence of
- * documentation, the review status, and any comments it might have.
- */
- private int getStatus(boolean documented, boolean reviewed, Tag[] comments) {
- if (!documented) {
- return VALUE_RED;
- } else if (reviewed && comments.length == 0) {
- return VALUE_GREEN;
- } else {
- return VALUE_YELLOW;
- }
- }
-
- /**
- * Called by JavaDoc to find our which command line arguments are supported
- * and how many parameters they take. Part of the JavaDoc API.
- */
- public static int optionLength(String option) {
- if ("-d".equals(option)) {
- return 2;
- } else if("-Xgeneric".equals(option)){
- return 1;
- } else {
- return 0;
- }
- }
-
- /**
- * Returns a particular command line argument for a given option.
- */
- private static String getOption(RootDoc root, String option, int index, String defValue) {
- String[][] allOptions = root.options();
- for (int i = 0; i < allOptions.length; i++) {
- if (allOptions[i][0].equals(option)) {
- return allOptions[i][index];
- }
- }
-
- return defValue;
- }
-
- /**
- * Returns whether the specified option is present.
- */
- private static boolean isOptionSet(RootDoc root, String option){
- String[][] allOptions = root.options();
- for (int i = 0; i < allOptions.length; i++) {
- if (allOptions[i][0].equals(option)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Called by JavaDoc to find out which Java version we claim to support.
- * Part of the JavaDoc API.
- */
- public static LanguageVersion languageVersion() {
- return LanguageVersion.JAVA_1_5;
- }
-
- /**
- * The main entry point called by JavaDoc after all required information has
- * been collected. Part of the JavaDoc API.
- */
- public static boolean start(RootDoc root) {
- try {
- String target = getOption(root, "-d", 1, ".");
- checkTypeParameters = isOptionSet(root, "-Xgeneric");
-
- SpecProgressDoclet doclet = new SpecProgressDoclet(target);
- doclet.process(root);
-
- File file = new File(target, "index.html");
- System.out.println("Please see complete report in " +
- file.getAbsolutePath());
-
- } catch (Exception ex) {
- ex.printStackTrace();
- return false;
- }
-
- return true;
- }
-
-}
diff --git a/tools/utils/buildCts.py b/tools/utils/buildCts.py
index 7d4b6e0..4daf48e 100755
--- a/tools/utils/buildCts.py
+++ b/tools/utils/buildCts.py
@@ -23,7 +23,7 @@
import sys
import xml.dom.minidom as dom
from cts import tools
-
+from multiprocessing import Pool
def GetSubDirectories(root):
"""Return all directories under the given root directory."""
@@ -72,174 +72,24 @@
self.test_repository = os.path.join(self.out_dir, 'repository/testcases')
self.plan_repository = os.path.join(self.out_dir, 'repository/plans')
- def __LogGenerateDescription(self, name):
- print 'Generating test description for package %s' % name
-
- def RunDescriptionGeneratorDoclet(self, source_root, output_file):
- """Generate a test package description by running the DescriptionGenerator doclet.
-
- Args:
- source_root: Directory under which tests should be searched.
- output_file: Name of the file where the description gets written.
-
- Returns:
- The exit code of the DescriptionGenerator doclet run.
- """
- # Make sure sourceRoot is relative to self.android_root
- source_root = self.RelPath(source_root, self.android_root)
-
- # To determine whether a class is a JUnit test, the Doclet needs to have all intermediate
- # subclasses of TestCase as well as the JUnit framework itself on the source path.
- # Annotation classes are also required, since test annotations go into the description.
- source_path = [
- 'frameworks/base/core/java', # android test classes
- 'frameworks/base/test-runner/src', # test runner
- '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
- ]
- source_path = [os.path.join(self.android_root, x) for x in source_path]
- cmd = ('javadoc -o %s -J-Xmx512m -quiet -doclet DescriptionGenerator -docletpath %s'
- ' -sourcepath %s ') % (output_file, self.doclet_path, ':'.join(source_path))
- sources = []
-
- def AddFile(sources, folder, names):
- """Find *.java."""
- sources.extend([os.path.join(folder, name) for name in names if name.endswith('.java')])
-
- os.path.walk(os.path.join(self.android_root, source_root), AddFile, sources)
- cmd += ' '.join(sources)
- proc = subprocess.Popen(cmd, shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE)
- # read and discard any output
- proc.communicate()
- # wait for process to terminate and return exit value
- return proc.wait()
-
- def GenerateSignatureCheckDescription(self):
- """Generate the test description for the signature check."""
- self.__LogGenerateDescription('android.tests.sigtest')
- package = tools.TestPackage('SignatureTest', 'android.tests.sigtest')
- package.AddAttribute('appNameSpace', 'android.tests.sigtest')
- package.AddAttribute('signatureCheck', 'true')
- package.AddAttribute('runner', '.InstrumentationRunner')
- package.AddTest('android.tests.sigtest.SignatureTest.signatureTest')
- description = open(os.path.join(self.test_repository, 'SignatureTest.xml'), 'w')
- package.WriteDescription(description)
- description.close()
-
- def GenerateReferenceAppDescription(self):
- """Generate the test description for the reference app tests."""
- self.__LogGenerateDescription('android.apidemos.cts')
- package = tools.TestPackage('ApiDemosReferenceTest', 'android.apidemos.cts')
- package.AddAttribute('appNameSpace', 'android.apidemos.cts')
- package.AddAttribute('packageToTest', 'com.example.android.apis')
- package.AddAttribute('apkToTestName', 'ApiDemos')
- package.AddAttribute('runner', 'android.test.InstrumentationTestRunner')
- package.AddAttribute('referenceAppTest', 'true')
- package.AddTest('android.apidemos.cts.ApiDemosTest.testNumberOfItemsInListView')
- description = open(os.path.join(self.test_repository, 'ApiDemosReferenceTest.xml'), 'w')
- package.WriteDescription(description)
- description.close()
-
- def GenerateAppSecurityDescription(self):
- """Generate the test description for the application security tests."""
- test_root = 'cts/tests/appsecurity-tests'
- makefile_name = os.path.join(test_root, 'Android.mk')
- makefile_vars = GetMakeFileVars(makefile_name)
- name = makefile_vars['LOCAL_MODULE']
- package_name = 'android.tests.appsecurity'
- self.__LogGenerateDescription(package_name)
- temp_desc = os.path.join(self.temp_dir, 'description.xml')
- self.RunDescriptionGeneratorDoclet(os.path.join(test_root, 'src'), temp_desc)
- doc = dom.parse(temp_desc)
- test_description = doc.getElementsByTagName('TestPackage')[0]
- test_description.setAttribute('name', package_name)
- test_description.setAttribute('appPackageName', package_name)
- test_description.setAttribute('hostSideOnly', 'true')
- test_description.setAttribute('jarPath', name + '.jar')
- description = open(os.path.join(self.test_repository, package_name + '.xml'), 'w')
- doc.writexml(description, addindent=' ', encoding='UTF-8')
- description.close()
-
- @staticmethod
- def RelPath(path, start=os.getcwd()):
- """Get a relative version of a path.
-
- This is equivalent to os.path.relpath, which is only available since Python 2.6.
-
- Args:
- path: The path to transform.
- start: The base path. Defaults to the current working directory.
-
- Returns:
- A transformed path that is relative to start.
- """
- path_dirs = os.path.abspath(path).split(os.path.sep)
- start_dirs = os.path.abspath(start).split(os.path.sep)
-
- num_common = len(os.path.commonprefix([start_dirs, path_dirs]))
-
- result_dirs = ['..'] * (len(start_dirs) - num_common) + path_dirs[num_common:]
- if result_dirs:
- return os.path.join(*result_dirs)
- return start
-
def GenerateTestDescriptions(self):
"""Generate test descriptions for all packages."""
+ pool = Pool(processes=16)
+
# individually generate descriptions not following conventions
- self.GenerateSignatureCheckDescription()
- self.GenerateReferenceAppDescription()
- self.GenerateAppSecurityDescription()
+ pool.apply_async(GenerateSignatureCheckDescription, [self.test_repository])
+ pool.apply_async(GenerateReferenceAppDescription, [self.test_repository])
+ pool.apply_async(GenerateAppSecurityDescription, [self.temp_dir,
+ self.test_repository, self.android_root, self.doclet_path])
# generate test descriptions for android tests
android_packages = GetSubDirectories(self.test_root)
for package in android_packages:
- app_package_name = 'android.' + package
- package_root = os.path.join(self.test_root, package)
+ pool.apply_async(GenerateTestDescription, [self.test_root, self.temp_dir,
+ self.test_repository, self.android_root, self.doclet_path, package])
- makefile_name = os.path.join(package_root, 'Android.mk')
- if not os.path.exists(makefile_name):
- print 'Skipping directory "%s" due to missing Android.mk' % package_root
- continue
- makefile_vars = GetMakeFileVars(makefile_name)
-
- manifest_name = os.path.join(package_root, 'AndroidManifest.xml')
- if not os.path.exists(manifest_name):
- print 'Skipping directory "%s" due to missing AndroidManifest.xml' % package_root
- continue
- manifest = tools.XmlFile(manifest_name)
-
- self.__LogGenerateDescription(app_package_name)
-
- # Run the description generator doclet to get the test package structure
- # TODO: The Doclet does not currently add all required attributes. Instead of rewriting
- # the document below, additional attributes should be passed to the Doclet as arguments.
- temp_desc = os.path.join(self.temp_dir, 'description.xml')
- self.RunDescriptionGeneratorDoclet(package_root, temp_desc)
-
- # obtain missing attribute values from the makefile and manifest
- package_name = makefile_vars['LOCAL_PACKAGE_NAME']
- runner = manifest.GetAndroidAttr('instrumentation', 'name')
- target_package = manifest.GetAndroidAttr('instrumentation', 'targetPackage')
- target_binary_name = makefile_vars.get('LOCAL_INSTRUMENTATION_FOR')
-
- # add them to the document
- doc = dom.parse(temp_desc)
- test_description = doc.getElementsByTagName('TestPackage')[0]
- test_description.setAttribute('name', package_name)
- test_description.setAttribute('runner', runner)
- test_package = manifest.GetAttr('manifest', 'package')
- test_description.setAttribute('appNameSpace', test_package)
- test_description.setAttribute('appPackageName', app_package_name)
- if not test_package == target_package:
- test_description.setAttribute('targetNameSpace', target_package)
- test_description.setAttribute('targetBinaryName', target_binary_name)
- description = open(os.path.join(self.test_repository, package_name + '.xml'), 'w')
- doc.writexml(description, addindent=' ', encoding='UTF-8')
- description.close()
+ pool.close()
+ pool.join()
def __WritePlan(self, plan, plan_name):
print 'Generating test plan %s' % plan_name
@@ -286,6 +136,170 @@
plan.Include(r'android\.tests\.appsecurity')
self.__WritePlan(plan, 'AppSecurity')
+def LogGenerateDescription(name):
+ print 'Generating test description for package %s' % name
+
+def GenerateSignatureCheckDescription(test_repository):
+ """Generate the test description for the signature check."""
+ LogGenerateDescription('android.tests.sigtest')
+ package = tools.TestPackage('SignatureTest', 'android.tests.sigtest')
+ package.AddAttribute('appNameSpace', 'android.tests.sigtest')
+ package.AddAttribute('signatureCheck', 'true')
+ package.AddAttribute('runner', '.InstrumentationRunner')
+ package.AddTest('android.tests.sigtest.SignatureTest.signatureTest')
+ description = open(os.path.join(test_repository, 'SignatureTest.xml'), 'w')
+ package.WriteDescription(description)
+ description.close()
+
+def GenerateReferenceAppDescription(test_repository):
+ """Generate the test description for the reference app tests."""
+ LogGenerateDescription('android.apidemos.cts')
+ package = tools.TestPackage('ApiDemosReferenceTest', 'android.apidemos.cts')
+ package.AddAttribute('appNameSpace', 'android.apidemos.cts')
+ package.AddAttribute('packageToTest', 'com.example.android.apis')
+ package.AddAttribute('apkToTestName', 'ApiDemos')
+ package.AddAttribute('runner', 'android.test.InstrumentationTestRunner')
+ package.AddAttribute('referenceAppTest', 'true')
+ package.AddTest('android.apidemos.cts.ApiDemosTest.testNumberOfItemsInListView')
+ description = open(os.path.join(test_repository, 'ApiDemosReferenceTest.xml'), 'w')
+ package.WriteDescription(description)
+ description.close()
+
+def GenerateAppSecurityDescription(temp_dir, test_repository, android_root, doclet_path):
+ """Generate the test description for the application security tests."""
+ test_root = 'cts/tests/appsecurity-tests'
+ makefile_name = os.path.join(test_root, 'Android.mk')
+ makefile_vars = GetMakeFileVars(makefile_name)
+ name = makefile_vars['LOCAL_MODULE']
+ package_name = 'android.tests.appsecurity'
+ LogGenerateDescription(package_name)
+ temp_desc = os.path.join(temp_dir, 'description.xml')
+ RunDescriptionGeneratorDoclet(android_root, doclet_path,
+ os.path.join(test_root, 'src'), temp_desc)
+ doc = dom.parse(temp_desc)
+ test_description = doc.getElementsByTagName('TestPackage')[0]
+ test_description.setAttribute('name', package_name)
+ test_description.setAttribute('appPackageName', package_name)
+ test_description.setAttribute('hostSideOnly', 'true')
+ test_description.setAttribute('jarPath', name + '.jar')
+ description = open(os.path.join(test_repository, package_name + '.xml'), 'w')
+ doc.writexml(description, addindent=' ', encoding='UTF-8')
+ description.close()
+
+
+def GenerateTestDescription(test_root, temp_dir, test_repository, android_root,
+ doclet_path, package):
+
+ app_package_name = 'android.' + package
+ package_root = os.path.join(test_root, package)
+
+ makefile_name = os.path.join(package_root, 'Android.mk')
+ if not os.path.exists(makefile_name):
+ print 'Skipping directory "%s" due to missing Android.mk' % package_root
+ return
+ makefile_vars = GetMakeFileVars(makefile_name)
+
+ manifest_name = os.path.join(package_root, 'AndroidManifest.xml')
+ if not os.path.exists(manifest_name):
+ print 'Skipping directory "%s" due to missing AndroidManifest.xml' % package_root
+ return
+ manifest = tools.XmlFile(manifest_name)
+
+ LogGenerateDescription(app_package_name)
+
+ # Run the description generator doclet to get the test package structure
+ # TODO: The Doclet does not currently add all required attributes. Instead of rewriting
+ # the document below, additional attributes should be passed to the Doclet as arguments.
+ temp_desc = os.path.join(temp_dir, app_package_name + '-description.xml')
+
+ RunDescriptionGeneratorDoclet(android_root, doclet_path, package_root, temp_desc)
+
+ # obtain missing attribute values from the makefile and manifest
+ package_name = makefile_vars['LOCAL_PACKAGE_NAME']
+ runner = manifest.GetAndroidAttr('instrumentation', 'name')
+ target_package = manifest.GetAndroidAttr('instrumentation', 'targetPackage')
+ target_binary_name = makefile_vars.get('LOCAL_INSTRUMENTATION_FOR')
+
+ # add them to the document
+ doc = dom.parse(temp_desc)
+ test_description = doc.getElementsByTagName('TestPackage')[0]
+ test_description.setAttribute('name', package_name)
+ test_description.setAttribute('runner', runner)
+ test_package = manifest.GetAttr('manifest', 'package')
+ test_description.setAttribute('appNameSpace', test_package)
+ test_description.setAttribute('appPackageName', app_package_name)
+ if not test_package == target_package:
+ test_description.setAttribute('targetNameSpace', target_package)
+ test_description.setAttribute('targetBinaryName', target_binary_name)
+ description = open(os.path.join(test_repository, package_name + '.xml'), 'w')
+ doc.writexml(description, addindent=' ', encoding='UTF-8')
+ description.close()
+
+def RunDescriptionGeneratorDoclet(android_root, doclet_path, source_root, output_file):
+ """Generate a test package description by running the DescriptionGenerator doclet.
+
+ Args:
+ android_root: Root directory of the Android source tree.
+ doclet_path: Class path where the DescriptionGenerator doclet can be found.
+ source_root: Directory under which tests should be searched.
+ output_file: Name of the file where the description gets written.
+
+ Returns:
+ The exit code of the DescriptionGenerator doclet run.
+ """
+ # Make sure sourceRoot is relative to self.android_root
+ source_root = RelPath(source_root, android_root)
+
+ # To determine whether a class is a JUnit test, the Doclet needs to have all intermediate
+ # subclasses of TestCase as well as the JUnit framework itself on the source path.
+ # Annotation classes are also required, since test annotations go into the description.
+ source_path = [
+ 'frameworks/base/core/java', # android test classes
+ 'frameworks/base/test-runner/src', # test runner
+ 'libcore/junit/src/main/java', # junit classes
+ 'development/tools/hosttestlib/src', # hosttestlib TestCase extensions
+ 'libcore/dalvik/src/main/java', # test annotations
+ 'cts/tests/src', # cts test stubs
+ source_root # the source for this package
+ ]
+ source_path = [os.path.join(android_root, x) for x in source_path]
+ cmd = ('javadoc -o %s -J-Xmx512m -quiet -doclet DescriptionGenerator -docletpath %s'
+ ' -sourcepath %s ') % (output_file, doclet_path, ':'.join(source_path))
+ sources = []
+
+ def AddFile(sources, folder, names):
+ """Find *.java."""
+ sources.extend([os.path.join(folder, name) for name in names if name.endswith('.java')])
+
+ os.path.walk(os.path.join(android_root, source_root), AddFile, sources)
+ cmd += ' '.join(sources)
+ proc = subprocess.Popen(cmd, shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE)
+ # read and discard any output
+ proc.communicate()
+ # wait for process to terminate and return exit value
+ return proc.wait()
+
+def RelPath(path, start=os.getcwd()):
+ """Get a relative version of a path.
+
+ This is equivalent to os.path.relpath, which is only available since Python 2.6.
+
+ Args:
+ path: The path to transform.
+ start: The base path. Defaults to the current working directory.
+
+ Returns:
+ A transformed path that is relative to start.
+ """
+ path_dirs = os.path.abspath(path).split(os.path.sep)
+ start_dirs = os.path.abspath(start).split(os.path.sep)
+
+ num_common = len(os.path.commonprefix([start_dirs, path_dirs]))
+
+ result_dirs = ['..'] * (len(start_dirs) - num_common) + path_dirs[num_common:]
+ if result_dirs:
+ return os.path.join(*result_dirs)
+ return start
if __name__ == '__main__':
builder = CtsBuilder(sys.argv)
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.