Fix several test failures on Linux/FreeBSD caused by compiler configuration and invalid environment.

http://reviews.llvm.org/D6392

llvm-svn: 222845
This commit is contained in:
Oleksiy Vyalov 2014-11-26 18:30:04 +00:00
parent b935089576
commit dc4067c852
3 changed files with 21 additions and 17 deletions

View File

@ -40,12 +40,6 @@ class SharedLibTestCase(TestBase):
# Find the line number to break inside main().
self.source = 'main.c'
self.line = line_number(self.source, '// Set breakpoint 0 here.')
if sys.platform.startswith("freebsd") or sys.platform.startswith("linux"):
if "LD_LIBRARY_PATH" in os.environ:
self.runCmd("settings set target.env-vars " + self.dylibPath + "=" + os.environ["LD_LIBRARY_PATH"] + ":" + os.getcwd())
else:
self.runCmd("settings set target.env-vars " + self.dylibPath + "=" + os.getcwd())
self.addTearDownHook(lambda: self.runCmd("settings remove target.env-vars " + self.dylibPath))
self.shlib_names = ["foo"]
def common_setup(self):
@ -59,8 +53,14 @@ class SharedLibTestCase(TestBase):
# Break inside the foo function which takes a bar_ptr argument.
lldbutil.run_break_set_by_file_and_line (self, self.source, self.line, num_expected_locations=1, loc_exact=True)
# Register our shared libraries for remote targets so they get automatically uploaded
environment = self.registerSharedLibrariesWithTarget(target, self.shlib_names)
if sys.platform.startswith("freebsd") or sys.platform.startswith("linux"):
if self.dylibPath in os.environ:
environment = [self.dylibPath + "=" + os.environ[self.dylibPath] + ":" + os.getcwd()]
else:
environment = [self.dylibPath + "=" + os.getcwd()]
else:
# Register our shared libraries for remote targets so they get automatically uploaded
environment = self.registerSharedLibrariesWithTarget(target, self.shlib_names)
# Now launch the process, and do not stop at entry point.
process = target.LaunchSimple (None, environment, self.get_process_working_directory())

View File

@ -40,12 +40,6 @@ class SharedLibStrippedTestCase(TestBase):
# Find the line number to break inside main().
self.source = 'main.c'
self.line = line_number(self.source, '// Set breakpoint 0 here.')
if sys.platform.startswith("freebsd") or sys.platform.startswith("linux"):
if "LD_LIBRARY_PATH" in os.environ:
self.runCmd("settings set target.env-vars " + self.dylibPath + "=" + os.environ["LD_LIBRARY_PATH"] + ":" + os.getcwd())
else:
self.runCmd("settings set target.env-vars " + self.dylibPath + "=" + os.getcwd())
self.addTearDownHook(lambda: self.runCmd("settings remove target.env-vars " + self.dylibPath))
self.shlib_names = ["foo"]
def common_setup(self):
@ -59,8 +53,14 @@ class SharedLibStrippedTestCase(TestBase):
# Break inside the foo function which takes a bar_ptr argument.
lldbutil.run_break_set_by_file_and_line (self, self.source, self.line, num_expected_locations=1, loc_exact=True)
# Register our shared libraries for remote targets so they get automatically uploaded
environment = self.registerSharedLibrariesWithTarget(target, self.shlib_names)
if sys.platform.startswith("freebsd") or sys.platform.startswith("linux"):
if self.dylibPath in os.environ:
environment = [self.dylibPath + "=" + os.environ[self.dylibPath] + ":" + os.getcwd()]
else:
environment = [self.dylibPath + "=" + os.getcwd()]
else:
# Register our shared libraries for remote targets so they get automatically uploaded
environment = self.registerSharedLibrariesWithTarget(target, self.shlib_names)
# Now launch the process, and do not stop at entry point.
process = target.LaunchSimple (None, environment, self.get_process_working_directory())

View File

@ -1231,6 +1231,10 @@ class Base(unittest2.TestCase):
module = builder_module()
return module.getCompiler()
def getCompilerBinary(self):
"""Returns the compiler binary the test suite is running with."""
return self.getCompiler().split()[0]
def getCompilerVersion(self):
""" Returns a string that represents the compiler version.
Supports: llvm, clang.
@ -1238,7 +1242,7 @@ class Base(unittest2.TestCase):
from lldbutil import which
version = 'unknown'
compiler = self.getCompiler()
compiler = self.getCompilerBinary()
version_output = system([[which(compiler), "-v"]])[1]
for line in version_output.split(os.linesep):
m = re.search('version ([0-9\.]+)', line)