aboutsummaryrefslogtreecommitdiffstats
path: root/ddms/libs
diff options
context:
space:
mode:
authorBrett Chabot <brettchabot@android.com>2011-10-14 21:42:40 -0700
committerBrett Chabot <brettchabot@android.com>2011-10-14 21:42:40 -0700
commit8f9f5eed3bd1a313ec540afce2e3dda3e22b977b (patch)
treedcc1c53ad83ad7ac61c7b2123ce73d4c57eb56ca /ddms/libs
parentef84e152934dc22c58011c6a6b3fcadf0c406642 (diff)
downloadsdk-8f9f5eed3bd1a313ec540afce2e3dda3e22b977b.zip
sdk-8f9f5eed3bd1a313ec540afce2e3dda3e22b977b.tar.gz
sdk-8f9f5eed3bd1a313ec540afce2e3dda3e22b977b.tar.bz2
Make InstrumentationResultParser less chatty on unexpected output.
Bug 5459282 Change-Id: Ib3069b628f476cf73649802f51b7bb22b6ceebaa
Diffstat (limited to 'ddms/libs')
-rw-r--r--ddms/libs/ddmlib/src/com/android/ddmlib/testrunner/InstrumentationResultParser.java5
-rw-r--r--ddms/libs/ddmlib/tests/src/com/android/ddmlib/testrunner/InstrumentationResultParserTest.java20
2 files changed, 23 insertions, 2 deletions
diff --git a/ddms/libs/ddmlib/src/com/android/ddmlib/testrunner/InstrumentationResultParser.java b/ddms/libs/ddmlib/src/com/android/ddmlib/testrunner/InstrumentationResultParser.java
index 22648a9..cbb1c5a 100644
--- a/ddms/libs/ddmlib/src/com/android/ddmlib/testrunner/InstrumentationResultParser.java
+++ b/ddms/libs/ddmlib/src/com/android/ddmlib/testrunner/InstrumentationResultParser.java
@@ -327,7 +327,7 @@ public class InstrumentationResultParser extends MultiLineReceiver {
try {
testInfo.mNumTests = Integer.parseInt(statusValue);
} catch (NumberFormatException e) {
- Log.e(LOG_TAG, "Unexpected integer number of tests, received "
+ Log.w(LOG_TAG, "Unexpected integer number of tests, received "
+ statusValue);
}
} else if (mCurrentKey.equals(StatusKeys.ERROR)) {
@@ -404,7 +404,8 @@ public class InstrumentationResultParser extends MultiLineReceiver {
try {
testInfo.mCode = Integer.parseInt(value);
} catch (NumberFormatException e) {
- Log.e(LOG_TAG, "Expected integer status code, received: " + value);
+ Log.w(LOG_TAG, "Expected integer status code, received: " + value);
+ testInfo.mCode = StatusCodes.ERROR;
}
if (testInfo.mCode != StatusCodes.IN_PROGRESS) {
// this means we're done with current test result bundle
diff --git a/ddms/libs/ddmlib/tests/src/com/android/ddmlib/testrunner/InstrumentationResultParserTest.java b/ddms/libs/ddmlib/tests/src/com/android/ddmlib/testrunner/InstrumentationResultParserTest.java
index 650e79c..0bbb20e 100644
--- a/ddms/libs/ddmlib/tests/src/com/android/ddmlib/testrunner/InstrumentationResultParserTest.java
+++ b/ddms/libs/ddmlib/tests/src/com/android/ddmlib/testrunner/InstrumentationResultParserTest.java
@@ -208,6 +208,26 @@ public class InstrumentationResultParserTest extends TestCase {
}
/**
+ * Test parsing output when a status code cannot be parsed
+ */
+ public void testParse_invalidCode() {
+ StringBuilder output = new StringBuilder();
+ addLine(output, "android.util.AndroidException: INSTRUMENTATION_FAILED: foo/foo");
+ addLine(output, "INSTRUMENTATION_STATUS: id=ActivityManagerService");
+ addLine(output, "INSTRUMENTATION_STATUS: Error=Unable to find instrumentation target package: foo");
+ addLine(output, "INSTRUMENTATION_STATUS_CODE: -1at com.android.commands.am.Am.runInstrument(Am.java:532)");
+ addLine(output, "");
+ addLine(output, " at com.android.commands.am.Am.run(Am.java:111)");
+ addLineBreak(output);
+
+ mMockListener.testRunStarted(RUN_NAME, 0);
+ mMockListener.testRunFailed((String)EasyMock.anyObject());
+ mMockListener.testRunEnded(0, Collections.EMPTY_MAP);
+
+ injectAndVerifyTestString(output.toString());
+ }
+
+ /**
* Test parsing output for a test run failure, where an instrumentation component failed to
* load.
* <p/>