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

Side by Side Diff: tools/deep_memory_profiler/tests/dmprof_test.py

Issue 15511005: Breakdown "unhooked" memory regions by VMA pathnames and permissions. (Closed) Base URL: git@github.com:dmikurube/chromium.git@work
Patch Set: addressed bulach's comment Created 7 years, 6 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/deep_memory_profiler/policy.t0.json ('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/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 cStringIO 6 import cStringIO
7 import logging 7 import logging
8 import os 8 import os
9 import sys 9 import sys
10 import textwrap 10 import textwrap
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 self.assertEqual('POLICY_DEEP_3', policy.version) 169 self.assertEqual('POLICY_DEEP_3', policy.version)
170 170
171 def test_find(self): 171 def test_find(self):
172 policy = dmprof.Policy.parse(cStringIO.StringIO(self._TEST_POLICY), 'json') 172 policy = dmprof.Policy.parse(cStringIO.StringIO(self._TEST_POLICY), 'json')
173 self.assertTrue(policy) 173 self.assertTrue(policy)
174 174
175 symbol_mapping_cache = self.MockSymbolMappingCache() 175 symbol_mapping_cache = self.MockSymbolMappingCache()
176 symbol_mapping_cache.add(FUNCTION_SYMBOLS, 0x1212, 'v8::create') 176 symbol_mapping_cache.add(FUNCTION_SYMBOLS, 0x1212, 'v8::create')
177 symbol_mapping_cache.add(FUNCTION_SYMBOLS, 0x1381, 'WebKit::create') 177 symbol_mapping_cache.add(FUNCTION_SYMBOLS, 0x1381, 'WebKit::create')
178 178
179 bucket1 = dmprof.Bucket([0x1212, 0x013], False, 0x29492, '_Z') 179 bucket1 = dmprof.Bucket([0x1212, 0x013], 'malloc', 0x29492, '_Z')
180 bucket1.symbolize(symbol_mapping_cache) 180 bucket1.symbolize(symbol_mapping_cache)
181 bucket2 = dmprof.Bucket([0x18242, 0x1381], False, 0x9492, '_Z') 181 bucket2 = dmprof.Bucket([0x18242, 0x1381], 'malloc', 0x9492, '_Z')
182 bucket2.symbolize(symbol_mapping_cache) 182 bucket2.symbolize(symbol_mapping_cache)
183 bucket3 = dmprof.Bucket([0x18242, 0x181], False, 0x949, '_Z') 183 bucket3 = dmprof.Bucket([0x18242, 0x181], 'malloc', 0x949, '_Z')
184 bucket3.symbolize(symbol_mapping_cache) 184 bucket3.symbolize(symbol_mapping_cache)
185 185
186 self.assertEqual('malloc-v8', policy.find(bucket1)) 186 self.assertEqual('malloc-v8', policy.find(bucket1))
187 self.assertEqual('malloc-WebKit', policy.find(bucket2)) 187 self.assertEqual('malloc-WebKit', policy.find(bucket2))
188 self.assertEqual('malloc-catch-all', policy.find(bucket3)) 188 self.assertEqual('malloc-catch-all', policy.find(bucket3))
189 189
190 190
191 class BucketsCommandTest(unittest.TestCase): 191 class BucketsCommandTest(unittest.TestCase):
192 def test(self): 192 def test(self):
193 with open(os.path.join(ROOT_DIR, 'tests', 'output', 'buckets')) as output_f: 193 with open(os.path.join(ROOT_DIR, 'tests', 'output', 'buckets')) as output_f:
(...skipping 19 matching lines...) Expand all
213 os.path.join(ROOT_DIR, 'tests', 'data', 'heap.01234.0001.heap'), 213 os.path.join(ROOT_DIR, 'tests', 'data', 'heap.01234.0001.heap'),
214 'gs://test-storage/']) 214 'gs://test-storage/'])
215 self.assertEqual(0, returncode) 215 self.assertEqual(0, returncode)
216 216
217 217
218 if __name__ == '__main__': 218 if __name__ == '__main__':
219 logging.basicConfig( 219 logging.basicConfig(
220 level=logging.DEBUG if '-v' in sys.argv else logging.ERROR, 220 level=logging.DEBUG if '-v' in sys.argv else logging.ERROR,
221 format='%(levelname)5s %(filename)15s(%(lineno)3d): %(message)s') 221 format='%(levelname)5s %(filename)15s(%(lineno)3d): %(message)s')
222 unittest.main() 222 unittest.main()
OLDNEW
« no previous file with comments | « tools/deep_memory_profiler/policy.t0.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698