teak-llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/frame-var-anon-unions/TestFrameVariableAnonymousUnions.py
Ulrich Weigand 7e8de59b90 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
2016-04-14 14:35:02 +00:00

34 lines
1.2 KiB
Python

"""
Tests that frame variable looks into anonymous unions
"""
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
class FrameVariableAnonymousUnionsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
def test_with_run_command(self):
"""Tests that frame variable looks into anonymous unions"""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
line = line_number('main.cpp', '// break here')
lldbutil.run_break_set_by_file_and_line (self, "main.cpp", line, num_expected_locations=-1, loc_exact=False)
self.runCmd("process launch", RUN_SUCCEEDED)
process = self.dbg.GetSelectedTarget().GetProcess()
if process.GetByteOrder() == lldb.eByteOrderLittle:
self.expect('frame variable -f x i', substrs=['ffffff41'])
else:
self.expect('frame variable -f x i', substrs=['41ffff00'])
self.expect('frame variable c', substrs=["'A"])
self.expect('frame variable x', matching=False, substrs=['3'])
self.expect('frame variable y', matching=False, substrs=["'B'"])
self.expect('frame variable z', matching=False, substrs=['14'])