Update Signature tests
bug: 17327088
Change-Id: I11a49492ffcb44945d4ca0de6c370e7707a1423b
diff --git a/CtsTestCaseList.mk b/CtsTestCaseList.mk
index a08c34f..ebbf8c4 100644
--- a/CtsTestCaseList.mk
+++ b/CtsTestCaseList.mk
@@ -43,7 +43,6 @@
CtsProfileOwnerApp \
CtsSomeAccessibilityServices \
CtsThemeDeviceApp \
- SignatureTest \
TestDeviceSetup \
CtsUiAutomatorApp \
CtsUsbSerialTestApp \
@@ -113,6 +112,7 @@
CtsRsCppTestCases \
CtsSaxTestCases \
CtsSecurityTestCases \
+ CtsSignatureTestCases \
CtsSpeechTestCases \
CtsTelephonyTestCases \
CtsTextTestCases \
diff --git a/development/ide/eclipse/.classpath b/development/ide/eclipse/.classpath
index fafcc32..98939ba 100644
--- a/development/ide/eclipse/.classpath
+++ b/development/ide/eclipse/.classpath
@@ -1,101 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="lib" path="prebuilts/misc/common/ddmlib/ddmlib-prebuilt.jar"/>
- <classpathentry kind="lib" path="prebuilts/misc/common/tradefed/tradefed-prebuilt.jar"/>
- <classpathentry kind="src" path="cts/apps/CtsVerifier/src"/>
- <classpathentry kind="src" path="cts/hostsidetests/appsecurity/src"/>
- <classpathentry kind="src" path="cts/hostsidetests/appsecurity/test-apps/AppWithData/src"/>
- <classpathentry kind="src" path="cts/hostsidetests/monkey/src"/>
- <classpathentry kind="src" path="cts/hostsidetests/monkey/test-apps/CtsMonkeyApp/src"/>
- <classpathentry kind="src" path="cts/hostsidetests/monkey/test-apps/CtsMonkeyApp2/src"/>
- <classpathentry kind="src" path="cts/hostsidetests/sample/src"/>
- <classpathentry kind="src" path="cts/hostsidetests/sample/app/src"/>
- <classpathentry kind="src" path="cts/hostsidetests/theme/src"/>
- <classpathentry kind="src" path="cts/hostsidetests/theme/app/src"/>
- <classpathentry kind="src" path="cts/hostsidetests/usb/src"/>
- <classpathentry kind="src" path="cts/libs/vogar-expect/src"/>
- <classpathentry kind="src" path="cts/libs/commonutil/src"/>
- <classpathentry kind="src" path="cts/libs/deviceutil/src"/>
- <classpathentry kind="src" path="cts/libs/json/src"/>
- <classpathentry kind="src" path="cts/libs/testserver/src"/>
- <classpathentry kind="src" path="cts/libs/wrappedgtest/src"/>
- <classpathentry kind="src" path="cts/suite/cts/deviceTests/browserbench/src"/>
- <classpathentry kind="src" path="cts/suite/cts/deviceTests/dram/src"/>
- <classpathentry kind="src" path="cts/suite/cts/deviceTests/filesystemperf/src"/>
- <classpathentry kind="src" path="cts/suite/cts/deviceTests/opengl/src"/>
- <classpathentry kind="src" path="cts/suite/cts/deviceTests/simplecpu/src"/>
- <classpathentry kind="src" path="cts/suite/cts/deviceTests/ui/src"/>
- <classpathentry kind="src" path="cts/suite/cts/deviceTests/videoperf/src"/>
- <classpathentry kind="src" path="cts/suite/cts/hostTests/jank/app/src"/>
- <classpathentry kind="src" path="cts/suite/cts/hostTests/jank/src"/>
- <classpathentry kind="src" path="cts/suite/cts/hostTests/uihost/appA/src"/>
- <classpathentry kind="src" path="cts/suite/cts/hostTests/uihost/appB/src"/>
- <classpathentry kind="src" path="cts/suite/cts/hostTests/uihost/control/src"/>
- <classpathentry kind="src" path="cts/suite/cts/hostTests/uihost/src"/>
- <classpathentry kind="src" path="cts/tests/ProcessTest/src"/>
- <classpathentry kind="src" path="cts/tests/ProcessTest/NoShareUidApp/src"/>
- <classpathentry kind="src" path="cts/tests/ProcessTest/ShareUidApp/src"/>
- <classpathentry kind="src" path="cts/tests/SignatureTest/src"/>
- <classpathentry kind="src" path="cts/tests/SignatureTest/tests/src"/>
- <classpathentry kind="src" path="cts/tests/acceleration/src"/>
- <classpathentry kind="src" path="cts/tests/core/runner/src"/>
- <classpathentry kind="src" path="cts/tests/deviceadmin/src"/>
- <classpathentry kind="src" path="cts/tests/sample/src"/>
- <classpathentry kind="src" path="cts/tests/src"/>
- <classpathentry kind="src" path="cts/tests/tests/acceleration/src"/>
- <classpathentry kind="src" path="cts/tests/tests/accessibility/src"/>
- <classpathentry kind="src" path="cts/tests/tests/accessibilityservice/src"/>
- <classpathentry kind="src" path="cts/tests/tests/accounts/src"/>
- <classpathentry kind="src" path="cts/tests/tests/admin/src"/>
- <classpathentry kind="src" path="cts/tests/tests/animation/src"/>
- <classpathentry kind="src" path="cts/tests/tests/app/src"/>
- <classpathentry kind="src" path="cts/tests/tests/bluetooth/src"/>
- <classpathentry kind="src" path="cts/tests/tests/content/src"/>
- <classpathentry kind="src" path="cts/tests/tests/database/src"/>
- <classpathentry kind="src" path="cts/tests/tests/dpi/src"/>
- <classpathentry kind="src" path="cts/tests/tests/dpi2/src"/>
- <classpathentry kind="src" path="cts/tests/tests/drm/src"/>
- <classpathentry kind="src" path="cts/tests/tests/gesture/src"/>
- <classpathentry kind="src" path="cts/tests/tests/graphics/src"/>
- <classpathentry kind="src" path="cts/tests/tests/graphics2/src"/>
- <classpathentry kind="src" path="cts/tests/tests/hardware/src"/>
- <classpathentry kind="src" path="cts/tests/tests/jni/src"/>
- <classpathentry kind="src" path="cts/tests/tests/location/src"/>
- <classpathentry kind="src" path="cts/tests/tests/media/src"/>
- <classpathentry kind="src" path="cts/tests/tests/mediastress/src"/>
- <classpathentry kind="src" path="cts/tests/tests/net/src"/>
- <classpathentry kind="src" path="cts/tests/tests/opengl/src"/>
- <classpathentry kind="src" path="cts/tests/tests/openglperf/src"/>
- <classpathentry kind="src" path="cts/tests/tests/os/src"/>
- <classpathentry kind="src" path="cts/tests/tests/permission/src"/>
- <classpathentry kind="src" path="cts/tests/tests/permission2/src"/>
- <classpathentry kind="src" path="cts/tests/tests/preference/src"/>
- <classpathentry kind="src" path="cts/tests/tests/preference2/src"/>
- <classpathentry kind="src" path="cts/tests/tests/provider/src"/>
- <classpathentry kind="src" path="cts/tests/tests/renderscript/src"/>
- <classpathentry kind="src" path="cts/tests/tests/security/src"/>
- <classpathentry kind="src" path="cts/tests/tests/speech/src"/>
- <classpathentry kind="src" path="cts/tests/tests/telephony/src"/>
- <classpathentry kind="src" path="cts/tests/tests/text/src"/>
- <classpathentry kind="src" path="cts/tests/tests/textureview/src"/>
- <classpathentry kind="src" path="cts/tests/tests/util/src"/>
- <classpathentry kind="src" path="cts/tests/tests/view/src"/>
- <classpathentry kind="src" path="cts/tests/tests/webkit/src"/>
- <classpathentry kind="src" path="cts/tests/tests/widget/src"/>
- <classpathentry kind="src" path="cts/tools/cts-api-coverage/src"/>
- <classpathentry kind="src" path="cts/tools/cts-java-scanner/src"/>
- <classpathentry kind="src" path="cts/tools/cts-java-scanner-doclet/src"/>
- <classpathentry kind="src" path="cts/tools/cts-native-scanner/src"/>
- <classpathentry kind="src" path="cts/tools/cts-reference-app-lib/src"/>
- <classpathentry kind="src" path="cts/tools/cts-xml-generator/src"/>
- <classpathentry kind="src" path="cts/tools/dasm/src"/>
- <classpathentry kind="src" path="cts/tools/device-setup/TestDeviceSetup/src"/>
- <classpathentry kind="src" path="cts/tools/dex-tools/src"/>
- <classpathentry kind="src" path="cts/tools/signature-tools/src"/>
- <classpathentry kind="src" path="cts/tools/signature-tools/test"/>
- <classpathentry kind="src" path="cts/tools/tradefed-host/src"/>
- <classpathentry kind="src" path="cts/tools/tradefed-host/tests/src"/>
- <classpathentry kind="src" path="cts/tools/utils"/>
- <classpathentry kind="src" path="cts/tools/vm-tests-tf/src"/>
- <classpathentry kind="src" path="external/easymock/src"/>
+ <classpathentry kind="lib" path="prebuilts/misc/common/ddmlib/ddmlib-prebuilt.jar"/>
+ <classpathentry kind="lib" path="prebuilts/misc/common/tradefed/tradefed-prebuilt.jar"/>
+ <classpathentry kind="src" path="cts/apps/CtsVerifier/src"/>
+ <classpathentry kind="src" path="cts/hostsidetests/appsecurity/src"/>
+ <classpathentry kind="src" path="cts/hostsidetests/appsecurity/test-apps/AppWithData/src"/>
+ <classpathentry kind="src" path="cts/hostsidetests/monkey/src"/>
+ <classpathentry kind="src" path="cts/hostsidetests/monkey/test-apps/CtsMonkeyApp/src"/>
+ <classpathentry kind="src" path="cts/hostsidetests/monkey/test-apps/CtsMonkeyApp2/src"/>
+ <classpathentry kind="src" path="cts/hostsidetests/sample/src"/>
+ <classpathentry kind="src" path="cts/hostsidetests/sample/app/src"/>
+ <classpathentry kind="src" path="cts/hostsidetests/theme/src"/>
+ <classpathentry kind="src" path="cts/hostsidetests/theme/app/src"/>
+ <classpathentry kind="src" path="cts/hostsidetests/usb/src"/>
+ <classpathentry kind="src" path="cts/libs/vogar-expect/src"/>
+ <classpathentry kind="src" path="cts/libs/commonutil/src"/>
+ <classpathentry kind="src" path="cts/libs/deviceutil/src"/>
+ <classpathentry kind="src" path="cts/libs/json/src"/>
+ <classpathentry kind="src" path="cts/libs/testserver/src"/>
+ <classpathentry kind="src" path="cts/libs/wrappedgtest/src"/>
+ <classpathentry kind="src" path="cts/suite/cts/deviceTests/browserbench/src"/>
+ <classpathentry kind="src" path="cts/suite/cts/deviceTests/dram/src"/>
+ <classpathentry kind="src" path="cts/suite/cts/deviceTests/filesystemperf/src"/>
+ <classpathentry kind="src" path="cts/suite/cts/deviceTests/opengl/src"/>
+ <classpathentry kind="src" path="cts/suite/cts/deviceTests/simplecpu/src"/>
+ <classpathentry kind="src" path="cts/suite/cts/deviceTests/ui/src"/>
+ <classpathentry kind="src" path="cts/suite/cts/deviceTests/videoperf/src"/>
+ <classpathentry kind="src" path="cts/suite/cts/hostTests/jank/app/src"/>
+ <classpathentry kind="src" path="cts/suite/cts/hostTests/jank/src"/>
+ <classpathentry kind="src" path="cts/suite/cts/hostTests/uihost/appA/src"/>
+ <classpathentry kind="src" path="cts/suite/cts/hostTests/uihost/appB/src"/>
+ <classpathentry kind="src" path="cts/suite/cts/hostTests/uihost/control/src"/>
+ <classpathentry kind="src" path="cts/suite/cts/hostTests/uihost/src"/>
+ <classpathentry kind="src" path="cts/tests/ProcessTest/src"/>
+ <classpathentry kind="src" path="cts/tests/ProcessTest/NoShareUidApp/src"/>
+ <classpathentry kind="src" path="cts/tests/ProcessTest/ShareUidApp/src"/>
+ <classpathentry kind="src" path="cts/tests/signature/src"/>
+ <classpathentry kind="src" path="cts/tests/signature-tests/src"/>
+ <classpathentry kind="src" path="cts/tests/acceleration/src"/>
+ <classpathentry kind="src" path="cts/tests/core/runner/src"/>
+ <classpathentry kind="src" path="cts/tests/deviceadmin/src"/>
+ <classpathentry kind="src" path="cts/tests/sample/src"/>
+ <classpathentry kind="src" path="cts/tests/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/acceleration/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/accessibility/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/accessibilityservice/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/accounts/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/admin/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/animation/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/app/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/bluetooth/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/content/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/database/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/dpi/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/dpi2/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/drm/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/gesture/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/graphics/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/graphics2/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/hardware/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/jni/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/location/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/media/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/mediastress/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/net/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/opengl/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/openglperf/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/os/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/permission/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/permission2/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/preference/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/preference2/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/provider/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/renderscript/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/security/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/speech/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/telephony/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/text/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/textureview/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/util/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/view/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/webkit/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/widget/src"/>
+ <classpathentry kind="src" path="cts/tools/cts-api-coverage/src"/>
+ <classpathentry kind="src" path="cts/tools/cts-java-scanner/src"/>
+ <classpathentry kind="src" path="cts/tools/cts-java-scanner-doclet/src"/>
+ <classpathentry kind="src" path="cts/tools/cts-native-scanner/src"/>
+ <classpathentry kind="src" path="cts/tools/cts-reference-app-lib/src"/>
+ <classpathentry kind="src" path="cts/tools/cts-xml-generator/src"/>
+ <classpathentry kind="src" path="cts/tools/dasm/src"/>
+ <classpathentry kind="src" path="cts/tools/device-setup/TestDeviceSetup/src"/>
+ <classpathentry kind="src" path="cts/tools/dex-tools/src"/>
+ <classpathentry kind="src" path="cts/tools/signature-tools/src"/>
+ <classpathentry kind="src" path="cts/tools/signature-tools/test"/>
+ <classpathentry kind="src" path="cts/tools/tradefed-host/src"/>
+ <classpathentry kind="src" path="cts/tools/tradefed-host/tests/src"/>
+ <classpathentry kind="src" path="cts/tools/utils"/>
+ <classpathentry kind="src" path="cts/tools/vm-tests-tf/src"/>
+ <classpathentry kind="src" path="external/easymock/src"/>
</classpath>
diff --git a/development/ide/eclipse/genclasspath.sh b/development/ide/eclipse/genclasspath.sh
index 00ee9b3..9b90d82 100755
--- a/development/ide/eclipse/genclasspath.sh
+++ b/development/ide/eclipse/genclasspath.sh
@@ -13,6 +13,5 @@
echo '<?xml version="1.0" encoding="UTF-8"?>'
echo '<classpath>'
-cat $ANDROID_BUILD_TOP/cts/development/ide/eclipse/.classpath | grep classpathentry
-cat $ANDROID_BUILD_TOP/development/ide/eclipse/.classpath | grep classpathentry
+cat $ANDROID_BUILD_TOP/cts/development/ide/eclipse/.classpath $ANDROID_BUILD_TOP/development/ide/eclipse/.classpath | grep classpathentry | sort
echo '</classpath>'
diff --git a/tests/SignatureTest/src/android/tests/sigtest/SignatureTestLog.java b/tests/SignatureTest/src/android/tests/sigtest/SignatureTestLog.java
deleted file mode 100644
index 7cd9663..0000000
--- a/tests/SignatureTest/src/android/tests/sigtest/SignatureTestLog.java
+++ /dev/null
@@ -1,31 +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.
- */
-
-package android.tests.sigtest;
-
-import android.util.Log;
-
-public class SignatureTestLog {
- private static final String TAG = "CTSSignatureTest";
-
- public static void e(String msg, Exception e) {
- Log.e(TAG, msg, e);
- }
-
- public static void d(String msg) {
- Log.d(TAG, msg);
- }
-}
diff --git a/tests/SignatureTest/tests/Android.mk b/tests/SignatureTest/tests/Android.mk
deleted file mode 100644
index 0796670..0000000
--- a/tests/SignatureTest/tests/Android.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-# Include all test java files.
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := SignatureTestTests
-
-LOCAL_INSTRUMENTATION_FOR := SignatureTest
-
-LOCAL_PROGUARD_FLAGS := -ignorewarnings
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
-
-include $(BUILD_PACKAGE)
diff --git a/tests/SignatureTest/tests/AndroidManifest.xml b/tests/SignatureTest/tests/AndroidManifest.xml
deleted file mode 100644
index 49b3827..0000000
--- a/tests/SignatureTest/tests/AndroidManifest.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 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.
--->
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="android.tests.sigtest.tests">
-
- <application>
- <uses-library android:name="android.test.runner"/>
- </application>
-
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
- android:targetPackage="android.tests.sigtest"
- android:label="SignatureTest Functional Testset"/>
-
-</manifest>
diff --git a/tests/signature-tests/Android.mk b/tests/signature-tests/Android.mk
new file mode 100644
index 0000000..f17ee47
--- /dev/null
+++ b/tests/signature-tests/Android.mk
@@ -0,0 +1,26 @@
+# 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.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+# Include all test java files.
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_MODULE := signature-tests
+LOCAL_MODULE_TAGS := optional
+LOCAL_JAVA_LIBRARIES := tradefed-prebuilt cts-tradefed signature-hostside
+
+include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/tests/signature-tests/run_unit_tests.sh b/tests/signature-tests/run_unit_tests.sh
new file mode 100755
index 0000000..19ce8d2
--- /dev/null
+++ b/tests/signature-tests/run_unit_tests.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+# Copyright (C) 2014 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.
+
+# helper script for running the signature unit tests
+
+checkFile() {
+ if [ ! -f "$1" ]; then
+ echo "Unable to locate $1"
+ exit
+ fi;
+}
+
+# check if in Android build env
+if [ ! -z ${ANDROID_BUILD_TOP} ]; then
+ HOST=`uname`
+ if [ "$HOST" == "Linux" ]; then
+ OS="linux-x86"
+ elif [ "$HOST" == "Darwin" ]; then
+ OS="darwin-x86"
+ else
+ echo "Unrecognized OS"
+ exit
+ fi;
+fi;
+
+JAR_DIR=${ANDROID_BUILD_TOP}/out/host/$OS/framework
+JARS="tradefed-prebuilt.jar hosttestlib.jar signature-hostside.jar signature-tests.jar"
+
+for JAR in $JARS; do
+ checkFile ${JAR_DIR}/${JAR}
+ JAR_PATH=${JAR_PATH}:${JAR_DIR}/${JAR}
+done
+
+java $RDBG_FLAG \
+ -cp ${JAR_PATH} com.android.tradefed.command.Console run singleCommand host -n --class android.signature.cts.tests.AllTests "$@"
+
diff --git a/tests/SignatureTest/tests/src/android/tests/sigtest/tests/AllTests.java b/tests/signature-tests/src/android/signature/cts/tests/AllTests.java
similarity index 70%
rename from tests/SignatureTest/tests/src/android/tests/sigtest/tests/AllTests.java
rename to tests/signature-tests/src/android/signature/cts/tests/AllTests.java
index 096cb02..56916f4 100644
--- a/tests/SignatureTest/tests/src/android/tests/sigtest/tests/AllTests.java
+++ b/tests/signature-tests/src/android/signature/cts/tests/AllTests.java
@@ -14,18 +14,23 @@
* limitations under the License.
*/
-package android.tests.sigtest.tests;
+package android.signature.cts.tests;
-import android.test.TestSuiteProvider;
-import android.test.suitebuilder.TestSuiteBuilder;
-
+import junit.framework.Test;
import junit.framework.TestSuite;
/**
* Finds all instrumentation and unit tests for this application.
*/
-public class AllTests implements TestSuiteProvider {
- public TestSuite getTestSuite() {
- return new TestSuiteBuilder(getClass()).includeAllPackagesUnderHere().build();
+public class AllTests extends TestSuite {
+
+ public AllTests() {
+ super();
+
+ addTestSuite(JDiffClassDescriptionTest.class);
+ }
+
+ public static Test suite() {
+ return new AllTests();
}
}
diff --git a/tests/SignatureTest/tests/src/android/tests/sigtest/tests/JDiffClassDescriptionTest.java b/tests/signature-tests/src/android/signature/cts/tests/JDiffClassDescriptionTest.java
similarity index 61%
rename from tests/SignatureTest/tests/src/android/tests/sigtest/tests/JDiffClassDescriptionTest.java
rename to tests/signature-tests/src/android/signature/cts/tests/JDiffClassDescriptionTest.java
index b5bf49e..ffb81ce 100644
--- a/tests/SignatureTest/tests/src/android/tests/sigtest/tests/JDiffClassDescriptionTest.java
+++ b/tests/signature-tests/src/android/signature/cts/tests/JDiffClassDescriptionTest.java
@@ -14,48 +14,53 @@
* limitations under the License.
*/
-package android.tests.sigtest.tests;
+package android.signature.cts.tests;
-import android.test.InstrumentationTestCase;
-import android.tests.sigtest.JDiffClassDescription;
-import android.tests.sigtest.ResultObserver;
-import android.tests.sigtest.SignatureTest.FAILURE_TYPE;
+import android.signature.cts.FailureType;
+import android.signature.cts.JDiffClassDescription;
+import android.signature.cts.ResultObserver;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
import java.lang.reflect.Modifier;
/**
* Test class for JDiffClassDescription.
*/
-public class JDiffClassDescriptionTest extends InstrumentationTestCase {
+public class JDiffClassDescriptionTest extends TestCase {
+
private class NoFailures implements ResultObserver {
- public void notifyFailure(FAILURE_TYPE type, String name, String errmsg) {
- JDiffClassDescriptionTest.this.fail("Saw unexpected test failure: " + name + " failure type: " + type);
+ @Override
+ public void notifyFailure(FailureType type, String name, String errmsg) {
+ Assert.fail("Saw unexpected test failure: " + name + " failure type: " + type);
}
}
private class ExpectFailure implements ResultObserver {
- private FAILURE_TYPE expectedType;
+ private FailureType expectedType;
private boolean failureSeen;
- public ExpectFailure(FAILURE_TYPE expectedType) {
+ public ExpectFailure(FailureType expectedType) {
this.expectedType = expectedType;
}
- public void notifyFailure(FAILURE_TYPE type, String name, String errMsg) {
+ @Override
+ public void notifyFailure(FailureType type, String name, String errMsg) {
if (type == expectedType) {
if (failureSeen) {
- JDiffClassDescriptionTest.this.fail("Saw second test failure: " + name + " failure type: " + type);
+ Assert.fail("Saw second test failure: " + name + " failure type: " + type);
} else {
// We've seen the error, mark it and keep going
failureSeen = true;
}
} else {
- JDiffClassDescriptionTest.this.fail("Saw unexpected test failure: " + name + " failure type: " + type);
+ Assert.fail("Saw unexpected test failure: " + name + " failure type: " + type);
}
}
-
+
public void validate() {
- JDiffClassDescriptionTest.this.assertTrue(failureSeen);
+ Assert.assertTrue(failureSeen);
}
}
@@ -74,24 +79,23 @@
* @return the new JDiffClassDescription
*/
private JDiffClassDescription createNormalClass(ResultObserver observer) {
- JDiffClassDescription clz = new JDiffClassDescription("android.tests.sigtest.tests.data", "NormalClass", observer);
+ JDiffClassDescription clz = new JDiffClassDescription(
+ "android.signature.cts.tests.data", "NormalClass", observer);
clz.setType(JDiffClassDescription.JDiffType.CLASS);
clz.setModifier(Modifier.PUBLIC);
return clz;
- }
+ }
public void testNormalClassCompliance() {
JDiffClassDescription clz = createNormalClass();
clz.checkSignatureCompliance();
- assertEquals(clz.toSignatureString(),
- "public class NormalClass");
+ assertEquals(clz.toSignatureString(), "public class NormalClass");
}
public void testMissingClass() {
- ExpectFailure observer = new ExpectFailure(FAILURE_TYPE.MISSING_CLASS);
- JDiffClassDescription clz = new JDiffClassDescription("android.tests.sigtest.tests.data",
- "NoSuchClass",
- observer);
+ ExpectFailure observer = new ExpectFailure(FailureType.MISSING_CLASS);
+ JDiffClassDescription clz = new JDiffClassDescription(
+ "android.signature.cts.tests.data", "NoSuchClass", observer);
clz.setType(JDiffClassDescription.JDiffType.CLASS);
clz.checkSignatureCompliance();
observer.validate();
@@ -99,88 +103,110 @@
public void testSimpleConstructor() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffConstructor constructor = new JDiffClassDescription.JDiffConstructor("NormalClass", Modifier.PUBLIC);
+ JDiffClassDescription.JDiffConstructor constructor =
+ new JDiffClassDescription.JDiffConstructor("NormalClass", Modifier.PUBLIC);
clz.addConstructor(constructor);
clz.checkSignatureCompliance();
assertEquals(constructor.toSignatureString(), "public NormalClass()");
}
+
public void testOneArgConstructor() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffConstructor constructor = new JDiffClassDescription.JDiffConstructor("NormalClass", Modifier.PRIVATE);
+ JDiffClassDescription.JDiffConstructor constructor =
+ new JDiffClassDescription.JDiffConstructor("NormalClass", Modifier.PRIVATE);
constructor.addParam("java.lang.String");
clz.addConstructor(constructor);
clz.checkSignatureCompliance();
assertEquals(constructor.toSignatureString(), "private NormalClass(java.lang.String)");
}
+
public void testConstructorThrowsException() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffConstructor constructor = new JDiffClassDescription.JDiffConstructor("NormalClass", Modifier.PROTECTED);
+ JDiffClassDescription.JDiffConstructor constructor =
+ new JDiffClassDescription.JDiffConstructor("NormalClass", Modifier.PROTECTED);
constructor.addParam("java.lang.String");
constructor.addParam("java.lang.String");
- constructor.addException("android.tests.sigtest.tests.data.NormalException");
+ constructor.addException("android.signature.cts.tests.data.NormalException");
clz.addConstructor(constructor);
clz.checkSignatureCompliance();
- assertEquals(constructor.toSignatureString(), "protected NormalClass(java.lang.String, " +
- "java.lang.String) throws android.tests.sigtest.tests.data.NormalException");
+ assertEquals(constructor.toSignatureString(),
+ "protected NormalClass(java.lang.String, java.lang.String) " +
+ "throws android.signature.cts.tests.data.NormalException");
}
+
public void testPackageProtectedConstructor() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffConstructor constructor = new JDiffClassDescription.JDiffConstructor("NormalClass", 0);
+ JDiffClassDescription.JDiffConstructor constructor =
+ new JDiffClassDescription.JDiffConstructor("NormalClass", 0);
constructor.addParam("java.lang.String");
constructor.addParam("java.lang.String");
constructor.addParam("java.lang.String");
clz.addConstructor(constructor);
clz.checkSignatureCompliance();
- assertEquals(constructor.toSignatureString(), "NormalClass(java.lang.String, java.lang.String, java.lang.String)");
+ assertEquals(constructor.toSignatureString(),
+ "NormalClass(java.lang.String, java.lang.String, java.lang.String)");
}
public void testStaticMethod() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod("staticMethod", Modifier.STATIC | Modifier.PUBLIC, "void");
+ JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod(
+ "staticMethod", Modifier.STATIC | Modifier.PUBLIC, "void");
clz.addMethod(method);
clz.checkSignatureCompliance();
assertEquals(method.toSignatureString(), "public static void staticMethod()");
}
+
public void testSyncMethod() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod("syncMethod", Modifier.SYNCHRONIZED | Modifier.PUBLIC, "void");
+ JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod(
+ "syncMethod", Modifier.SYNCHRONIZED | Modifier.PUBLIC, "void");
clz.addMethod(method);
clz.checkSignatureCompliance();
assertEquals(method.toSignatureString(), "public synchronized void syncMethod()");
}
+
public void testPackageProtectMethod() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod("packageProtectedMethod", 0, "boolean");
+ JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod(
+ "packageProtectedMethod", 0, "boolean");
clz.addMethod(method);
clz.checkSignatureCompliance();
assertEquals(method.toSignatureString(), "boolean packageProtectedMethod()");
}
+
public void testPrivateMethod() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod("privateMethod", Modifier.PRIVATE, "void");
+ JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod(
+ "privateMethod", Modifier.PRIVATE, "void");
clz.addMethod(method);
clz.checkSignatureCompliance();
assertEquals(method.toSignatureString(), "private void privateMethod()");
}
+
public void testProtectedMethod() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod("protectedMethod", Modifier.PROTECTED, "java.lang.String");
+ JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod(
+ "protectedMethod", Modifier.PROTECTED, "java.lang.String");
clz.addMethod(method);
clz.checkSignatureCompliance();
assertEquals(method.toSignatureString(), "protected java.lang.String protectedMethod()");
}
+
public void testThrowsMethod() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod("throwsMethod", Modifier.PUBLIC, "void");
- method.addException("android.tests.sigtest.tests.data.NormalException");
+ JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod(
+ "throwsMethod", Modifier.PUBLIC, "void");
+ method.addException("android.signature.cts.tests.data.NormalException");
clz.addMethod(method);
clz.checkSignatureCompliance();
- assertEquals(method.toSignatureString(), "public void throwsMethod() throws" +
- " android.tests.sigtest.tests.data.NormalException");
+ assertEquals(method.toSignatureString(), "public void throwsMethod() " +
+ "throws android.signature.cts.tests.data.NormalException");
}
+
public void testNativeMethod() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod("nativeMethod", Modifier.PUBLIC | Modifier.NATIVE, "void");
+ JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod(
+ "nativeMethod", Modifier.PUBLIC | Modifier.NATIVE, "void");
clz.addMethod(method);
clz.checkSignatureCompliance();
assertEquals(method.toSignatureString(), "public native void nativeMethod()");
@@ -188,207 +214,259 @@
public void testFinalField() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField("FINAL_FIELD", "java.lang.String", Modifier.PUBLIC | Modifier.FINAL);
+ JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField(
+ "FINAL_FIELD", "java.lang.String", Modifier.PUBLIC | Modifier.FINAL);
clz.addField(field);
clz.checkSignatureCompliance();
assertEquals(field.toSignatureString(), "public final java.lang.String FINAL_FIELD");
}
+
public void testStaticField() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField("STATIC_FIELD", "java.lang.String", Modifier.PUBLIC | Modifier.STATIC);
+ JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField(
+ "STATIC_FIELD", "java.lang.String", Modifier.PUBLIC | Modifier.STATIC);
clz.addField(field);
clz.checkSignatureCompliance();
assertEquals(field.toSignatureString(), "public static java.lang.String STATIC_FIELD");
}
+
public void testVolatileFiled() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField("VOLATILE_FIELD", "java.lang.String", Modifier.PUBLIC | Modifier.VOLATILE);
+ JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField(
+ "VOLATILE_FIELD", "java.lang.String", Modifier.PUBLIC | Modifier.VOLATILE);
clz.addField(field);
clz.checkSignatureCompliance();
assertEquals(field.toSignatureString(), "public volatile java.lang.String VOLATILE_FIELD");
}
+
public void testTransientField() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField("TRANSIENT_FIELD", "java.lang.String", Modifier.PUBLIC | Modifier.TRANSIENT);
+ JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField(
+ "TRANSIENT_FIELD", "java.lang.String", Modifier.PUBLIC | Modifier.TRANSIENT);
clz.addField(field);
clz.checkSignatureCompliance();
- assertEquals(field.toSignatureString(), "public transient java.lang.String TRANSIENT_FIELD");
+ assertEquals(field.toSignatureString(),
+ "public transient java.lang.String TRANSIENT_FIELD");
}
+
public void testPacakgeField() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField("PACAKGE_FIELD", "java.lang.String", 0);
+ JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField(
+ "PACAKGE_FIELD", "java.lang.String", 0);
clz.addField(field);
clz.checkSignatureCompliance();
assertEquals(field.toSignatureString(), "java.lang.String PACAKGE_FIELD");
}
+
public void testPrivateField() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField("PRIVATE_FIELD", "java.lang.String", Modifier.PRIVATE);
+ JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField(
+ "PRIVATE_FIELD", "java.lang.String", Modifier.PRIVATE);
clz.addField(field);
clz.checkSignatureCompliance();
assertEquals(field.toSignatureString(), "private java.lang.String PRIVATE_FIELD");
}
+
public void testProtectedField() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField("PROTECTED_FIELD", "java.lang.String", Modifier.PROTECTED);
+ JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField(
+ "PROTECTED_FIELD", "java.lang.String", Modifier.PROTECTED);
clz.addField(field);
clz.checkSignatureCompliance();
assertEquals(field.toSignatureString(), "protected java.lang.String PROTECTED_FIELD");
}
public void testInnerClass() {
- JDiffClassDescription clz = new JDiffClassDescription("android.tests.sigtest.tests.data", "NormalClass.InnerClass", new NoFailures());
+ JDiffClassDescription clz = new JDiffClassDescription(
+ "android.signature.cts.tests.data", "NormalClass.InnerClass", new NoFailures());
clz.setType(JDiffClassDescription.JDiffType.CLASS);
clz.setModifier(Modifier.PUBLIC);
- JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField("innerClassData", "java.lang.String", Modifier.PRIVATE);
+ JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField(
+ "innerClassData", "java.lang.String", Modifier.PRIVATE);
clz.addField(field);
clz.checkSignatureCompliance();
assertEquals(clz.toSignatureString(), "public class NormalClass.InnerClass");
}
+
public void testInnerInnerClass() {
- JDiffClassDescription clz = new JDiffClassDescription("android.tests.sigtest.tests.data", "NormalClass.InnerClass.InnerInnerClass", new NoFailures());
+ JDiffClassDescription clz = new JDiffClassDescription(
+ "android.signature.cts.tests.data", "NormalClass.InnerClass.InnerInnerClass",
+ new NoFailures());
clz.setType(JDiffClassDescription.JDiffType.CLASS);
clz.setModifier(Modifier.PUBLIC);
- JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField("innerInnerClassData", "java.lang.String", Modifier.PRIVATE);
+ JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField(
+ "innerInnerClassData", "java.lang.String", Modifier.PRIVATE);
clz.addField(field);
clz.checkSignatureCompliance();
- assertEquals(clz.toSignatureString(), "public class NormalClass.InnerClass.InnerInnerClass");
+ assertEquals(clz.toSignatureString(),
+ "public class NormalClass.InnerClass.InnerInnerClass");
}
+
public void testInnerInterface() {
- JDiffClassDescription clz = new JDiffClassDescription("android.tests.sigtest.tests.data", "NormalClass.InnerInterface", new NoFailures());
+ JDiffClassDescription clz = new JDiffClassDescription(
+ "android.signature.cts.tests.data", "NormalClass.InnerInterface", new NoFailures());
clz.setType(JDiffClassDescription.JDiffType.INTERFACE);
clz.setModifier(Modifier.PUBLIC | Modifier.STATIC | Modifier.ABSTRACT);
- clz.addMethod(new JDiffClassDescription.JDiffMethod("doSomething", Modifier.PUBLIC, "void"));
+ clz.addMethod(
+ new JDiffClassDescription.JDiffMethod("doSomething", Modifier.PUBLIC, "void"));
clz.checkSignatureCompliance();
assertEquals(clz.toSignatureString(), "public interface NormalClass.InnerInterface");
}
+
public void testInterface() {
- JDiffClassDescription clz = new JDiffClassDescription("android.tests.sigtest.tests.data", "NormalInterface", new NoFailures());
+ JDiffClassDescription clz = new JDiffClassDescription(
+ "android.signature.cts.tests.data", "NormalInterface", new NoFailures());
clz.setType(JDiffClassDescription.JDiffType.INTERFACE);
clz.setModifier(Modifier.PUBLIC | Modifier.ABSTRACT);
- clz.addMethod(new JDiffClassDescription.JDiffMethod("doSomething", Modifier.PUBLIC, "void"));
+ clz.addMethod(
+ new JDiffClassDescription.JDiffMethod("doSomething", Modifier.PUBLIC, "void"));
clz.checkSignatureCompliance();
assertEquals(clz.toSignatureString(), "public interface NormalInterface");
}
+
public void testFinalClass() {
- JDiffClassDescription clz = new JDiffClassDescription("android.tests.sigtest.tests.data", "FinalClass", new NoFailures());
+ JDiffClassDescription clz = new JDiffClassDescription(
+ "android.signature.cts.tests.data", "FinalClass", new NoFailures());
clz.setType(JDiffClassDescription.JDiffType.CLASS);
clz.setModifier(Modifier.PUBLIC | Modifier.FINAL);
clz.checkSignatureCompliance();
assertEquals(clz.toSignatureString(), "public final class FinalClass");
}
- /** Test the case where the API declares the method not
- * synchronized, but it actually is. */
+
+ /**
+ * Test the case where the API declares the method not synchronized, but it
+ * actually is.
+ */
public void testAddingSync() {
- ExpectFailure observer = new ExpectFailure(FAILURE_TYPE.MISMATCH_METHOD);
+ ExpectFailure observer = new ExpectFailure(FailureType.MISMATCH_METHOD);
JDiffClassDescription clz = createNormalClass(observer);
- JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod("syncMethod", Modifier.PUBLIC, "void");
+ JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod(
+ "syncMethod", Modifier.PUBLIC, "void");
clz.addMethod(method);
clz.checkSignatureCompliance();
observer.validate();
}
- /** Test the case where the API declares the method is
- * synchronized, but it actually is not. */
+
+ /**
+ * Test the case where the API declares the method is synchronized, but it
+ * actually is not.
+ */
public void testRemovingSync() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod("notSyncMethod", Modifier.SYNCHRONIZED | Modifier.PUBLIC, "void");
+ JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod(
+ "notSyncMethod", Modifier.SYNCHRONIZED | Modifier.PUBLIC, "void");
clz.addMethod(method);
clz.checkSignatureCompliance();
}
- /** API says method is not native, but it actually is.
- * http://b/1839558
+
+ /**
+ * API says method is not native, but it actually is. http://b/1839558
*/
public void testAddingNative() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod("nativeMethod", Modifier.PUBLIC, "void");
+ JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod(
+ "nativeMethod", Modifier.PUBLIC, "void");
clz.addMethod(method);
clz.checkSignatureCompliance();
}
- /** API says method is native, but actually isn't.
- * http://b/1839558
+
+ /**
+ * API says method is native, but actually isn't. http://b/1839558
*/
public void testRemovingNative() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod("notNativeMethod", Modifier.NATIVE | Modifier.PUBLIC, "void");
+ JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod(
+ "notNativeMethod", Modifier.NATIVE | Modifier.PUBLIC, "void");
clz.addMethod(method);
clz.checkSignatureCompliance();
}
+
public void testAbstractClass() {
- JDiffClassDescription clz = new JDiffClassDescription("android.tests.sigtest.tests.data", "AbstractClass", new NoFailures());
+ JDiffClassDescription clz = new JDiffClassDescription(
+ "android.signature.cts.tests.data", "AbstractClass", new NoFailures());
clz.setType(JDiffClassDescription.JDiffType.CLASS);
clz.setModifier(Modifier.PUBLIC | Modifier.ABSTRACT);
clz.checkSignatureCompliance();
assertEquals(clz.toSignatureString(), "public abstract class AbstractClass");
}
- /** API lists class as abstract, reflection does not.
- * http://b/1839622
+
+ /**
+ * API lists class as abstract, reflection does not. http://b/1839622
*/
public void testRemovingAbstractFromAClass() {
- JDiffClassDescription clz = new JDiffClassDescription("android.tests.sigtest.tests.data", "NormalClass", new NoFailures());
+ JDiffClassDescription clz = new JDiffClassDescription(
+ "android.signature.cts.tests.data", "NormalClass", new NoFailures());
clz.setType(JDiffClassDescription.JDiffType.CLASS);
clz.setModifier(Modifier.PUBLIC | Modifier.ABSTRACT);
clz.checkSignatureCompliance();
}
- /** reflection lists class as abstract, api does not.
- * http://b/1839622
+
+ /**
+ * reflection lists class as abstract, api does not. http://b/1839622
*/
public void testAddingAbstractToAClass() {
- ExpectFailure observer = new ExpectFailure(FAILURE_TYPE.MISMATCH_CLASS);
- JDiffClassDescription clz = new JDiffClassDescription("android.tests.sigtest.tests.data",
- "AbstractClass",
- observer);
+ ExpectFailure observer = new ExpectFailure(FailureType.MISMATCH_CLASS);
+ JDiffClassDescription clz = new JDiffClassDescription(
+ "android.signature.cts.tests.data", "AbstractClass", observer);
clz.setType(JDiffClassDescription.JDiffType.CLASS);
clz.setModifier(Modifier.PUBLIC);
clz.checkSignatureCompliance();
observer.validate();
}
+
public void testFinalMethod() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod("finalMethod", Modifier.PUBLIC | Modifier.FINAL, "void");
+ JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod(
+ "finalMethod", Modifier.PUBLIC | Modifier.FINAL, "void");
clz.addMethod(method);
clz.checkSignatureCompliance();
assertEquals(method.toSignatureString(), "public final void finalMethod()");
}
+
/**
* Final Class, API lists methods as non-final, reflection has it as final.
* http://b/1839589
*/
public void testAddingFinalToAMethodInAFinalClass() {
- JDiffClassDescription clz = new JDiffClassDescription("android.tests.sigtest.tests.data", "FinalClass", new NoFailures());
+ JDiffClassDescription clz = new JDiffClassDescription(
+ "android.signature.cts.tests.data", "FinalClass", new NoFailures());
clz.setType(JDiffClassDescription.JDiffType.CLASS);
clz.setModifier(Modifier.PUBLIC | Modifier.FINAL);
- JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod("finalMethod", Modifier.PUBLIC, "void");
+ JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod(
+ "finalMethod", Modifier.PUBLIC, "void");
clz.addMethod(method);
- clz.checkSignatureCompliance();
+ clz.checkSignatureCompliance();
}
+
/**
* Final Class, API lists methods as final, reflection has it as non-final.
* http://b/1839589
*/
public void testRemovingFinalToAMethodInAFinalClass() {
- JDiffClassDescription clz = new JDiffClassDescription("android.tests.sigtest.tests.data", "FinalClass", new NoFailures());
+ JDiffClassDescription clz = new JDiffClassDescription(
+ "android.signature.cts.tests.data", "FinalClass", new NoFailures());
clz.setType(JDiffClassDescription.JDiffType.CLASS);
clz.setModifier(Modifier.PUBLIC | Modifier.FINAL);
- JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod("nonFinalMethod",
- Modifier.PUBLIC | Modifier.FINAL,
- "void");
+ JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod(
+ "nonFinalMethod", Modifier.PUBLIC | Modifier.FINAL, "void");
clz.addMethod(method);
- clz.checkSignatureCompliance();
+ clz.checkSignatureCompliance();
}
+
/**
- * non-final Class, API lists methods as non-final, reflection has it as final.
- * http://b/1839589
- */
+ * non-final Class, API lists methods as non-final, reflection has it as
+ * final. http://b/1839589
+ */
public void testAddingFinalToAMethodInANonFinalClass() {
- ExpectFailure observer = new ExpectFailure(FAILURE_TYPE.MISMATCH_METHOD);
- JDiffClassDescription clz = new JDiffClassDescription("android.tests.sigtest.tests.data",
- "NormalClass",
- observer);
+ ExpectFailure observer = new ExpectFailure(FailureType.MISMATCH_METHOD);
+ JDiffClassDescription clz = new JDiffClassDescription(
+ "android.signature.cts.tests.data", "NormalClass", observer);
clz.setType(JDiffClassDescription.JDiffType.CLASS);
clz.setModifier(Modifier.PUBLIC);
- JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod("finalMethod", Modifier.PUBLIC, "void");
+ JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod(
+ "finalMethod", Modifier.PUBLIC, "void");
clz.addMethod(method);
- clz.checkSignatureCompliance();
+ clz.checkSignatureCompliance();
observer.validate();
}
}
diff --git a/tests/SignatureTest/tests/src/android/tests/sigtest/tests/data/AbstractClass.java b/tests/signature-tests/src/android/signature/cts/tests/data/AbstractClass.java
similarity index 94%
rename from tests/SignatureTest/tests/src/android/tests/sigtest/tests/data/AbstractClass.java
rename to tests/signature-tests/src/android/signature/cts/tests/data/AbstractClass.java
index d24d691..527e7eb 100644
--- a/tests/SignatureTest/tests/src/android/tests/sigtest/tests/data/AbstractClass.java
+++ b/tests/signature-tests/src/android/signature/cts/tests/data/AbstractClass.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.tests.sigtest.tests.data;
+package android.signature.cts.tests.data;
/**
* This class is used as reference data for the JDiffClassDescriptionTest tests.
diff --git a/tests/SignatureTest/tests/src/android/tests/sigtest/tests/data/FinalClass.java b/tests/signature-tests/src/android/signature/cts/tests/data/FinalClass.java
similarity index 95%
rename from tests/SignatureTest/tests/src/android/tests/sigtest/tests/data/FinalClass.java
rename to tests/signature-tests/src/android/signature/cts/tests/data/FinalClass.java
index 4c871f0..395e166 100644
--- a/tests/SignatureTest/tests/src/android/tests/sigtest/tests/data/FinalClass.java
+++ b/tests/signature-tests/src/android/signature/cts/tests/data/FinalClass.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.tests.sigtest.tests.data;
+package android.signature.cts.tests.data;
/**
* This class is used as reference data for the
diff --git a/tests/SignatureTest/tests/src/android/tests/sigtest/tests/data/NormalClass.java b/tests/signature-tests/src/android/signature/cts/tests/data/NormalClass.java
similarity index 97%
rename from tests/SignatureTest/tests/src/android/tests/sigtest/tests/data/NormalClass.java
rename to tests/signature-tests/src/android/signature/cts/tests/data/NormalClass.java
index 9cd54ab..5acd696 100644
--- a/tests/SignatureTest/tests/src/android/tests/sigtest/tests/data/NormalClass.java
+++ b/tests/signature-tests/src/android/signature/cts/tests/data/NormalClass.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.tests.sigtest.tests.data;
+package android.signature.cts.tests.data;
/**
* This class is used as reference data for the
diff --git a/tests/SignatureTest/tests/src/android/tests/sigtest/tests/data/NormalException.java b/tests/signature-tests/src/android/signature/cts/tests/data/NormalException.java
similarity index 94%
rename from tests/SignatureTest/tests/src/android/tests/sigtest/tests/data/NormalException.java
rename to tests/signature-tests/src/android/signature/cts/tests/data/NormalException.java
index cc3d725..b2dd52d 100644
--- a/tests/SignatureTest/tests/src/android/tests/sigtest/tests/data/NormalException.java
+++ b/tests/signature-tests/src/android/signature/cts/tests/data/NormalException.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.tests.sigtest.tests.data;
+package android.signature.cts.tests.data;
import java.lang.Exception;
diff --git a/tests/SignatureTest/tests/src/android/tests/sigtest/tests/data/NormalInterface.java b/tests/signature-tests/src/android/signature/cts/tests/data/NormalInterface.java
similarity index 95%
rename from tests/SignatureTest/tests/src/android/tests/sigtest/tests/data/NormalInterface.java
rename to tests/signature-tests/src/android/signature/cts/tests/data/NormalInterface.java
index 3200b76..899f4cc 100644
--- a/tests/SignatureTest/tests/src/android/tests/sigtest/tests/data/NormalInterface.java
+++ b/tests/signature-tests/src/android/signature/cts/tests/data/NormalInterface.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.tests.sigtest.tests.data;
+package android.signature.cts.tests.data;
/**
* This class is used as reference data for the
diff --git a/tests/SignatureTest/Android.mk b/tests/signature/Android.mk
similarity index 84%
rename from tests/SignatureTest/Android.mk
rename to tests/signature/Android.mk
index fc794e8..53ba50d 100644
--- a/tests/SignatureTest/Android.mk
+++ b/tests/signature/Android.mk
@@ -20,11 +20,11 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_PACKAGE_NAME := SignatureTest
+LOCAL_PACKAGE_NAME := CtsSignatureTestCases
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
# To be passed in on command line
CTS_API_VERSION ?= current
@@ -84,5 +84,18 @@
android_api_description :=
CTS_API_VERSION :=
-# Use the following include to make our test apk.
-include $(call all-makefiles-under,$(LOCAL_PATH))
+# signature-hostside java library (for testing)
+# ============================================================
+
+include $(CLEAR_VARS)
+
+# These files are for device-side only, so filter-out for host library
+LOCAL_DEVICE_ONLY_SOURCES := %/SignatureTest.java
+
+LOCAL_SRC_FILES := $(filter-out $(LOCAL_DEVICE_ONLY_SOURCES), $(call all-java-files-under, src))
+
+LOCAL_MODULE := signature-hostside
+
+LOCAL_MODULE_TAGS := optional
+
+include $(BUILD_HOST_JAVA_LIBRARY)
\ No newline at end of file
diff --git a/tests/SignatureTest/AndroidManifest.xml b/tests/signature/AndroidManifest.xml
similarity index 90%
rename from tests/SignatureTest/AndroidManifest.xml
rename to tests/signature/AndroidManifest.xml
index 89d8590..e42302e 100644
--- a/tests/SignatureTest/AndroidManifest.xml
+++ b/tests/signature/AndroidManifest.xml
@@ -16,7 +16,7 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="android.tests.sigtest">
+ package="android.signature">
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<application>
@@ -24,7 +24,7 @@
</application>
<instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
- android:targetPackage="android.tests.sigtest"
+ android:targetPackage="android.signature"
android:label="API Signature Test"/>
</manifest>
\ No newline at end of file
diff --git a/tests/SignatureTest/res/raw/excludepackages.txt b/tests/signature/res/raw/excludepackages.txt
similarity index 100%
rename from tests/SignatureTest/res/raw/excludepackages.txt
rename to tests/signature/res/raw/excludepackages.txt
diff --git a/tests/signature/src/android/signature/cts/FailureType.java b/tests/signature/src/android/signature/cts/FailureType.java
new file mode 100644
index 0000000..5aaebc4
--- /dev/null
+++ b/tests/signature/src/android/signature/cts/FailureType.java
@@ -0,0 +1,16 @@
+package android.signature.cts;
+
+/**
+ * Define the type of the signature check failures.
+ */
+public enum FailureType {
+ MISSING_CLASS,
+ MISSING_INTERFACE,
+ MISSING_METHOD,
+ MISSING_FIELD,
+ MISMATCH_CLASS,
+ MISMATCH_INTERFACE,
+ MISMATCH_METHOD,
+ MISMATCH_FIELD,
+ CAUGHT_EXCEPTION,
+}
diff --git a/tests/SignatureTest/src/android/tests/sigtest/JDiffClassDescription.java b/tests/signature/src/android/signature/cts/JDiffClassDescription.java
similarity index 94%
rename from tests/SignatureTest/src/android/tests/sigtest/JDiffClassDescription.java
rename to tests/signature/src/android/signature/cts/JDiffClassDescription.java
index 36360d6..7ea9911 100644
--- a/tests/SignatureTest/src/android/tests/sigtest/JDiffClassDescription.java
+++ b/tests/signature/src/android/signature/cts/JDiffClassDescription.java
@@ -14,9 +14,7 @@
* limitations under the License.
*/
-package android.tests.sigtest;
-
-import android.tests.sigtest.SignatureTest.FAILURE_TYPE;
+package android.signature.cts;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
@@ -83,9 +81,8 @@
*/
public JDiffClassDescription(String pkg, String className) {
this(pkg, className, new ResultObserver() {
- public void notifyFailure(FAILURE_TYPE type,
- String name,
- String errorMessage) {
+ @Override
+ public void notifyFailure(FailureType type, String name, String errorMessage) {
// This is a null result observer that doesn't do anything.
}
});
@@ -99,9 +96,7 @@
* @param className the name of the class.
* @param resultObserver the resultObserver to get results with.
*/
- public JDiffClassDescription(String pkg,
- String className,
- ResultObserver resultObserver) {
+ public JDiffClassDescription(String pkg, String className, ResultObserver resultObserver) {
mPackageName = pkg;
mShortClassName = className;
mResultObserver = resultObserver;
@@ -144,7 +139,6 @@
}
static String convertModifiersToAccessLevel(int modifiers) {
- String accessLevel = "";
if ((modifiers & Modifier.PUBLIC) != 0) {
return "public";
} else if ((modifiers & Modifier.PRIVATE) != 0) {
@@ -500,7 +494,7 @@
Method m = findMatchingMethod(method);
if (m == null) {
- mResultObserver.notifyFailure(FAILURE_TYPE.MISSING_METHOD,
+ mResultObserver.notifyFailure(FailureType.MISSING_METHOD,
method.toReadableString(mAbsoluteClassName),
"No method with correct signature found:" +
method.toSignatureString());
@@ -521,15 +515,15 @@
}
if (!areMethodModifiedCompatibile(method, m)) {
- mResultObserver.notifyFailure(FAILURE_TYPE.MISMATCH_METHOD,
+ mResultObserver.notifyFailure(FailureType.MISMATCH_METHOD,
method.toReadableString(mAbsoluteClassName),
"Non-compatible method found when looking for " +
method.toSignatureString());
}
}
} catch (Exception e) {
- SignatureTestLog.e("Got exception when checking method compliance", e);
- mResultObserver.notifyFailure(FAILURE_TYPE.CAUGHT_EXCEPTION,
+ loge("Got exception when checking method compliance", e);
+ mResultObserver.notifyFailure(FailureType.CAUGHT_EXCEPTION,
method.toReadableString(mAbsoluteClassName),
"Exception!");
}
@@ -583,7 +577,6 @@
@SuppressWarnings("unchecked")
private Method findMatchingMethod(JDiffMethod method) {
Method[] methods = mClass.getDeclaredMethods();
- boolean found = false;
for (Method m : methods) {
if (matches(method, m)) {
@@ -637,7 +630,7 @@
try {
Constructor<?> c = findMatchingConstructor(con);
if (c == null) {
- mResultObserver.notifyFailure(FAILURE_TYPE.MISSING_METHOD,
+ mResultObserver.notifyFailure(FailureType.MISSING_METHOD,
con.toReadableString(mAbsoluteClassName),
"No method with correct signature found:" +
con.toSignatureString());
@@ -647,15 +640,15 @@
}
if (c.getModifiers() != con.mModifier) {
mResultObserver.notifyFailure(
- FAILURE_TYPE.MISMATCH_METHOD,
+ FailureType.MISMATCH_METHOD,
con.toReadableString(mAbsoluteClassName),
"Non-compatible method found when looking for " +
con.toSignatureString());
}
}
} catch (Exception e) {
- SignatureTestLog.e("Got exception when checking constructor compliance", e);
- mResultObserver.notifyFailure(FAILURE_TYPE.CAUGHT_EXCEPTION,
+ loge("Got exception when checking constructor compliance", e);
+ mResultObserver.notifyFailure(FailureType.CAUGHT_EXCEPTION,
con.toReadableString(mAbsoluteClassName),
"Exception!");
}
@@ -716,12 +709,12 @@
try {
Field f = findMatchingField(field);
if (f == null) {
- mResultObserver.notifyFailure(FAILURE_TYPE.MISSING_FIELD,
+ mResultObserver.notifyFailure(FailureType.MISSING_FIELD,
field.toReadableString(mAbsoluteClassName),
"No field with correct signature found:" +
field.toSignatureString());
} else if (f.getModifiers() != field.mModifier) {
- mResultObserver.notifyFailure(FAILURE_TYPE.MISMATCH_FIELD,
+ mResultObserver.notifyFailure(FailureType.MISMATCH_FIELD,
field.toReadableString(mAbsoluteClassName),
"Non-compatible field modifiers found when looking for " +
field.toSignatureString());
@@ -735,7 +728,7 @@
}
if (genericTypeName == null || !genericTypeName.equals(field.mFieldType)) {
mResultObserver.notifyFailure(
- FAILURE_TYPE.MISMATCH_FIELD,
+ FailureType.MISMATCH_FIELD,
field.toReadableString(mAbsoluteClassName),
"Non-compatible field type found when looking for " +
field.toSignatureString());
@@ -743,10 +736,11 @@
}
} catch (Exception e) {
- SignatureTestLog.e("Got exception when checking field compliance", e);
- mResultObserver.notifyFailure(FAILURE_TYPE.CAUGHT_EXCEPTION,
+ loge("Got exception when checking field compliance", e);
+ mResultObserver.notifyFailure(
+ FailureType.CAUGHT_EXCEPTION,
field.toReadableString(mAbsoluteClassName),
- "Exception!");
+ "Exception!");
}
}
}
@@ -880,11 +874,11 @@
if (mClass == null) {
// No class found, notify the observer according to the class type
if (JDiffType.INTERFACE.equals(mClassType)) {
- mResultObserver.notifyFailure(FAILURE_TYPE.MISSING_INTERFACE,
+ mResultObserver.notifyFailure(FailureType.MISSING_INTERFACE,
mAbsoluteClassName,
"Classloader is unable to find " + mAbsoluteClassName);
} else {
- mResultObserver.notifyFailure(FAILURE_TYPE.MISSING_CLASS,
+ mResultObserver.notifyFailure(FailureType.MISSING_CLASS,
mAbsoluteClassName,
"Classloader is unable to find " + mAbsoluteClassName);
}
@@ -920,10 +914,11 @@
}
}
} catch (Exception e) {
- SignatureTestLog.e("Got exception when checking field compliance", e);
- mResultObserver.notifyFailure(FAILURE_TYPE.CAUGHT_EXCEPTION,
+ loge("Got exception when checking field compliance", e);
+ mResultObserver.notifyFailure(
+ FailureType.CAUGHT_EXCEPTION,
mAbsoluteClassName,
- "Exception!");
+ "Exception!");
}
}
@@ -974,11 +969,11 @@
private void logMismatchInterfaceSignature(String classFullName, String errorMessage) {
if (JDiffType.INTERFACE.equals(mClassType)) {
- mResultObserver.notifyFailure(FAILURE_TYPE.MISMATCH_INTERFACE,
+ mResultObserver.notifyFailure(FailureType.MISMATCH_INTERFACE,
classFullName,
errorMessage);
} else {
- mResultObserver.notifyFailure(FAILURE_TYPE.MISMATCH_CLASS,
+ mResultObserver.notifyFailure(FailureType.MISMATCH_CLASS,
classFullName,
errorMessage);
}
@@ -1026,7 +1021,7 @@
}
}
} catch (ClassNotFoundException e) {
- SignatureTestLog.e("ClassNotFoundException for " + mPackageName + "." + mShortClassName, e);
+ loge("ClassNotFoundException for " + mPackageName + "." + mShortClassName, e);
return null;
}
return null;
@@ -1195,4 +1190,8 @@
// canonicalize them to one form.
return paramType.replace("<? extends java.lang.Object>", "<?>");
}
+
+ private static void loge(String message, Exception exception) {
+ System.err.println(String.format("%s: %s", message, exception));
+ }
}
diff --git a/tests/SignatureTest/src/android/tests/sigtest/ResultObserver.java b/tests/signature/src/android/signature/cts/ResultObserver.java
similarity index 81%
rename from tests/SignatureTest/src/android/tests/sigtest/ResultObserver.java
rename to tests/signature/src/android/signature/cts/ResultObserver.java
index e9d2260..33234e9 100644
--- a/tests/SignatureTest/src/android/tests/sigtest/ResultObserver.java
+++ b/tests/signature/src/android/signature/cts/ResultObserver.java
@@ -14,9 +14,8 @@
* limitations under the License.
*/
-package android.tests.sigtest;
+package android.signature.cts;
-import android.tests.sigtest.SignatureTest.FAILURE_TYPE;
/**
* Interface for saving signature test result.
*/
@@ -27,8 +26,6 @@
* @param name Name of the failed element (interface/class/method/field)
* @param errorMessage a descriptive message indicating why it failed.
*/
- void notifyFailure(FAILURE_TYPE type,
- String name,
- String errorMessage);
+ void notifyFailure(FailureType type, String name, String errorMessage);
}
diff --git a/tests/SignatureTest/src/android/tests/sigtest/SignatureTest.java b/tests/signature/src/android/signature/cts/SignatureTest.java
similarity index 91%
rename from tests/SignatureTest/src/android/tests/sigtest/SignatureTest.java
rename to tests/signature/src/android/signature/cts/SignatureTest.java
index 8ae02ac3..e3099a9 100644
--- a/tests/SignatureTest/src/android/tests/sigtest/SignatureTest.java
+++ b/tests/signature/src/android/signature/cts/SignatureTest.java
@@ -14,13 +14,15 @@
* limitations under the License.
*/
-package android.tests.sigtest;
+package android.signature.cts;
import android.content.res.Resources;
+import android.signature.R;
+import android.signature.cts.JDiffClassDescription.JDiffConstructor;
+import android.signature.cts.JDiffClassDescription.JDiffField;
+import android.signature.cts.JDiffClassDescription.JDiffMethod;
import android.test.AndroidTestCase;
-import android.tests.sigtest.JDiffClassDescription.JDiffConstructor;
-import android.tests.sigtest.JDiffClassDescription.JDiffField;
-import android.tests.sigtest.JDiffClassDescription.JDiffMethod;
+import android.util.Log;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@@ -37,6 +39,8 @@
*/
public class SignatureTest extends AndroidTestCase {
+ private static final String TAG = SignatureTest.class.getSimpleName();
+
private static final String TAG_ROOT = "api";
private static final String TAG_PACKAGE = "package";
private static final String TAG_CLASS = "class";
@@ -70,26 +74,12 @@
private HashSet<String> mKeyTagSet;
private TestResultObserver mResultObserver;
- /**
- * Define the type of the signature check failures.
- */
- public static enum FAILURE_TYPE {
- MISSING_CLASS,
- MISSING_INTERFACE,
- MISSING_METHOD,
- MISSING_FIELD,
- MISMATCH_CLASS,
- MISMATCH_INTERFACE,
- MISMATCH_METHOD,
- MISMATCH_FIELD,
- CAUGHT_EXCEPTION,
- }
-
private class TestResultObserver implements ResultObserver {
boolean mDidFail = false;
StringBuilder mErrorString = new StringBuilder();
- public void notifyFailure(FAILURE_TYPE type, String name, String errorMessage) {
+ @Override
+ public void notifyFailure(FailureType type, String name, String errorMessage) {
mDidFail = true;
mErrorString.append("\n");
mErrorString.append(type.toString().toLowerCase());
@@ -116,12 +106,14 @@
public void testSignature() {
Resources r = getContext().getResources();
Class rClass = R.xml.class;
+ logd(String.format("Class: %s", rClass.toString()));
Field[] fs = rClass.getFields();
for (Field f : fs) {
+ logd(String.format("Field: %s", fs.toString()));
try {
start(r.getXml(f.getInt(rClass)));
} catch (Exception e) {
- mResultObserver.notifyFailure(FAILURE_TYPE.CAUGHT_EXCEPTION, e.getMessage(),
+ mResultObserver.notifyFailure(FailureType.CAUGHT_EXCEPTION, e.getMessage(),
e.getMessage());
}
}
@@ -150,6 +142,11 @@
* Signature test entry point.
*/
private void start(XmlPullParser parser) throws XmlPullParserException, IOException {
+ logd(String.format("Parser: %s", parser.getName()));
+ logd(String.format("Parser: %s", parser.getNamespace()));
+ logd(String.format("Parser: %s", parser.getLineNumber()));
+ logd(String.format("Parser: %s", parser.getColumnNumber()));
+ logd(String.format("Parser: %s", parser.getPositionDescription()));
JDiffClassDescription currentClass = null;
String currentPackage = "";
JDiffMethod currentMethod = null;
@@ -332,4 +329,12 @@
}
return modifier;
}
+
+ public static void loge(String msg, Exception e) {
+ Log.e(TAG, msg, e);
+ }
+
+ public static void logd(String msg) {
+ Log.d(TAG, msg);
+ }
}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageDef.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageDef.java
index 45c176a..51df9e7 100644
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageDef.java
+++ b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageDef.java
@@ -60,9 +60,6 @@
public static final String UIAUTOMATOR_TEST = "uiAutomator";
public static final String JUNIT_DEVICE_TEST = "jUnitDeviceTest";
- private static final String SIGNATURE_TEST_METHOD = "testSignature";
- private static final String SIGNATURE_TEST_CLASS = "android.tests.sigtest.SignatureTest";
-
private String mAppPackageName = null;
private String mAppNameSpace = null;
private String mName = null;
@@ -70,7 +67,6 @@
private String mTestType = null;
private String mJarPath = null;
private String mRunTimeArgs = null;
- private boolean mIsSignatureTest = false;
private String mTestPackageName = null;
private String mDigest = null;
private IAbi mAbi = null;
@@ -176,14 +172,6 @@
return mJarPath;
}
- void setIsSignatureCheck(boolean isSignatureCheckTest) {
- mIsSignatureTest = isSignatureCheckTest;
- }
-
- boolean isSignatureCheck() {
- return mIsSignatureTest;
- }
-
void setTestPackageName(String testPackageName) {
mTestPackageName = testPackageName;
}
@@ -288,26 +276,6 @@
} else if (UIAUTOMATOR_TEST.equals(mTestType)) {
UiAutomatorJarTest uiautomatorTest = new UiAutomatorJarTest();
return setUiAutomatorTest(uiautomatorTest);
- } else if (mIsSignatureTest) {
- // TODO: hardcode the runner/class/method for now, since current package xml points to
- // specialized instrumentation. Eventually this special case for signatureTest can be
- // removed, and it can be treated just like a normal InstrumentationTest
- CLog.d("Creating signature test %s", mName);
- CtsInstrumentationApkTest instrTest = new CtsInstrumentationApkTest();
- instrTest.setPackageName(mAppNameSpace);
- instrTest.setRunnerName("android.test.InstrumentationTestRunner");
- instrTest.setClassName(SIGNATURE_TEST_CLASS);
- instrTest.setMethodName(SIGNATURE_TEST_METHOD);
- instrTest.setAbi(mAbi);
- mTests.clear();
- // set expected tests to the single signature test
- TestIdentifier t = new TestIdentifier(
- SIGNATURE_TEST_CLASS, SIGNATURE_TEST_METHOD);
- mTests.add(t);
- // mName means 'apk file name' for instrumentation tests
- instrTest.addInstallApk(String.format("%s.apk", mName), mAppNameSpace);
- mDigest = generateDigest(testCaseDir, String.format("%s.apk", mName));
- return instrTest;
} else if (JUNIT_DEVICE_TEST.equals(mTestType)){
CLog.d("Creating JUnit device test %s", mName);
JUnitDeviceTest jUnitDeviceTest = new JUnitDeviceTest();
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageXmlParser.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageXmlParser.java
index 71279c7..8f4f1b0 100644
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageXmlParser.java
+++ b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageXmlParser.java
@@ -82,7 +82,6 @@
final String packageName = attributes.getValue("name");
final String runnerName = attributes.getValue("runner");
final String jarPath = attributes.getValue("jarPath");
- final boolean signatureCheck = parseBoolean(attributes.getValue("signatureCheck"));
final String javaPackageFilter = attributes.getValue("javaPackageFilter");
final String targetBinaryName = attributes.getValue("targetBinaryName");
final String targetNameSpace = attributes.getValue("targetNameSpace");
@@ -98,7 +97,6 @@
packageDef.setRunner(runnerName);
packageDef.setTestType(testType);
packageDef.setJarPath(jarPath);
- packageDef.setIsSignatureCheck(signatureCheck);
packageDef.setRunTimeArgs(runTimeArgs);
if (!"".equals(javaPackageFilter)) {
packageDef.setTestPackageName(javaPackageFilter);
diff --git a/tools/tradefed-host/tests/Android.mk b/tools/tradefed-host/tests/Android.mk
index 7d4ab4a..2734a5b 100644
--- a/tools/tradefed-host/tests/Android.mk
+++ b/tools/tradefed-host/tests/Android.mk
@@ -24,6 +24,4 @@
LOCAL_JAVA_LIBRARIES := tradefed-prebuilt cts-tradefed
LOCAL_STATIC_JAVA_LIBRARIES := easymock
-include $(BUILD_HOST_JAVA_LIBRARY)
-
-
+include $(BUILD_HOST_JAVA_LIBRARY)
\ No newline at end of file
diff --git a/tools/utils/buildCts.py b/tools/utils/buildCts.py
index cdd6e10..85adb0c 100755
--- a/tools/utils/buildCts.py
+++ b/tools/utils/buildCts.py
@@ -78,9 +78,6 @@
"""Generate test descriptions for all packages."""
pool = Pool(processes=2)
- # individually generate descriptions not following conventions
- pool.apply_async(GenerateSignatureCheckDescription, [self.test_repository])
-
# generate test descriptions for android tests
results = []
pool.close()
@@ -118,7 +115,7 @@
plan.Exclude('android\.performance.*')
self.__WritePlan(plan, 'SDK')
- plan.Exclude(r'android\.tests\.sigtest')
+ plan.Exclude(r'android\.signature')
plan.Exclude(r'android\.core.*')
self.__WritePlan(plan, 'Android')
@@ -137,10 +134,6 @@
self.__WritePlan(plan, 'VM-TF')
plan = tools.TestPlan(packages)
- plan.Include(r'android\.tests\.sigtest')
- self.__WritePlan(plan, 'Signature')
-
- plan = tools.TestPlan(packages)
plan.Include(r'android\.tests\.appsecurity')
self.__WritePlan(plan, 'AppSecurity')
@@ -328,6 +321,7 @@
'android.rscpp' : [],
'android.rsg' : [],
'android.sax' : [],
+ 'android.signature' : [],
'android.speech' : [],
'android.tests.appsecurity' : [],
'android.text' : [],
@@ -370,7 +364,7 @@
'android.location2' : [],
'android.print' : [],
'android.renderscriptlegacy' : [],
- 'android.tests.sigtest' : [],
+ 'android.signature' : [],
'android.tv' : [],
'android.uiautomation' : [],
'android.uirendering' : [],
@@ -434,18 +428,6 @@
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.testSignature')
- description = open(os.path.join(test_repository, 'SignatureTest.xml'), 'w')
- package.WriteDescription(description)
- description.close()
-
if __name__ == '__main__':
builder = CtsBuilder(sys.argv)
result = builder.GenerateTestDescriptions()