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

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.
ppi 2015/08/21 14:53:07 nit: the closing """ on the first line if the enti
etiennej 2015/08/21 15:07:18 Done.
13 """
14
15 def test_GetSymbolMapping_no_match(self):
16 """Verifies that, if no mapping is on the input, no mapping is on the
17 output.
18 """
19 lines = ["This is a test case\n", "Caching all mojo apps", ""]
20 self.assertDictEqual({}, stack_utils.GetSymbolMapping(lines))
21
22 def test_GetSymbolMapping_simple_match(self):
23 """Verifies a simple symbol mapping.
24 """
ppi 2015/08/21 14:53:07 ditto, and same in the others below
etiennej 2015/08/21 15:07:18 Done.
25 lines = ["This is a test case\n", "Caching all mojo apps",
26 "I/mojo(2): [INFO:somefile.cc(85)] Caching mojo app "
27 "https://apps.mojo/myapp.mojo at /path/to/myapp.mojo/.lM03ws"]
28 golden_dict = {
29 "/path/to/myapp.mojo/.lM03ws": "libmyapp_library.so"
30 }
31 actual_dict = stack_utils.GetSymbolMapping(lines)
32 self.assertDictEqual(golden_dict, actual_dict)
33
34 def test_GetSymbolMapping_multiple_match(self):
35 """Verifies mapping of multiple symbol files.
36 """
37 lines = ["This is a test case\n", "Caching all mojo apps",
38 "I/mojo(2): [INFO:somefile.cc(85)] Caching mojo app "
39 "https://apps.mojo/myapp.mojo at /path/to/myapp.mojo/.lM03ws",
40 "I/mojo(2): [INFO:somefile.cc(85)] Caching mojo app "
41 "https://apps.mojo/otherapp.mojo at /path/to/otherapp.mojo/.kW07s"]
42 golden_dict = {
43 "/path/to/myapp.mojo/.lM03ws": "libmyapp_library.so",
44 "/path/to/otherapp.mojo/.kW07s": "libotherapp_library.so"
45 }
46 actual_dict = stack_utils.GetSymbolMapping(lines)
47 self.assertDictEqual(golden_dict, actual_dict)
48
49 def test_GetSymbolMapping_parameter_match(self):
50 """Verifies parameters are stripped from mappings.
51 """
52 lines = ["This is a test case\n", "Caching all mojo apps",
53 "I/mojo(2): [INFO:somefile.cc(85)] Caching mojo app "
54 "https://apps.mojo/myapp.mojo?q=hello at /path/to/myapp.mojo/.lM03ws"]
55 golden_dict = {
56 "/path/to/myapp.mojo/.lM03ws": "libmyapp_library.so"
57 }
58 actual_dict = stack_utils.GetSymbolMapping(lines)
59 self.assertDictEqual(golden_dict, actual_dict)
60
61 def test_GetSymbolMapping_normalize(self):
62 """Verifies paths are normalized in mappings.
63 """
64 lines = ["This is a test case\n", "Caching all mojo apps",
65 "I/mojo(2): [INFO:somefile.cc(85)] Caching mojo app "
66 "https://apps.mojo/myapp.mojo at /path/to/.//myapp.mojo/.lM03ws"]
67 golden_dict = {
68 "/path/to/myapp.mojo/.lM03ws": "libmyapp_library.so"
69 }
70 actual_dict = stack_utils.GetSymbolMapping(lines)
71 self.assertDictEqual(golden_dict, actual_dict)
72
73
74 if __name__ == "__main__":
75 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698