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

Unified Diff: build/android/symbolize_test.py

Issue 19010004: Update build/android/symbolize.py to match base/debug/stack_trace_android.cc format. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/symbolize.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/symbolize_test.py
diff --git a/build/android/symbolize_test.py b/build/android/symbolize_test.py
index bbd5eead7cf7b78a609183833b9d0d4d272d6f5a..dc633d331c91e0271dbdd2a1fd31756b0831cdae 100755
--- a/build/android/symbolize_test.py
+++ b/build/android/symbolize_test.py
@@ -21,6 +21,9 @@ import unittest
import symbolize
+LIB_A_PATH = '/build/android/tests/symbolize/liba.so'
+LIB_B_PATH = '/build/android/tests/symbolize/libb.so'
+
def RunSymbolizer(text):
output = StringIO.StringIO()
s = symbolize.Symbolizer(StringIO.StringIO(text), output)
@@ -31,87 +34,94 @@ def RunSymbolizer(text):
class SymbolizerUnittest(unittest.TestCase):
def testSingleLineNoMatch(self):
# Leading '#' is required.
- expected = '00 pc 00000254 /build/android/tests/symbolize/liba.so\n'
+ expected = '00 0x00000000 ' + LIB_A_PATH + '+0x00000254\n'
self.assertEqual(expected, RunSymbolizer(expected))
# Whitespace should be exactly one space.
- expected = '#00 pc 00000254 /build/android/tests/symbolize/liba.so\n'
- self.assertEqual(expected, RunSymbolizer(expected))
- expected = '#00 pc 00000254 /build/android/tests/symbolize/liba.so\n'
+ expected = '#00 0x00000000 ' + LIB_A_PATH + '+0x00000254\n'
self.assertEqual(expected, RunSymbolizer(expected))
- expected = '#00 pc 00000254 /build/android/tests/symbolize/liba.so\n'
+ expected = '#00 0x00000000 ' + LIB_A_PATH + '+0x00000254\n'
self.assertEqual(expected, RunSymbolizer(expected))
# Decimal stack frame numbers are required.
- expected = '#0a pc 00000254 /build/android/tests/symbolize/liba.so\n'
- self.assertEqual(expected, RunSymbolizer(expected))
-
- # Lowercase 'pc' token is required.
- expected = '#00 PC 00000254 /build/android/tests/symbolize/liba.so\n'
+ expected = '#0a 0x00000000 ' + LIB_A_PATH + '+0x00000254\n'
self.assertEqual(expected, RunSymbolizer(expected))
# Hexadecimal addresses are required.
- expected = '#00 pc ghijklmn /build/android/tests/symbolize/liba.so\n'
+ expected = '#00 0xghijklmn ' + LIB_A_PATH + '+0x00000254\n'
+ self.assertEqual(expected, RunSymbolizer(expected))
+ expected = '#00 0x00000000 ' + LIB_A_PATH + '+0xghijklmn\n'
self.assertEqual(expected, RunSymbolizer(expected))
# Addresses must be exactly 8 characters.
- expected = '#00 pc 254 /build/android/tests/symbolize/liba.so\n'
- self.assertEqual(expected, RunSymbolizer(expected))
- expected = '#00 pc 0254 /build/android/tests/symbolize/liba.so\n'
+ expected = '#00 0x0000000 ' + LIB_A_PATH + '+0x00000254\n'
self.assertEqual(expected, RunSymbolizer(expected))
- expected = '#00 pc 00254 /build/android/tests/symbolize/liba.so\n'
+ expected = '#00 0x000000000 ' + LIB_A_PATH + '+0x00000254\n'
self.assertEqual(expected, RunSymbolizer(expected))
- expected = '#00 pc 000254 /build/android/tests/symbolize/liba.so\n'
+
+ expected = '#00 0x0000000 ' + LIB_A_PATH + '+0x0000254\n'
self.assertEqual(expected, RunSymbolizer(expected))
- expected = '#00 pc 0000254 /build/android/tests/symbolize/liba.so\n'
+ expected = '#00 0x000000000 ' + LIB_A_PATH + '+0x000000254\n'
self.assertEqual(expected, RunSymbolizer(expected))
- # Addresses must not be prefixed with '0x'.
- expected = '#00 pc 0x00000254 /build/android/tests/symbolize/liba.so\n'
+ # Addresses must be prefixed with '0x'.
+ expected = '#00 00000000 ' + LIB_A_PATH + '+0x00000254\n'
+ self.assertEqual(expected, RunSymbolizer(expected))
+ expected = '#00 0x00000000 ' + LIB_A_PATH + '+00000254\n'
self.assertEqual(expected, RunSymbolizer(expected))
# Library name is required.
- expected = '#00 pc 00000254\n'
+ expected = '#00 0x00000000\n'
+ self.assertEqual(expected, RunSymbolizer(expected))
+ expected = '#00 0x00000000 +0x00000254\n'
+ self.assertEqual(expected, RunSymbolizer(expected))
+
+ # Library name must be followed by offset with no spaces around '+'.
+ expected = '#00 0x00000000 ' + LIB_A_PATH + ' +0x00000254\n'
+ self.assertEqual(expected, RunSymbolizer(expected))
+ expected = '#00 0x00000000 ' + LIB_A_PATH + '+ 0x00000254\n'
+ self.assertEqual(expected, RunSymbolizer(expected))
+ expected = '#00 0x00000000 ' + LIB_A_PATH + ' 0x00000254\n'
+ self.assertEqual(expected, RunSymbolizer(expected))
+ expected = '#00 0x00000000 ' + LIB_A_PATH + '+\n'
self.assertEqual(expected, RunSymbolizer(expected))
def testSingleLine(self):
- text = '#00 pc 00000254 /build/android/tests/symbolize/liba.so\n'
- expected = '#00 pc 00000254 A::Bar(char const*)\n'
+ text = '#00 0x00000000 ' + LIB_A_PATH + '+0x00000254\n'
+ expected = '#00 0x00000000 A::Bar(char const*)\n'
actual = RunSymbolizer(text)
self.assertEqual(expected, actual)
def testSingleLineWithSurroundingText(self):
- text = 'LEFT #00 pc 00000254 /build/android/tests/symbolize/liba.so RIGHT\n'
- expected = 'LEFT #00 pc 00000254 A::Bar(char const*) RIGHT\n'
+ text = 'LEFT #00 0x00000000 ' + LIB_A_PATH + '+0x00000254 RIGHT\n'
+ expected = 'LEFT #00 0x00000000 A::Bar(char const*) RIGHT\n'
actual = RunSymbolizer(text)
self.assertEqual(expected, actual)
def testMultipleLinesSameLibrary(self):
- text = '#00 pc 00000254 /build/android/tests/symbolize/liba.so\n'
- text += '#01 pc 00000234 /build/android/tests/symbolize/liba.so\n'
- expected = '#00 pc 00000254 A::Bar(char const*)\n'
- expected += '#01 pc 00000234 A::Foo(int)\n'
+ text = '#00 0x00000000 ' + LIB_A_PATH + '+0x00000254\n'
+ text += '#01 0x00000000 ' + LIB_A_PATH + '+0x00000234\n'
+ expected = '#00 0x00000000 A::Bar(char const*)\n'
+ expected += '#01 0x00000000 A::Foo(int)\n'
actual = RunSymbolizer(text)
self.assertEqual(expected, actual)
def testMultipleLinesDifferentLibrary(self):
- text = '#00 pc 00000254 /build/android/tests/symbolize/liba.so\n'
- text += '#01 pc 00000234 /build/android/tests/symbolize/libb.so\n'
- expected = '#00 pc 00000254 A::Bar(char const*)\n'
- expected += '#01 pc 00000234 B::Baz(float)\n'
+ text = '#00 0x00000000 ' + LIB_A_PATH + '+0x00000254\n'
+ text += '#01 0x00000000 ' + LIB_B_PATH + '+0x00000234\n'
+ expected = '#00 0x00000000 A::Bar(char const*)\n'
+ expected += '#01 0x00000000 B::Baz(float)\n'
actual = RunSymbolizer(text)
self.assertEqual(expected, actual)
def testMultipleLinesWithSurroundingTextEverywhere(self):
text = 'TOP\n'
- text += ('LEFT #00 pc 00000254 '
- '/build/android/tests/symbolize/liba.so RIGHT\n')
- text += ('LEFT #01 pc 00000234 '
- '/build/android/tests/symbolize/libb.so RIGHT\n')
+ text += 'LEFT #00 0x00000000 ' + LIB_A_PATH + '+0x00000254 RIGHT\n'
+ text += 'LEFT #01 0x00000000 ' + LIB_B_PATH + '+0x00000234 RIGHT\n'
text += 'BOTTOM\n'
expected = 'TOP\n'
- expected += 'LEFT #00 pc 00000254 A::Bar(char const*) RIGHT\n'
- expected += 'LEFT #01 pc 00000234 B::Baz(float) RIGHT\n'
+ expected += 'LEFT #00 0x00000000 A::Bar(char const*) RIGHT\n'
+ expected += 'LEFT #01 0x00000000 B::Baz(float) RIGHT\n'
expected += 'BOTTOM\n'
actual = RunSymbolizer(text)
self.assertEqual(expected, actual)
« no previous file with comments | « build/android/symbolize.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698