[Python] Fix TestDataFormatterSmartArray to work across python versions.
authorDavide Italiano <davide@freebsd.org>
Wed, 13 Mar 2019 20:04:34 +0000 (20:04 +0000)
committerDavide Italiano <davide@freebsd.org>
Wed, 13 Mar 2019 20:04:34 +0000 (20:04 +0000)
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).

llvm-svn: 356096

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

index 54e9c34..e4ca603 100644 (file)
@@ -412,26 +412,26 @@ class SmartArrayDataFormatterTestCase(TestBase):
                 "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             .@.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.@.,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",