teak-llvm/lldb/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
Jan Kratochvil 4c993ce187 symbols.enable-external-lookup=false on all hosts (not just OSX)
There is already in use:
	lit/lit-lldb-init:
		settings set symbols.enable-external-lookup false
	packages/Python/lldbsuite/test/lldbtest.py:
		self.runCmd('settings set symbols.enable-external-lookup false')

But those are not in effect during MI part of the testsuite. Another problem is
that symbols.enable-external-lookup (read by GetEnableExternalLookup) has been
currently read only by LocateMacOSXFilesUsingDebugSymbols and therefore it had
no effect on Linux.

On Red Hat platforms (Fedoras, RHEL-7) there is DWZ in use and so
MiSyntaxTestCase-test_lldbmi_output_grammar FAILs due to:
	AssertionError: error: inconsistent pattern ''^.+?\n'' for state 0x5f
	(matched string: warning: (x86_64) /lib64/libstdc++.so.6 unsupported
	DW_FORM values: 0x1f20 0x1f21
It is the only testcase with this error. It happens due to:
	(lldb) target create "/lib64/libstdc++.so.6"
	Current executable set to '/lib64/libstdc++.so.6' (x86_64).
	(lldb) b main
	warning: (x86_64) /lib64/libstdc++.so.6 unsupported DW_FORM values: 0x1f20 0x1f21
	Breakpoint 1: no locations (pending).
	WARNING:  Unable to resolve breakpoint to any actual locations.
which happens only with gcc-base-debuginfo rpm installed (similarly for other packages).

It should also speed up the testsuite as it no longer needs to read
/usr/lib/debug symbols which have no effect (and should not have any effect) on
the testsuite results.

Differential Revision: https://reviews.llvm.org/D55859

llvm-svn: 350368
2019-01-03 23:11:06 +00:00

68 lines
2.0 KiB
Python

"""
Base class for lldb-mi test cases.
"""
from __future__ import print_function
from lldbsuite.test.lldbtest import *
class MiTestCaseBase(Base):
mydir = None
myexe = None
mylog = None
NO_DEBUG_INFO_TESTCASE = True
@classmethod
def classCleanup(cls):
if cls.myexe:
TestBase.RemoveTempFile(cls.myexe)
if cls.mylog:
TestBase.RemoveTempFile(cls.mylog)
def setUp(self):
if not self.mydir:
raise("mydir is empty")
Base.setUp(self)
self.buildDefault()
self.child_prompt = "(gdb)"
self.myexe = self.getBuildArtifact("a.out")
def tearDown(self):
if self.TraceOn():
print("\n\nContents of %s:" % self.mylog)
try:
print(open(self.mylog, "r").read())
except IOError:
pass
Base.tearDown(self)
def spawnLldbMi(self, exe=None, args=None, preconfig=True):
import pexpect
self.child = pexpect.spawn("%s --interpreter %s" % (
self.lldbMiExec, args if args else ""), cwd=self.getBuildDir())
self.child.setecho(True)
self.mylog = self.getBuildArtifact("child.log")
self.child.logfile_read = open(self.mylog, "w")
# wait until lldb-mi has started up and is ready to go
self.expect(self.child_prompt, exactly=True)
if preconfig:
self.runCmd("settings set symbols.enable-external-lookup false")
self.expect("\^done")
self.expect(self.child_prompt, exactly=True)
if exe:
self.runCmd("-file-exec-and-symbols \"%s\"" % exe)
# Testcases expect to be able to match output of this command,
# see test_lldbmi_specialchars.
def runCmd(self, cmd):
self.child.sendline(cmd)
def expect(self, pattern, exactly=False, *args, **kwargs):
if exactly:
return self.child.expect_exact(pattern, *args, **kwargs)
return self.child.expect(pattern, *args, **kwargs)