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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 """Tests for the native crash dump symbolizer utility functions."""
6
7 import unittest
8 import stack_utils
9
10
11 class StackUtilsTest(unittest.TestCase):
12 """Tests the native crash dump symbolizer utility functions."""
13
14 def test_GetSymbolMapping_no_match(self):
15 """Verifies that, if no mapping is on the input, no mapping is on the
16 output.
17 """
18 lines = ["This is a test case\n", "Caching all mojo apps", ""]
19 self.assertDictEqual({}, stack_utils.GetSymbolMapping(lines))
20
21 def test_GetSymbolMapping_simple_match(self):
22 """Verifies a simple symbol mapping."""
23 lines = ["This is a test case\n", "Caching all mojo apps",
24 "I/mojo(2): [INFO:somefile.cc(85)] Caching mojo app "
25 "https://apps.mojo/myapp.mojo at /path/to/myapp.mojo/.lM03ws"]
26 golden_dict = {
27 "/path/to/myapp.mojo/.lM03ws": "libmyapp_library.so"
28 }
29 actual_dict = stack_utils.GetSymbolMapping(lines)
30 self.assertDictEqual(golden_dict, actual_dict)
31
32 def test_GetSymbolMapping_multiple_match(self):
33 """Verifies mapping of multiple symbol files."""
34 lines = ["This is a test case\n", "Caching all mojo apps",
35 "I/mojo(2): [INFO:somefile.cc(85)] Caching mojo app "
36 "https://apps.mojo/myapp.mojo at /path/to/myapp.mojo/.lM03ws",
37 "I/mojo(2): [INFO:somefile.cc(85)] Caching mojo app "
38 "https://apps.mojo/otherapp.mojo at /path/to/otherapp.mojo/.kW07s"]
39 golden_dict = {
40 "/path/to/myapp.mojo/.lM03ws": "libmyapp_library.so",
41 "/path/to/otherapp.mojo/.kW07s": "libotherapp_library.so"
42 }
43 actual_dict = stack_utils.GetSymbolMapping(lines)
44 self.assertDictEqual(golden_dict, actual_dict)
45
46 def test_GetSymbolMapping_parameter_match(self):
47 """Verifies parameters are stripped from mappings."""
48 lines = ["This is a test case\n", "Caching all mojo apps",
49 "I/mojo(2): [INFO:somefile.cc(85)] Caching mojo app "
50 "https://apps.mojo/myapp.mojo?q=hello at /path/to/myapp.mojo/.lM03ws"]
51 golden_dict = {
52 "/path/to/myapp.mojo/.lM03ws": "libmyapp_library.so"
53 }
54 actual_dict = stack_utils.GetSymbolMapping(lines)
55 self.assertDictEqual(golden_dict, actual_dict)
56
57 def test_GetSymbolMapping_normalize(self):
58 """Verifies paths are normalized in mappings."""
59 lines = ["This is a test case\n", "Caching all mojo apps",
60 "I/mojo(2): [INFO:somefile.cc(85)] Caching mojo app "
61 "https://apps.mojo/myapp.mojo at /path/to/.//myapp.mojo/.lM03ws"]
62 golden_dict = {
63 "/path/to/myapp.mojo/.lM03ws": "libmyapp_library.so"
64 }
65 actual_dict = stack_utils.GetSymbolMapping(lines)
66 self.assertDictEqual(golden_dict, actual_dict)
67
68
69 if __name__ == "__main__":
70 unittest.main()
OLDNEW
« 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