amccarth created this revision. amccarth added a reviewer: zturner. Herald added a subscriber: sanjoy.
This test uses the SB API to set and read back bytes of data, and it works fine when Python 2 is the scripting language. On Windows, however, Python 3 is the default. Note this line from the test: addr_data = '\x11\x22\x33\x44\x55\x66\x77\x88' The intent here is to create an array of eight bytes as a string literal. This works in Python 2, but Python 3 treats those as a series Unicode code points, and the CPython implementation happens to encode those code points as UTF-8. The first seven characters encode directly as single bytes of the same value, but the UTF-8 encoding of 0x88 is two bytes long: 0xC2 0x88. Thus the input array doesn't have the intended data at the end, and tests that rely on the byte fails. Adding the b prefix tells Python 3 that we want a byte array rather than a string. With this change, the test now passes on Windows. Fix TestMoveNearest on Windows The header file for the DLL tried to declare inline functions and a local function as dllexport which broke the compile and link. Removing the bad declarations solves the problem, and the test passes on Windows now. https://reviews.llvm.org/D43599 Files: lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/foo.h lldb/packages/Python/lldbsuite/test/python_api/sbdata/TestSBData.py Index: lldb/packages/Python/lldbsuite/test/python_api/sbdata/TestSBData.py =================================================================== --- lldb/packages/Python/lldbsuite/test/python_api/sbdata/TestSBData.py +++ lldb/packages/Python/lldbsuite/test/python_api/sbdata/TestSBData.py @@ -25,7 +25,7 @@ def test_byte_order_and_address_byte_size(self): """Test the SBData::SetData() to ensure the byte order and address byte size are obeyed""" - addr_data = '\x11\x22\x33\x44\x55\x66\x77\x88' + addr_data = b'\x11\x22\x33\x44\x55\x66\x77\x88' error = lldb.SBError() data = lldb.SBData() data.SetData(error, addr_data, lldb.eByteOrderBig, 4) Index: lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/foo.h =================================================================== --- lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/foo.h +++ lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/foo.h @@ -1,6 +1,5 @@ -LLDB_TEST_API inline int foo1() { return 1; } // !BR1 +inline int foo1() { return 1; } // !BR1 -LLDB_TEST_API inline int foo2() { return 2; } // !BR2 +inline int foo2() { return 2; } // !BR2 LLDB_TEST_API extern int call_foo1(); -LLDB_TEST_API extern int call_foo2();
Index: lldb/packages/Python/lldbsuite/test/python_api/sbdata/TestSBData.py =================================================================== --- lldb/packages/Python/lldbsuite/test/python_api/sbdata/TestSBData.py +++ lldb/packages/Python/lldbsuite/test/python_api/sbdata/TestSBData.py @@ -25,7 +25,7 @@ def test_byte_order_and_address_byte_size(self): """Test the SBData::SetData() to ensure the byte order and address byte size are obeyed""" - addr_data = '\x11\x22\x33\x44\x55\x66\x77\x88' + addr_data = b'\x11\x22\x33\x44\x55\x66\x77\x88' error = lldb.SBError() data = lldb.SBData() data.SetData(error, addr_data, lldb.eByteOrderBig, 4) Index: lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/foo.h =================================================================== --- lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/foo.h +++ lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/foo.h @@ -1,6 +1,5 @@ -LLDB_TEST_API inline int foo1() { return 1; } // !BR1 +inline int foo1() { return 1; } // !BR1 -LLDB_TEST_API inline int foo2() { return 2; } // !BR2 +inline int foo2() { return 2; } // !BR2 LLDB_TEST_API extern int call_foo1(); -LLDB_TEST_API extern int call_foo2();
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits