summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEric Rowe <erowe@google.com>2013-03-19 11:28:41 -0700
committerEric Rowe <erowe@google.com>2013-03-19 16:06:00 -0700
commitf1d71ef83c53b4e12434bd1ee32073c349f9faa3 (patch)
tree55246282bb7ed72af2befffcccd0edfc90209451 /tests
parent891a0cb4f32ee00b3ea3d3dfbcd09aaab2f5796f (diff)
downloadloganalysis-f1d71ef83c53b4e12434bd1ee32073c349f9faa3.tar.gz
Add dumpsys parser for bugreports.
Change-Id: I526c6c73d5dbb33921b52a27dfabe5aae29e63ba
Diffstat (limited to 'tests')
-rw-r--r--tests/src/com/android/loganalysis/parser/DumpsysParserTest.java58
1 files changed, 58 insertions, 0 deletions
diff --git a/tests/src/com/android/loganalysis/parser/DumpsysParserTest.java b/tests/src/com/android/loganalysis/parser/DumpsysParserTest.java
new file mode 100644
index 0000000..9561b7b
--- /dev/null
+++ b/tests/src/com/android/loganalysis/parser/DumpsysParserTest.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2013 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.loganalysis.parser;
+
+import com.android.loganalysis.item.DumpsysItem;
+
+import junit.framework.TestCase;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Unit tests for {@link DumpsysParser}
+ */
+public class DumpsysParserTest extends TestCase {
+
+ /**
+ * Test that the dumpsys section of the bugreport is parsed.
+ */
+ public void testParse() {
+ List<String> inputBlock = Arrays.asList(
+ "-------------------------------------------------------------------------------",
+ "DUMP OF SERVICE process1:",
+ "-------------------------------------------------------------------------------",
+ "DUMP OF SERVICE batteryinfo:",
+ "Statistics since last unplugged:",
+ " Kernel Wake lock \"PowerManagerService.WakeLocks\": 5m 10s 61ms (2 times) realtime",
+ " Kernel Wake lock \"pm8921_eoc\": 9s 660ms (0 times) realtime",
+ "",
+ " All partial wake locks:",
+ " Wake lock #0 partialWakelock: 5m 9s 260ms (1 times) realtime",
+ " Wake lock #1000 AlarmManager: 422ms (7 times) realtime",
+ "",
+ "-------------------------------------------------------------------------------",
+ "DUMP OF SERVICE process2:",
+ "-------------------------------------------------------------------------------");
+
+ DumpsysParser parser = new DumpsysParser();
+ DumpsysItem item = parser.parse(inputBlock);
+
+ assertNotNull(item.getBatteryInfo());
+ assertEquals(2, item.getBatteryInfo().getLastUnpluggedWakeLock().size());
+ assertEquals(2, item.getBatteryInfo().getLastUnpluggedKernelWakeLock().size());
+ }
+}