[Lldb-commits] [lldb] r222845 - Fix several test failures on Linux/FreeBSD caused by compiler configuration and invalid environment.

Oleksiy Vyalov ovyalov at google.com
Wed Nov 26 10:30:04 PST 2014


Author: ovyalov
Date: Wed Nov 26 12:30:04 2014
New Revision: 222845

URL: http://llvm.org/viewvc/llvm-project?rev=222845&view=rev
Log:
Fix several test failures on Linux/FreeBSD caused by compiler configuration and invalid environment.

http://reviews.llvm.org/D6392

Modified:
    lldb/trunk/test/lang/c/shared_lib/TestSharedLib.py
    lldb/trunk/test/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py
    lldb/trunk/test/lldbtest.py

Modified: lldb/trunk/test/lang/c/shared_lib/TestSharedLib.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/c/shared_lib/TestSharedLib.py?rev=222845&r1=222844&r2=222845&view=diff
==============================================================================
--- lldb/trunk/test/lang/c/shared_lib/TestSharedLib.py (original)
+++ lldb/trunk/test/lang/c/shared_lib/TestSharedLib.py Wed Nov 26 12:30:04 2014
@@ -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())

Modified: lldb/trunk/test/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py?rev=222845&r1=222844&r2=222845&view=diff
==============================================================================
--- lldb/trunk/test/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py (original)
+++ lldb/trunk/test/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py Wed Nov 26 12:30:04 2014
@@ -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())

Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=222845&r1=222844&r2=222845&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Wed Nov 26 12:30:04 2014
@@ -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)





More information about the lldb-commits mailing list