| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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 functools | 6 import functools |
| 7 import logging | 7 import logging |
| 8 import os | 8 import os |
| 9 import sys | 9 import sys |
| 10 import unittest | 10 import unittest |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 self.assertTrue(isinstance(sym_info, elf_symbolizer.ELFSymbolInfo)) | 148 self.assertTrue(isinstance(sym_info, elf_symbolizer.ELFSymbolInfo)) |
| 149 self.assertTrue(isinstance(cb_arg, tuple)) | 149 self.assertTrue(isinstance(cb_arg, tuple)) |
| 150 self.assertEqual(len(cb_arg), 5) | 150 self.assertEqual(len(cb_arg), 5) |
| 151 | 151 |
| 152 # Unpack expectations from the callback extra argument. | 152 # Unpack expectations from the callback extra argument. |
| 153 (addr, exp_name, exp_source_path, exp_source_line, exp_inlines) = cb_arg | 153 (addr, exp_name, exp_source_path, exp_source_line, exp_inlines) = cb_arg |
| 154 if exp_name is None: | 154 if exp_name is None: |
| 155 self.assertIsNone(sym_info.name) | 155 self.assertIsNone(sym_info.name) |
| 156 else: | 156 else: |
| 157 self.assertTrue(sym_info.name.startswith(exp_name)) | 157 self.assertTrue(sym_info.name.startswith(exp_name)) |
| 158 if not exp_source_path is None: |
| 159 exp_source_path = os.path.abspath(exp_source_path) |
| 158 self.assertEqual(sym_info.source_path, exp_source_path) | 160 self.assertEqual(sym_info.source_path, exp_source_path) |
| 159 self.assertEqual(sym_info.source_line, exp_source_line) | 161 self.assertEqual(sym_info.source_line, exp_source_line) |
| 160 | 162 |
| 161 if exp_inlines: | 163 if exp_inlines: |
| 162 self.assertEqual(sym_info.name, exp_name + '_inner') | 164 self.assertEqual(sym_info.name, exp_name + '_inner') |
| 163 self.assertEqual(sym_info.inlined_by.name, exp_name + '_middle') | 165 self.assertEqual(sym_info.inlined_by.name, exp_name + '_middle') |
| 164 self.assertEqual(sym_info.inlined_by.inlined_by.name, | 166 self.assertEqual(sym_info.inlined_by.inlined_by.name, |
| 165 exp_name + '_outer') | 167 exp_name + '_outer') |
| 166 | 168 |
| 167 # Check against duplicate callbacks. | 169 # Check against duplicate callbacks. |
| 168 self.assertNotIn(addr, self._resolved_addresses) | 170 self.assertNotIn(addr, self._resolved_addresses) |
| 169 self._resolved_addresses.add(addr) | 171 self._resolved_addresses.add(addr) |
| 170 | 172 |
| 171 | 173 |
| 172 if __name__ == '__main__': | 174 if __name__ == '__main__': |
| 173 unittest.main() | 175 unittest.main() |
| OLD | NEW |