| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright 2013 The Chromium Authors. All rights reserved. | 3 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """Unittest for symbolize.py. | 7 """Unittest for symbolize.py. |
| 8 | 8 |
| 9 This test uses test libraries generated by the Android g++ toolchain. | 9 This test uses test libraries generated by the Android g++ toolchain. |
| 10 | 10 |
| 11 Should things break you can recreate the libraries and get the updated | 11 Should things break you can recreate the libraries and get the updated |
| 12 addresses and demangled names by running the following: | 12 addresses and demangled names by running the following: |
| 13 cd test/symbolize/ | 13 cd test/symbolize/ |
| 14 make | 14 make |
| 15 nm -gC *.so | 15 nm -gC *.so |
| 16 """ | 16 """ |
| 17 | 17 |
| 18 import sys |
| 18 import StringIO | 19 import StringIO |
| 19 import unittest | 20 import unittest |
| 20 | 21 |
| 21 import symbolize | 22 import symbolize |
| 22 | 23 |
| 23 LIB_A_PATH = '/build/android/tests/symbolize/liba.so' | 24 LIB_A_PATH = '/build/android/tests/symbolize/liba.so' |
| 24 LIB_B_PATH = '/build/android/tests/symbolize/libb.so' | 25 LIB_B_PATH = '/build/android/tests/symbolize/libb.so' |
| 25 | 26 |
| 26 def RunSymbolizer(text): | 27 def RunSymbolizer(text): |
| 27 output = StringIO.StringIO() | 28 output = StringIO.StringIO() |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 expected = 'TOP\n' | 122 expected = 'TOP\n' |
| 122 expected += 'LEFT #00 0x00000000 A::Bar(char const*) RIGHT\n' | 123 expected += 'LEFT #00 0x00000000 A::Bar(char const*) RIGHT\n' |
| 123 expected += 'LEFT #01 0x00000000 B::Baz(float) RIGHT\n' | 124 expected += 'LEFT #01 0x00000000 B::Baz(float) RIGHT\n' |
| 124 expected += 'BOTTOM\n' | 125 expected += 'BOTTOM\n' |
| 125 actual = RunSymbolizer(text) | 126 actual = RunSymbolizer(text) |
| 126 self.assertEqual(expected, actual) | 127 self.assertEqual(expected, actual) |
| 127 | 128 |
| 128 | 129 |
| 129 if __name__ == '__main__': | 130 if __name__ == '__main__': |
| 130 unittest.main() | 131 unittest.main() |
| OLD | NEW |