diff options
| author | 2012-03-14 14:54:29 -0700 | |
|---|---|---|
| committer | 2012-03-14 14:54:29 -0700 | |
| commit | 0c15f85824ed87884ff7b6da6b5f30f06f954a0d (patch) | |
| tree | df40da5361c815510435cfa661af1927fbec20a2 | |
| parent | 8ac59597294363f7900c03e9d1e8418936242da8 (diff) | |
| parent | bf29121c215b30bed8cb886f1b6c7d71eb36a49d (diff) | |
Merge "Try to make error messages more useful and improve ANR handling"
| -rw-r--r-- | tests/SmokeTest/tests/src/com/android/smoketest/ProcessErrorsTest.java | 38 | ||||
| -rw-r--r-- | tests/SmokeTest/tests/src/com/android/smoketest/SmokeTestRunner.java | 2 |
2 files changed, 20 insertions, 20 deletions
diff --git a/tests/SmokeTest/tests/src/com/android/smoketest/ProcessErrorsTest.java b/tests/SmokeTest/tests/src/com/android/smoketest/ProcessErrorsTest.java index b4aa116ced7d..b3a260050a52 100644 --- a/tests/SmokeTest/tests/src/com/android/smoketest/ProcessErrorsTest.java +++ b/tests/SmokeTest/tests/src/com/android/smoketest/ProcessErrorsTest.java @@ -143,15 +143,6 @@ public class ProcessErrorsTest extends AndroidTestCase { // ignore } - // See if there are any errors - final Collection<ProcessError> errProcs = - ProcessError.fromCollection(mActivityManager.getProcessesInErrorState()); - // Take the difference between the error processes we see now, and the ones that were - // present when we started - if (errProcs != null && preErrProcs != null) { - errProcs.removeAll(preErrProcs); - } - // Send the "home" intent and wait 2 seconds for us to get there getContext().startActivity(mHomeIntent); try { @@ -160,15 +151,22 @@ public class ProcessErrorsTest extends AndroidTestCase { // ignore } + // See if there are any errors. We wait until down here to give ANRs as much time as + // possible to occur. + final Collection<ProcessError> errProcs = + ProcessError.fromCollection(mActivityManager.getProcessesInErrorState()); + // Take the difference between the error processes we see now, and the ones that were + // present when we started + if (errProcs != null && preErrProcs != null) { + errProcs.removeAll(preErrProcs); + } + return errProcs; } /** * A test that runs all Launcher-launchable activities and verifies that no ANRs or crashes * happened while doing so. - * <p /> - * FIXME: Doesn't detect multiple crashing apps properly, since the crash dialog for the - * FIXME: first app doesn't go away. */ public void testRunAllActivities() throws Exception { final Set<ProcessError> errSet = new HashSet<ProcessError>(); @@ -181,7 +179,7 @@ public class ProcessErrorsTest extends AndroidTestCase { } if (!errSet.isEmpty()) { - fail(String.format("Got %d errors: %s", errSet.size(), + fail(String.format("Got %d errors:\n%s", errSet.size(), reportWrappedListContents(errSet))); } } @@ -212,19 +210,21 @@ public class ProcessErrorsTest extends AndroidTestCase { String condition; switch (entry.condition) { case ActivityManager.ProcessErrorStateInfo.CRASHED: - condition = "CRASHED"; + condition = "a CRASH"; break; case ActivityManager.ProcessErrorStateInfo.NOT_RESPONDING: - condition = "ANR"; + condition = "an ANR"; break; default: - condition = "<unknown>"; + condition = "an unknown error"; break; } - builder.append("Process error ").append(condition).append(" "); - builder.append(" ").append(entry.shortMsg); - builder.append(" detected in ").append(entry.processName).append(" ").append(entry.tag); + builder.append(String.format("Process %s encountered %s (%s)", entry.processName, + condition, entry.shortMsg)); + if (entry.condition == ActivityManager.ProcessErrorStateInfo.CRASHED) { + builder.append(String.format(" with stack trace:\n%s\n", entry.stackTrace)); + } builder.append("\n"); } return builder.toString(); diff --git a/tests/SmokeTest/tests/src/com/android/smoketest/SmokeTestRunner.java b/tests/SmokeTest/tests/src/com/android/smoketest/SmokeTestRunner.java index 6ef90d61986f..51331fe84e82 100644 --- a/tests/SmokeTest/tests/src/com/android/smoketest/SmokeTestRunner.java +++ b/tests/SmokeTest/tests/src/com/android/smoketest/SmokeTestRunner.java @@ -79,7 +79,7 @@ public class SmokeTestRunner extends InstrumentationTestRunner { } if (!errSet.isEmpty()) { - fail(String.format("Got %d errors: %s", errSet.size(), + fail(String.format("Got %d errors:\n%s", errSet.size(), reportWrappedListContents(errSet))); } } |