Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(426)

Unified Diff: mojo/devtools/common/android_stack_parser/stack_utils_unittest.py

Issue 1306603002: Improve android stack parser (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/devtools/common/android_stack_parser/stack_utils.py ('k') | mojo/tools/run_mojo_python_tests.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/devtools/common/android_stack_parser/stack_utils_unittest.py
diff --git a/mojo/devtools/common/android_stack_parser/stack_utils_unittest.py b/mojo/devtools/common/android_stack_parser/stack_utils_unittest.py
new file mode 100644
index 0000000000000000000000000000000000000000..6329aa6b8721e2c95b6a68431a276584bdcb0961
--- /dev/null
+++ b/mojo/devtools/common/android_stack_parser/stack_utils_unittest.py
@@ -0,0 +1,70 @@
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Tests for the native crash dump symbolizer utility functions."""
+
+import unittest
+import stack_utils
+
+
+class StackUtilsTest(unittest.TestCase):
+ """Tests the native crash dump symbolizer utility functions."""
+
+ def test_GetSymbolMapping_no_match(self):
+ """Verifies that, if no mapping is on the input, no mapping is on the
+ output.
+ """
+ lines = ["This is a test case\n", "Caching all mojo apps", ""]
+ self.assertDictEqual({}, stack_utils.GetSymbolMapping(lines))
+
+ def test_GetSymbolMapping_simple_match(self):
+ """Verifies a simple symbol mapping."""
+ lines = ["This is a test case\n", "Caching all mojo apps",
+ "I/mojo(2): [INFO:somefile.cc(85)] Caching mojo app "
+ "https://apps.mojo/myapp.mojo at /path/to/myapp.mojo/.lM03ws"]
+ golden_dict = {
+ "/path/to/myapp.mojo/.lM03ws": "libmyapp_library.so"
+ }
+ actual_dict = stack_utils.GetSymbolMapping(lines)
+ self.assertDictEqual(golden_dict, actual_dict)
+
+ def test_GetSymbolMapping_multiple_match(self):
+ """Verifies mapping of multiple symbol files."""
+ lines = ["This is a test case\n", "Caching all mojo apps",
+ "I/mojo(2): [INFO:somefile.cc(85)] Caching mojo app "
+ "https://apps.mojo/myapp.mojo at /path/to/myapp.mojo/.lM03ws",
+ "I/mojo(2): [INFO:somefile.cc(85)] Caching mojo app "
+ "https://apps.mojo/otherapp.mojo at /path/to/otherapp.mojo/.kW07s"]
+ golden_dict = {
+ "/path/to/myapp.mojo/.lM03ws": "libmyapp_library.so",
+ "/path/to/otherapp.mojo/.kW07s": "libotherapp_library.so"
+ }
+ actual_dict = stack_utils.GetSymbolMapping(lines)
+ self.assertDictEqual(golden_dict, actual_dict)
+
+ def test_GetSymbolMapping_parameter_match(self):
+ """Verifies parameters are stripped from mappings."""
+ lines = ["This is a test case\n", "Caching all mojo apps",
+ "I/mojo(2): [INFO:somefile.cc(85)] Caching mojo app "
+ "https://apps.mojo/myapp.mojo?q=hello at /path/to/myapp.mojo/.lM03ws"]
+ golden_dict = {
+ "/path/to/myapp.mojo/.lM03ws": "libmyapp_library.so"
+ }
+ actual_dict = stack_utils.GetSymbolMapping(lines)
+ self.assertDictEqual(golden_dict, actual_dict)
+
+ def test_GetSymbolMapping_normalize(self):
+ """Verifies paths are normalized in mappings."""
+ lines = ["This is a test case\n", "Caching all mojo apps",
+ "I/mojo(2): [INFO:somefile.cc(85)] Caching mojo app "
+ "https://apps.mojo/myapp.mojo at /path/to/.//myapp.mojo/.lM03ws"]
+ golden_dict = {
+ "/path/to/myapp.mojo/.lM03ws": "libmyapp_library.so"
+ }
+ actual_dict = stack_utils.GetSymbolMapping(lines)
+ self.assertDictEqual(golden_dict, actual_dict)
+
+
+if __name__ == "__main__":
+ unittest.main()
« no previous file with comments | « mojo/devtools/common/android_stack_parser/stack_utils.py ('k') | mojo/tools/run_mojo_python_tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698