From 7e8de59b9059a2eec1367f32c0a06561f5e025ac Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Thu, 14 Apr 2016 14:35:02 +0000 Subject: Fix test cases for big-endian systems A number of test cases were failing on big-endian systems simply due to byte order assumptions in the tests themselves, and no underlying bug in LLDB. These two test cases: tools/lldb-server/lldbgdbserverutils.py python_api/process/TestProcessAPI.py actually check for big-endian target byte order, but contain Python errors in the corresponding code paths. These test cases: functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py functionalities/data-formatter/synthcapping/TestSyntheticCapping.py lang/cpp/frame-var-anon-unions/TestFrameVariableAnonymousUnions.py python_api/sbdata/TestSBData.py (first change) could be fixed to check for big-endian target byte order and update the expected result strings accordingly. For the two synthetic tests, I've also updated the source to make sure the fake_a value is always nonzero on both big- and little-endian platforms. These test case: python_api/sbdata/TestSBData.py (second change) functionalities/memory/cache/TestMemoryCache.py simply accessed memory with the wrong size, which wasn't noticed on LE but fails on BE. Differential Revision: http://reviews.llvm.org/D18985 llvm-svn: 266315 --- .../Python/lldbsuite/test/python_api/sbdata/TestSBData.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lldb/packages/Python/lldbsuite/test/python_api/sbdata') diff --git a/lldb/packages/Python/lldbsuite/test/python_api/sbdata/TestSBData.py b/lldb/packages/Python/lldbsuite/test/python_api/sbdata/TestSBData.py index 5a21a815471..d8e9515973f 100644 --- a/lldb/packages/Python/lldbsuite/test/python_api/sbdata/TestSBData.py +++ b/lldb/packages/Python/lldbsuite/test/python_api/sbdata/TestSBData.py @@ -186,7 +186,10 @@ class SBDataAPICase(TestBase): self.assertTrue(new_object.GetValue() == "1", 'new_object == 1') - data.SetData(error, 'A\0\0\0', data.GetByteOrder(), data.GetAddressByteSize()) + if data.GetByteOrder() == lldb.eByteOrderBig: + data.SetData(error, '\0\0\0A', data.GetByteOrder(), data.GetAddressByteSize()) + else: + data.SetData(error, 'A\0\0\0', data.GetByteOrder(), data.GetAddressByteSize()) self.assertTrue(error.Success()) data2 = lldb.SBData() @@ -311,8 +314,8 @@ class SBDataAPICase(TestBase): self.assert_data(data2.GetSignedInt32, 4, -2) data2.SetDataFromSInt64Array([2, -2]) - self.assert_data(data2.GetSignedInt32, 0, 2) - self.assert_data(data2.GetSignedInt32, 8, -2) + self.assert_data(data2.GetSignedInt64, 0, 2) + self.assert_data(data2.GetSignedInt64, 8, -2) data2.SetDataFromUInt32Array([1,2,3,4,5]) self.assert_data(data2.GetUnsignedInt32, 0, 1) -- cgit v1.2.3