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 | |
19 import StringIO | 18 import StringIO |
20 import unittest | 19 import unittest |
21 | 20 |
22 import symbolize | 21 import symbolize |
23 | 22 |
24 LIB_A_PATH = '/build/android/tests/symbolize/liba.so' | 23 LIB_A_PATH = '/build/android/tests/symbolize/liba.so' |
25 LIB_B_PATH = '/build/android/tests/symbolize/libb.so' | 24 LIB_B_PATH = '/build/android/tests/symbolize/libb.so' |
26 | 25 |
27 def RunSymbolizer(text): | 26 def RunSymbolizer(text): |
28 output = StringIO.StringIO() | 27 output = StringIO.StringIO() |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 expected = 'TOP\n' | 121 expected = 'TOP\n' |
123 expected += 'LEFT #00 0x00000000 A::Bar(char const*) RIGHT\n' | 122 expected += 'LEFT #00 0x00000000 A::Bar(char const*) RIGHT\n' |
124 expected += 'LEFT #01 0x00000000 B::Baz(float) RIGHT\n' | 123 expected += 'LEFT #01 0x00000000 B::Baz(float) RIGHT\n' |
125 expected += 'BOTTOM\n' | 124 expected += 'BOTTOM\n' |
126 actual = RunSymbolizer(text) | 125 actual = RunSymbolizer(text) |
127 self.assertEqual(expected, actual) | 126 self.assertEqual(expected, actual) |
128 | 127 |
129 | 128 |
130 if __name__ == '__main__': | 129 if __name__ == '__main__': |
131 unittest.main() | 130 unittest.main() |
OLD | NEW |