Make the string matching for 'frame variable' more stringent with respect to

output from clang and llvm-gcc compiled program; both generate the correct debug
info with respect to the typedef scoped inside a namespace.

Add a TestBase.getCompiler(self) method which returns the compiler in effect the
test suite is now running with.  Subclasses (like TestNamespace) can use it to
distinguish among different compilers.

llvm-svn: 119445
This commit is contained in:
Johnny Chen 2010-11-17 00:52:41 +00:00
parent 7003a50b77
commit 80e6db9c79
3 changed files with 21 additions and 11 deletions

View File

@ -808,11 +808,16 @@ class TestBase(unittest2.TestCase):
# End of while loop.
def getCompiler(self):
"""Returns the compiler in effect the test suite is now running with."""
module = __import__(sys.platform)
return module.getCompiler()
def getRunSpec(self):
"""Environment variable spec to run this test again, invoked from within
dumpSessionInfo()."""
module = __import__(sys.platform)
return module.getRunSpec()
return module.getRunSpec()
def buildDefault(self, architecture=None, compiler=None, dictionary=None):
"""Platform specific way to build the default binaries."""

View File

@ -54,17 +54,18 @@ class NamespaceTestCase(TestBase):
substrs = ['state is stopped',
'stop reason = breakpoint'])
# rdar://problem/8668740
# 'frame variable' output for namespace variables look wrong
# (lldb) frame variable
# (int) a = 12
# (A::B::uint_t) anon_uint = 0
# (A::B::uint_t) a_uint = 1
# (A::B::uint_t) b_uint = 2
# (A::B::uint_t) y_uint = 3
# (lldb)
# On Mac OS X, gcc 4.2 emits the wrong debug info with respect to types.
slist = ['(int) a = 12', 'anon_uint', 'a_uint', 'b_uint', 'y_uint']
if sys.platform.startswith("darwin") and self.getCompiler() in ['clang', 'llvm-gcc']:
slist = ['(int) a = 12',
'(my_uint_t) anon_uint = 0',
'(A::uint_t) a_uint = 1',
'(A::B::uint_t) b_uint = 2',
'(Y::uint_t) y_uint = 3']
# 'frame variable' displays the local variables with type information.
self.expect('frame variable', VARIABLES_DISPLAYED_CORRECTLY,
substrs = [''])
substrs = slist)
# 'frame variable' with basename 'i' should work.
self.expect("frame variable -c -G i",

View File

@ -17,6 +17,10 @@ import lldbtest
#print "Hello, darwin plugin!"
def getCompiler():
"""Returns the compiler in effect the test suite is now running with."""
return os.environ["CC"] if "CC" in os.environ else ""
def getRunSpec():
"""Environment variable spec to run this test again, invoked from within
dumpSessionInfo()."""