diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 18:28:45 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 18:28:45 -0800 |
commit | d83a98f4ce9cfa908f5c54bbd70f03eec07e7553 (patch) | |
tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 /tests/SmokeTest | |
parent | 076357b8567458d4b6dfdcf839ef751634cd2bfb (diff) | |
download | frameworks_base-d83a98f4ce9cfa908f5c54bbd70f03eec07e7553.zip frameworks_base-d83a98f4ce9cfa908f5c54bbd70f03eec07e7553.tar.gz frameworks_base-d83a98f4ce9cfa908f5c54bbd70f03eec07e7553.tar.bz2 |
auto import from //depot/cupcake/@135843
Diffstat (limited to 'tests/SmokeTest')
-rw-r--r-- | tests/SmokeTest/Android.mk | 16 | ||||
-rw-r--r-- | tests/SmokeTest/AndroidManifest.xml | 32 | ||||
-rw-r--r-- | tests/SmokeTest/README | 8 | ||||
-rw-r--r-- | tests/SmokeTest/src/com/android/smoketest/SmokeTestActivity.java | 41 | ||||
-rw-r--r-- | tests/SmokeTest/tests/Android.mk | 21 | ||||
-rw-r--r-- | tests/SmokeTest/tests/AndroidManifest.xml | 37 | ||||
-rw-r--r-- | tests/SmokeTest/tests/src/com/android/smoketest/ProcessErrorsTest.java | 117 |
7 files changed, 0 insertions, 272 deletions
diff --git a/tests/SmokeTest/Android.mk b/tests/SmokeTest/Android.mk deleted file mode 100644 index 0adfd4c..0000000 --- a/tests/SmokeTest/Android.mk +++ /dev/null @@ -1,16 +0,0 @@ -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := tests - -# This builds "SmokeTestApp" -LOCAL_SRC_FILES := $(call all-java-files-under, src) - -LOCAL_JAVA_LIBRARIES := android.test.runner - -LOCAL_PACKAGE_NAME := SmokeTestApp - -include $(BUILD_PACKAGE) - -# This builds "SmokeTest" -include $(call all-makefiles-under,$(LOCAL_PATH))
\ No newline at end of file diff --git a/tests/SmokeTest/AndroidManifest.xml b/tests/SmokeTest/AndroidManifest.xml deleted file mode 100644 index f141bdc..0000000 --- a/tests/SmokeTest/AndroidManifest.xml +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- 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. ---> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.smoketest"> - - <application> - <uses-library android:name="android.test.runner" /> - <activity android:name=".SmokeTestActivity" - android:label="Smoke Tests"> - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.TEST" /> - </intent-filter> - </activity> - - </application> - -</manifest> diff --git a/tests/SmokeTest/README b/tests/SmokeTest/README deleted file mode 100644 index 40218cf..0000000 --- a/tests/SmokeTest/README +++ /dev/null @@ -1,8 +0,0 @@ -The tests in this folder are a very controlled set of tests that will be run by -the build system on every single build. They are intended to run very quickly. -Please use caution when adding tests here. - -If you wish to run these tests, issue the command: - -adb shell am instrument \ - -w com.android.smoketest/.tests.SmokeTestInstrumentationTestRunner diff --git a/tests/SmokeTest/src/com/android/smoketest/SmokeTestActivity.java b/tests/SmokeTest/src/com/android/smoketest/SmokeTestActivity.java deleted file mode 100644 index 6bc5fd2..0000000 --- a/tests/SmokeTest/src/com/android/smoketest/SmokeTestActivity.java +++ /dev/null @@ -1,41 +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 com.android.smoketest; - -import android.app.LauncherActivity; -import android.content.Intent; - -/** - * Initial launcher for UI access to smoke tests. This does not actually launch the tests, - * it simply provides manual access to the various UI activities that are used by the tests. - * - * To run all of the tests in this suite: - * adb shell am instrument \ - * -w com.android.smoketest/.tests.SmokeTestInstrumentationTestRunner - */ -public class SmokeTestActivity extends LauncherActivity { - - @Override - protected Intent getTargetIntent() { - // TODO: partition into categories by label like the sample code app - Intent targetIntent = new Intent(Intent.ACTION_MAIN, null); - // TODO: Do we add a new top-level intent? Or just leave it hardcoded like this? - targetIntent.addCategory("android.intent.category.SMOKETEST_INSTRUMENTATION_TEST"); - targetIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - return targetIntent; - } -} diff --git a/tests/SmokeTest/tests/Android.mk b/tests/SmokeTest/tests/Android.mk deleted file mode 100644 index 86bf23d..0000000 --- a/tests/SmokeTest/tests/Android.mk +++ /dev/null @@ -1,21 +0,0 @@ -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -# We only want this apk build for tests. -LOCAL_MODULE_TAGS := tests - -LOCAL_JAVA_LIBRARIES := android.test.runner - -# Include all test java files. -LOCAL_SRC_FILES := $(call all-java-files-under, src) - -# Notice that we don't have to include the src files of SmokeTestApp because, by -# running the tests using an instrumentation targeting SmokeTestApp, we -# automatically get all of its classes loaded into our environment. - -LOCAL_PACKAGE_NAME := SmokeTest - -LOCAL_INSTRUMENTATION_FOR := SmokeTestApp - -include $(BUILD_PACKAGE) - diff --git a/tests/SmokeTest/tests/AndroidManifest.xml b/tests/SmokeTest/tests/AndroidManifest.xml deleted file mode 100644 index 517eb1e..0000000 --- a/tests/SmokeTest/tests/AndroidManifest.xml +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2007 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 name must be unique so suffix with "tests" so package loader doesn't ignore us --> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.smoketest.tests"> - - <!-- We add an application tag here just so that we can indicate that - this package needs to link against the android.test library, - which is needed when building test cases. --> - <application> - <uses-library android:name="android.test.runner" /> - </application> - - <!-- - This declares that this app uses the instrumentation test runner targeting - the package of com.android.smoketest. To run the tests use the command: - "adb shell am instrument -w com.android.smoketest.tests/android.test.InstrumentationTestRunner" - --> - <instrumentation android:name="android.test.InstrumentationTestRunner" - android:targetPackage="com.android.smoketest" - android:label="System Smoke Tests"/> - -</manifest> diff --git a/tests/SmokeTest/tests/src/com/android/smoketest/ProcessErrorsTest.java b/tests/SmokeTest/tests/src/com/android/smoketest/ProcessErrorsTest.java deleted file mode 100644 index 85b91f1..0000000 --- a/tests/SmokeTest/tests/src/com/android/smoketest/ProcessErrorsTest.java +++ /dev/null @@ -1,117 +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 com.android.smoketest; - -import com.android.internal.os.RuntimeInit; - -import android.app.ActivityManager; -import android.content.Context; -import android.server.data.CrashData; -import android.test.AndroidTestCase; -import android.util.Log; - -import java.util.Iterator; -import java.util.List; - -/** - * This smoke test is designed to quickly sniff for any error conditions - * encountered after initial startup. - */ -public class ProcessErrorsTest extends AndroidTestCase { - - private final String TAG = "ProcessErrorsTest"; - - protected ActivityManager mActivityManager; - - @Override - public void setUp() throws Exception { - super.setUp(); - mActivityManager = (ActivityManager) - getContext().getSystemService(Context.ACTIVITY_SERVICE); - } - - public void testSetUpConditions() throws Exception { - assertNotNull(mActivityManager); - } - - public void testNoProcessErrors() throws Exception { - List<ActivityManager.ProcessErrorStateInfo> errList; - errList = mActivityManager.getProcessesInErrorState(); - - // note: this contains information about each process that is currently in an error - // condition. if the list is empty (null) then "we're good". - - // if the list is non-empty, then it's useful to report the contents of the list - // we'll put a copy in the log, and we'll report it back to the framework via the assert. - final String reportMsg = reportListContents(errList); - if (reportMsg != null) { - Log.w(TAG, reportMsg); - } - - // report a non-empty list back to the test framework - assertNull(reportMsg, errList); - } - - /** - * This helper function will dump the actual error reports. - * - * @param errList The error report containing one or more error records. - * @return Returns a string containing all of the errors. - */ - private String reportListContents(List<ActivityManager.ProcessErrorStateInfo> errList) { - if (errList == null) return null; - - StringBuilder builder = new StringBuilder(); - - Iterator<ActivityManager.ProcessErrorStateInfo> iter = errList.iterator(); - while (iter.hasNext()) { - ActivityManager.ProcessErrorStateInfo entry = iter.next(); - - String condition; - switch (entry.condition) { - case ActivityManager.ProcessErrorStateInfo.CRASHED: - condition = "CRASHED"; - break; - case ActivityManager.ProcessErrorStateInfo.NOT_RESPONDING: - condition = "ANR"; - break; - default: - condition = "<unknown>"; - break; - } - - String stackTrace = null; - try { - if (entry.crashData != null) { - CrashData cd = RuntimeInit.unmarshallException(entry.crashData); - stackTrace = cd.toString(); - } - } catch (RuntimeException e) { } - if (stackTrace == null) { - stackTrace = "<no stack trace>"; - } - - final String entryReport = "Process error " + condition + " " + entry.shortMsg + - " detected in " + entry.processName + " " + entry.tag + - ". \n" + stackTrace; - - builder.append(entryReport).append(" "); - } - return builder.toString(); - } - -} |