[Lldb-commits] [lldb] r356096 - [Python] Fix TestDataFormatterSmartArray to work across python versions.

Davide Italiano via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 13 13:04:34 PDT 2019


Author: davide
Date: Wed Mar 13 13:04:34 2019
New Revision: 356096

URL: http://llvm.org/viewvc/llvm-project?rev=356096&view=rev
Log:
[Python] Fix TestDataFormatterSmartArray to work across python versions.

Python 3 default encoding is utf-8, so taking random bytes and
interpreting them as a string might result in invalid unicode sequences.
As the only thing we care about here is that the formatter shows the
elements of the underyling array, relax the string matching (this is
good enough as all the elements are distinct so they resolve to different
strings).

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py?rev=356096&r1=356095&r2=356096&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py Wed Mar 13 13:04:34 2019
@@ -412,26 +412,26 @@ class SmartArrayDataFormatterTestCase(Te
                 "frame variable flarr",
                 substrs=[
                     'flarr = arr =',
-                    '00 00 9d 42             ...B,00 80 9a 42             ...B,00 00 9c 42             ...B,00 40 98 42             . at .B,00 80 99 42             ...B,00 c0 99 42             ...B,00 00 9a 42             ...B'])
+                    '00 00 9d 42', '00 80 9a 42', '00 00 9c 42', '00 40 98 42', '00 80 99 42', '00 c0 99 42', '00 00 9a 42'])
         else:
             self.expect(
                 "frame variable flarr",
                 substrs=[
                     'flarr = arr =',
-                    '42 9d 00 00             B...,42 9a 80 00             B...,42 9c 00 00             B...,42 98 40 00             B. at .,42 99 80 00             B...,42 99 c0 00             B...,42 9a 00 00             B...'])
+                    '42 9d 00 00', '42 9a 80 00', '42 9c 00 00', '42 98 40 00', '42 99 80 00', '42 99 c0 00', '42 9a 00 00'])
 
         if process.GetByteOrder() == lldb.eByteOrderLittle:
             self.expect(
                 "frame variable other.flarr",
                 substrs=[
                     'flarr = arr =',
-                    '00 00 cc 41             ...A,00 00 ca 41             ...A,00 00 c9 41             ...A,00 00 d6 41             ...A,00 00 db 41             ...A,00 00 dc 41             ...A,00 00 d1 41             ...A'])
+                    '00 00 cc 41', '00 00 ca 41', '00 00 c9 41', '00 00 d6 41', '00 00 db 41', '00 00 dc 41', '00 00 d1 41'])
         else:
             self.expect(
                 "frame variable other.flarr",
                 substrs=[
                     'flarr = arr =',
-                    '41 cc 00 00             A...,41 ca 00 00             A...,41 c9 00 00             A...,41 d6 00 00             A...,41 db 00 00             A...,41 dc 00 00             A...,41 d1 00 00             A...'])
+                    '41 cc 00 00', '41 ca 00 00', '41 c9 00 00', '41 d6 00 00', '41 db 00 00', '41 dc 00 00', '41 d1 00 00'])
 
         if process.GetByteOrder() == lldb.eByteOrderLittle:
             self.expect("frame variable intarr",




More information about the lldb-commits mailing list