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

Side by Side Diff: tools/cygprofile/symbol_extractor_unittest.py

Issue 947073003: Improve symbol_extractor.CreateNameToSymbolInfo handling of duplicate symbols. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo. Created 5 years, 10 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
« no previous file with comments | « tools/cygprofile/symbol_extractor.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright 2015 The Chromium Authors. All rights reserved. 2 # Copyright 2015 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import symbol_extractor 6 import symbol_extractor
7 import unittest 7 import unittest
8 8
9 class TestSymbolInfo(unittest.TestCase): 9 class TestSymbolInfo(unittest.TestCase):
10 def testIgnoresBlankLine(self): 10 def testIgnoresBlankLine(self):
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 def testCreateNameToSymbolInfo(self): 97 def testCreateNameToSymbolInfo(self):
98 name_to_symbol_info = symbol_extractor.CreateNameToSymbolInfo( 98 name_to_symbol_info = symbol_extractor.CreateNameToSymbolInfo(
99 self.symbol_infos) 99 self.symbol_infos)
100 self.assertEquals(len(name_to_symbol_info), 3) 100 self.assertEquals(len(name_to_symbol_info), 3)
101 for i in range(3): 101 for i in range(3):
102 name = self.symbol_infos[i].name 102 name = self.symbol_infos[i].name
103 self.assertIn(name, name_to_symbol_info) 103 self.assertIn(name, name_to_symbol_info)
104 self.assertEquals(self.symbol_infos[i], name_to_symbol_info[name]) 104 self.assertEquals(self.symbol_infos[i], name_to_symbol_info[name])
105 105
106 def testSymbolCollisions(self):
107 symbol_infos_with_collision = list(self.symbol_infos)
108 symbol_infos_with_collision.append(symbol_extractor.SymbolInfo(
109 'secondNameAtOffset', 0x84, 42, '.text'))
110
111 # The symbol added above should not affect the output.
112 name_to_symbol_info = symbol_extractor.CreateNameToSymbolInfo(
113 self.symbol_infos)
114 self.assertEquals(len(name_to_symbol_info), 3)
115 for i in range(3):
116 name = self.symbol_infos[i].name
117 self.assertIn(name, name_to_symbol_info)
118 self.assertEquals(self.symbol_infos[i], name_to_symbol_info[name])
106 119
107 if __name__ == '__main__': 120 if __name__ == '__main__':
108 unittest.main() 121 unittest.main()
OLDNEW
« no previous file with comments | « tools/cygprofile/symbol_extractor.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698