summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEric Rowe <erowe@google.com>2015-05-07 14:56:21 -0700
committerEric Rowe <erowe@google.com>2015-05-07 14:56:21 -0700
commitca0291775a05e7800dae05cb31db7f1702b44348 (patch)
treef86d114bd6b9e335e82b2077a1741393f5c65c8a /tests
parent29a6e07bab66064c455db27394147103919bfdb2 (diff)
downloadloganalysis-ca0291775a05e7800dae05cb31db7f1702b44348.tar.gz
Allow logcat parser to match F DEBUG
Native crashes sometimes appear in logcat with F DEBUG as the level and tag. Refactor the crash tag mechanism to allow for 2 signatures for native crashes but keep it private (for now) since there isn't a public need to add more (like there is for Java crashes). Bug: 20917511 Change-Id: Ieae63d45553ac8cf92977d69028783b7367c2162
Diffstat (limited to 'tests')
-rw-r--r--tests/src/com/android/loganalysis/parser/LogcatParserTest.java29
1 files changed, 27 insertions, 2 deletions
diff --git a/tests/src/com/android/loganalysis/parser/LogcatParserTest.java b/tests/src/com/android/loganalysis/parser/LogcatParserTest.java
index 9b6dff0..2b521a1 100644
--- a/tests/src/com/android/loganalysis/parser/LogcatParserTest.java
+++ b/tests/src/com/android/loganalysis/parser/LogcatParserTest.java
@@ -283,9 +283,9 @@ public class LogcatParserTest extends TestCase {
}
/**
- * Test that native crashes can be parsed.
+ * Test that native crashes can be parsed from the info log level.
*/
- public void testParse_native_crash() throws ParseException {
+ public void testParse_native_crash_info() throws ParseException {
List<String> lines = Arrays.asList(
"04-25 18:33:27.273 115 115 I DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***",
"04-25 18:33:27.273 115 115 I DEBUG : Build fingerprint: 'product:build:target'",
@@ -308,6 +308,31 @@ public class LogcatParserTest extends TestCase {
}
/**
+ * Test that native crashes can be parsed from the fatal log level.
+ */
+ public void testParse_native_crash_fatal() throws ParseException {
+ List<String> lines = Arrays.asList(
+ "04-25 18:33:27.273 115 115 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***",
+ "04-25 18:33:27.273 115 115 F DEBUG : Build fingerprint: 'product:build:target'",
+ "04-25 18:33:27.273 115 115 F DEBUG : pid: 3112, tid: 3112, name: Name >>> com.google.android.browser <<<",
+ "04-25 18:33:27.273 115 115 F DEBUG : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000");
+
+ LogcatItem logcat = new LogcatParser("2012").parse(lines);
+ assertNotNull(logcat);
+ assertEquals(parseTime("2012-04-25 18:33:27.273"), logcat.getStartTime());
+ assertEquals(parseTime("2012-04-25 18:33:27.273"), logcat.getStopTime());
+ assertEquals(1, logcat.getEvents().size());
+ assertEquals(1, logcat.getNativeCrashes().size());
+ assertEquals(3112, logcat.getNativeCrashes().get(0).getPid().intValue());
+ assertEquals(3112, logcat.getNativeCrashes().get(0).getTid().intValue());
+ assertEquals("com.google.android.browser", logcat.getNativeCrashes().get(0).getApp());
+ assertEquals("", logcat.getNativeCrashes().get(0).getLastPreamble());
+ assertEquals("", logcat.getNativeCrashes().get(0).getProcessPreamble());
+ assertEquals(parseTime("2012-04-25 18:33:27.273"),
+ logcat.getNativeCrashes().get(0).getEventTime());
+ }
+
+ /**
* Test that native crashes can be parsed if they have the same pid/tid.
*/
public void testParse_native_crash_same_pid() throws ParseException {