summaryrefslogtreecommitdiff
path: root/tests/src
diff options
context:
space:
mode:
authorMaxim Siniavine <siniavine@google.com>2017-04-05 11:14:09 -0700
committerMaxim Siniavine <siniavine@google.com>2017-04-05 12:27:45 -0700
commit1d082700cdcf9faa5b761c8e1f3618208efa2e77 (patch)
tree1b76f321eb415f82571d065f5e6966a714c286ee /tests/src
parentffcec1bb6c2be881d65994f727b3c5d1c5b7210f (diff)
downloadloganalysis-1d082700cdcf9faa5b761c8e1f3618208efa2e77.tar.gz
Fix logcat parsing in bugreports.
A UID column was added to the logcat log. Update the regular expresion to accept the new column. BUG: 36891877 TEST: Run local unit test. Run command line parser to parse bugreport. Change-Id: I514f5d81edacd4296959e30ebc63796c347c74f5
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/com/android/loganalysis/parser/LogcatParserTest.java72
1 files changed, 72 insertions, 0 deletions
diff --git a/tests/src/com/android/loganalysis/parser/LogcatParserTest.java b/tests/src/com/android/loganalysis/parser/LogcatParserTest.java
index 7adeed6..1d4f72c 100644
--- a/tests/src/com/android/loganalysis/parser/LogcatParserTest.java
+++ b/tests/src/com/android/loganalysis/parser/LogcatParserTest.java
@@ -442,6 +442,78 @@ public class LogcatParserTest extends TestCase {
assertEquals(3064, logcat.getJavaCrashes().get(0).getPid().intValue());
assertEquals(3082, logcat.getJavaCrashes().get(0).getTid().intValue());
+ assertEquals(
+ parseTime("2012-04-25 09:55:47.799"),
+ logcat.getJavaCrashes().get(0).getEventTime());
+
+ assertEquals(3065, logcat.getJavaCrashes().get(1).getPid().intValue());
+ assertEquals(3090, logcat.getJavaCrashes().get(1).getTid().intValue());
+ assertEquals(
+ parseTime("2012-04-25 09:55:47.799"),
+ logcat.getJavaCrashes().get(1).getEventTime());
+
+ assertEquals(3112, logcat.getNativeCrashes().get(0).getPid().intValue());
+ assertEquals(3112, logcat.getNativeCrashes().get(0).getTid().intValue());
+ assertEquals(
+ parseTime("2012-04-25 18:33:27.273"),
+ logcat.getNativeCrashes().get(0).getEventTime());
+
+ assertEquals(3113, logcat.getNativeCrashes().get(1).getPid().intValue());
+ assertEquals(3113, logcat.getNativeCrashes().get(1).getTid().intValue());
+ assertEquals(
+ parseTime("2012-04-25 18:33:27.273"),
+ logcat.getNativeCrashes().get(1).getEventTime());
+ }
+
+ /** Test that including extra uid column still parses the logs. */
+ public void testParse_uid() throws ParseException {
+ List<String> lines =
+ Arrays.asList(
+ "04-25 09:55:47.799 wifi 3064 3082 E AndroidRuntime: java.lang.Exception",
+ "04-25 09:55:47.799 wifi 3064 3082 E AndroidRuntime: \tat class.method1(Class.java:1)",
+ "04-25 09:55:47.799 wifi 3064 3082 E AndroidRuntime: \tat class.method2(Class.java:2)",
+ "04-25 09:55:47.799 wifi 3064 3082 E AndroidRuntime: \tat class.method3(Class.java:3)",
+ "04-25 09:55:47.799 wifi 3065 3090 E AndroidRuntime: java.lang.Exception",
+ "04-25 09:55:47.799 wifi 3065 3090 E AndroidRuntime: \tat class.method1(Class.java:1)",
+ "04-25 09:55:47.799 wifi 3065 3090 E AndroidRuntime: \tat class.method2(Class.java:2)",
+ "04-25 09:55:47.799 wifi 3065 3090 E AndroidRuntime: \tat class.method3(Class.java:3)",
+ "04-25 17:17:08.445 1337 312 366 E ActivityManager: ANR (application not responding) in process: com.android.package",
+ "04-25 17:17:08.445 1337 312 366 E ActivityManager: Reason: keyDispatchingTimedOut",
+ "04-25 17:17:08.445 1337 312 366 E ActivityManager: Load: 0.71 / 0.83 / 0.51",
+ "04-25 17:17:08.445 1337 312 366 E ActivityManager: 33% TOTAL: 21% user + 11% kernel + 0.3% iowait",
+ "04-25 17:17:08.445 1337 312 366 E ActivityManager: ANR (application not responding) in process: com.android.package",
+ "04-25 17:17:08.445 1337 312 366 E ActivityManager: Reason: keyDispatchingTimedOut",
+ "04-25 17:17:08.445 1337 312 366 E ActivityManager: Load: 0.71 / 0.83 / 0.51",
+ "04-25 17:17:08.445 1337 312 366 E ActivityManager: 33% TOTAL: 21% user + 11% kernel + 0.3% iowait",
+ "04-25 18:33:27.273 wifi123 115 115 I DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***",
+ "04-25 18:33:27.273 wifi123 115 115 I DEBUG : Build fingerprint: 'product:build:target'",
+ "04-25 18:33:27.273 wifi123 115 115 I DEBUG : pid: 3112, tid: 3112 >>> com.google.android.browser <<<",
+ "04-25 18:33:27.273 wifi123 115 115 I DEBUG : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000",
+ "04-25 18:33:27.273 wifi123 117 117 I DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***",
+ "04-25 18:33:27.273 wifi123 117 117 I DEBUG : Build fingerprint: 'product:build:target'",
+ "04-25 18:33:27.273 wifi123 117 117 I DEBUG : pid: 3113, tid: 3113 >>> com.google.android.browser <<<",
+ "04-25 18:33:27.273 wifi123 117 117 I 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 09:55:47.799"), logcat.getStartTime());
+ assertEquals(parseTime("2012-04-25 18:33:27.273"), logcat.getStopTime());
+ assertEquals(6, logcat.getEvents().size());
+ assertEquals(2, logcat.getAnrs().size());
+ assertEquals(2, logcat.getJavaCrashes().size());
+ assertEquals(2, logcat.getNativeCrashes().size());
+
+ assertEquals(312, logcat.getAnrs().get(0).getPid().intValue());
+ assertEquals(366, logcat.getAnrs().get(0).getTid().intValue());
+ assertEquals(parseTime("2012-04-25 17:17:08.445"), logcat.getAnrs().get(0).getEventTime());
+
+ assertEquals(312, logcat.getAnrs().get(1).getPid().intValue());
+ assertEquals(366, logcat.getAnrs().get(1).getTid().intValue());
+ assertEquals(parseTime("2012-04-25 17:17:08.445"), logcat.getAnrs().get(1).getEventTime());
+
+ assertEquals(3064, logcat.getJavaCrashes().get(0).getPid().intValue());
+ assertEquals(3082, logcat.getJavaCrashes().get(0).getTid().intValue());
assertEquals(parseTime("2012-04-25 09:55:47.799"),
logcat.getJavaCrashes().get(0).getEventTime());