[Lldb-commits] [lldb] r251315 - Fixed the test suite on MacOSX so that "test/api/multithreaded/TestMultithreaded.py" works without errors.

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 26 10:52:16 PDT 2015


Author: gclayton
Date: Mon Oct 26 12:52:16 2015
New Revision: 251315

URL: http://llvm.org/viewvc/llvm-project?rev=251315&view=rev
Log:
Fixed the test suite on MacOSX so that "test/api/multithreaded/TestMultithreaded.py" works without errors.

The problem was that the @skipIfNoSBHeaders on darwin was trying to use self.lib_dir when it hadn't been set yet.

I looked at the code and places were required to set "self.lib_dir" for no real reason as all places that used it just used the LLDB_LIB_DIR environment variable. So I removed all uses of self.lib_dir and replaced them to use 'os.environ["LLDB_LIB_DIR"]'. Did the same for self.implib_dir.


Modified:
    lldb/trunk/test/api/check_public_api_headers/TestPublicAPIHeaders.py
    lldb/trunk/test/api/multiple-debuggers/TestMultipleDebuggers.py
    lldb/trunk/test/api/multithreaded/TestMultithreaded.py
    lldb/trunk/test/functionalities/plugins/commands/TestPluginCommands.py
    lldb/trunk/test/lldbtest.py

Modified: lldb/trunk/test/api/check_public_api_headers/TestPublicAPIHeaders.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/api/check_public_api_headers/TestPublicAPIHeaders.py?rev=251315&r1=251314&r2=251315&view=diff
==============================================================================
--- lldb/trunk/test/api/check_public_api_headers/TestPublicAPIHeaders.py (original)
+++ lldb/trunk/test/api/check_public_api_headers/TestPublicAPIHeaders.py Mon Oct 26 12:52:16 2015
@@ -17,8 +17,6 @@ class SBDirCheckerCase(TestBase):
 
     def setUp(self):
         TestBase.setUp(self)
-        self.lib_dir = os.environ["LLDB_LIB_DIR"]
-        self.implib_dir = os.environ["LLDB_IMPLIB_DIR"]
         self.template = 'main.cpp.template'
         self.source = 'main.cpp'
         self.exe_name = 'a.out'

Modified: lldb/trunk/test/api/multiple-debuggers/TestMultipleDebuggers.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/api/multiple-debuggers/TestMultipleDebuggers.py?rev=251315&r1=251314&r2=251315&view=diff
==============================================================================
--- lldb/trunk/test/api/multiple-debuggers/TestMultipleDebuggers.py (original)
+++ lldb/trunk/test/api/multiple-debuggers/TestMultipleDebuggers.py Mon Oct 26 12:52:16 2015
@@ -14,11 +14,6 @@ class TestMultipleSimultaneousDebuggers(
 
     mydir = TestBase.compute_mydir(__file__)
 
-    def setUp(self):
-        TestBase.setUp(self)
-        self.lib_dir = os.environ["LLDB_LIB_DIR"]
-        self.implib_dir = os.environ["LLDB_IMPLIB_DIR"]
-
     @skipIfi386
     @skipIfNoSBHeaders
     @expectedFailureFreeBSD("llvm.org/pr20282")

Modified: lldb/trunk/test/api/multithreaded/TestMultithreaded.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/api/multithreaded/TestMultithreaded.py?rev=251315&r1=251314&r2=251315&view=diff
==============================================================================
--- lldb/trunk/test/api/multithreaded/TestMultithreaded.py (original)
+++ lldb/trunk/test/api/multithreaded/TestMultithreaded.py Mon Oct 26 12:52:16 2015
@@ -69,8 +69,6 @@ class SBBreakpointCallbackCase(TestBase)
         if self.getLldbArchitecture() != self.getArchitecture():
             self.skipTest("This test is only run if the target arch is the same as the lldb binary arch")
 
-        self.lib_dir = os.environ["LLDB_LIB_DIR"]
-        self.implib_dir = os.environ["LLDB_IMPLIB_DIR"]
         self.inferior = 'inferior_program'
         self.buildProgram('inferior.cpp', self.inferior)
         self.addTearDownHook(lambda: os.remove(self.inferior))

Modified: lldb/trunk/test/functionalities/plugins/commands/TestPluginCommands.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/plugins/commands/TestPluginCommands.py?rev=251315&r1=251314&r2=251315&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/plugins/commands/TestPluginCommands.py (original)
+++ lldb/trunk/test/functionalities/plugins/commands/TestPluginCommands.py Mon Oct 26 12:52:16 2015
@@ -16,12 +16,6 @@ class PluginCommandTestCase(TestBase):
 
     mydir = TestBase.compute_mydir(__file__)
 
-    def setUp(self):
-        # Call super's setUp().
-        TestBase.setUp(self)
-        self.lib_dir = os.environ["LLDB_LIB_DIR"]
-        self.implib_dir = os.environ["LLDB_IMPLIB_DIR"]
-
     @skipIfNoSBHeaders
     @skipIfHostIncompatibleWithRemote # Requires a compatible arch and platform to link against the host's built lldb lib.
     @expectedFailureWindows("llvm.org/pr24778")

Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=251315&r1=251314&r2=251315&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Mon Oct 26 12:52:16 2015
@@ -870,7 +870,7 @@ def skipIfNoSBHeaders(func):
         from unittest2 import case
         self = args[0]
         if sys.platform.startswith("darwin"):
-            header = os.path.join(self.lib_dir, 'LLDB.framework', 'Versions','Current','Headers','LLDB.h')
+            header = os.path.join(os.environ["LLDB_LIB_DIR"], 'LLDB.framework', 'Versions','Current','Headers','LLDB.h')
         else:
             header = os.path.join(os.environ["LLDB_SRC"], "include", "lldb", "API", "LLDB.h")
         platform = sys.platform
@@ -2034,25 +2034,26 @@ class Base(unittest2.TestCase):
 
         stdflag = self.getstdFlag()
         stdlibflag = self.getstdlibFlag()
-
+                                            
+        lib_dir = os.environ["LLDB_LIB_DIR"]
         if sys.platform.startswith("darwin"):
-            dsym = os.path.join(self.lib_dir, 'LLDB.framework', 'LLDB')
+            dsym = os.path.join(lib_dir, 'LLDB.framework', 'LLDB')
             d = {'CXX_SOURCES' : sources,
                  'EXE' : exe_name,
                  'CFLAGS_EXTRAS' : "%s %s" % (stdflag, stdlibflag),
-                 'FRAMEWORK_INCLUDES' : "-F%s" % self.lib_dir,
-                 'LD_EXTRAS' : "%s -Wl,-rpath,%s" % (dsym, self.lib_dir),
+                 'FRAMEWORK_INCLUDES' : "-F%s" % lib_dir,
+                 'LD_EXTRAS' : "%s -Wl,-rpath,%s" % (dsym, lib_dir),
                 }
         elif sys.platform.startswith('freebsd') or sys.platform.startswith("linux") or os.environ.get('LLDB_BUILD_TYPE') == 'Makefile':
             d = {'CXX_SOURCES' : sources,
                  'EXE' : exe_name,
                  'CFLAGS_EXTRAS' : "%s %s -I%s" % (stdflag, stdlibflag, os.path.join(os.environ["LLDB_SRC"], "include")),
-                 'LD_EXTRAS' : "-L%s -llldb" % self.lib_dir}
+                 'LD_EXTRAS' : "-L%s -llldb" % lib_dir}
         elif sys.platform.startswith('win'):
             d = {'CXX_SOURCES' : sources,
                  'EXE' : exe_name,
                  'CFLAGS_EXTRAS' : "%s %s -I%s" % (stdflag, stdlibflag, os.path.join(os.environ["LLDB_SRC"], "include")),
-                 'LD_EXTRAS' : "-L%s -lliblldb" % self.implib_dir}
+                 'LD_EXTRAS' : "-L%s -lliblldb" % os.environ["LLDB_IMPLIB_DIR"]}
         if self.TraceOn():
             print("Building LLDB Driver (%s) from sources %s" % (exe_name, sources))
 
@@ -2063,24 +2064,25 @@ class Base(unittest2.TestCase):
 
         stdflag = self.getstdFlag()
 
+        lib_dir = os.environ["LLDB_LIB_DIR"]
         if self.platformIsDarwin():
-            dsym = os.path.join(self.lib_dir, 'LLDB.framework', 'LLDB')
+            dsym = os.path.join(lib_dir, 'LLDB.framework', 'LLDB')
             d = {'DYLIB_CXX_SOURCES' : sources,
                  'DYLIB_NAME' : lib_name,
                  'CFLAGS_EXTRAS' : "%s -stdlib=libc++" % stdflag,
-                 'FRAMEWORK_INCLUDES' : "-F%s" % self.lib_dir,
-                 'LD_EXTRAS' : "%s -Wl,-rpath,%s -dynamiclib" % (dsym, self.lib_dir),
+                 'FRAMEWORK_INCLUDES' : "-F%s" % lib_dir,
+                 'LD_EXTRAS' : "%s -Wl,-rpath,%s -dynamiclib" % (dsym, lib_dir),
                 }
         elif self.getPlatform() == 'freebsd' or self.getPlatform() == 'linux' or os.environ.get('LLDB_BUILD_TYPE') == 'Makefile':
             d = {'DYLIB_CXX_SOURCES' : sources,
                  'DYLIB_NAME' : lib_name,
                  'CFLAGS_EXTRAS' : "%s -I%s -fPIC" % (stdflag, os.path.join(os.environ["LLDB_SRC"], "include")),
-                 'LD_EXTRAS' : "-shared -L%s -llldb" % self.lib_dir}
+                 'LD_EXTRAS' : "-shared -L%s -llldb" % lib_dir}
         elif self.getPlatform() == 'windows':
             d = {'DYLIB_CXX_SOURCES' : sources,
                  'DYLIB_NAME' : lib_name,
                  'CFLAGS_EXTRAS' : "%s -I%s -fPIC" % (stdflag, os.path.join(os.environ["LLDB_SRC"], "include")),
-                 'LD_EXTRAS' : "-shared -l%s\liblldb.lib" % self.implib_dir}
+                 'LD_EXTRAS' : "-shared -l%s\liblldb.lib" % self.os.environ["LLDB_IMPLIB_DIR"]}
         if self.TraceOn():
             print("Building LLDB Library (%s) from sources %s" % (lib_name, sources))
 
@@ -2210,12 +2212,13 @@ class Base(unittest2.TestCase):
             the new path is appended to it and returned.
         """
         existing_library_path = os.environ[self.dylibPath] if self.dylibPath in os.environ else None
+        lib_dir = os.environ["LLDB_LIB_DIR"]
         if existing_library_path:
-            return "%s:%s" % (existing_library_path, self.lib_dir)
+            return "%s:%s" % (existing_library_path, lib_dir)
         elif sys.platform.startswith("darwin"):
-            return os.path.join(self.lib_dir, 'LLDB.framework')
+            return os.path.join(lib_dir, 'LLDB.framework')
         else:
-            return self.lib_dir
+            return lib_dir
 
     def getLibcPlusPlusLibs(self):
         if self.getPlatform() == 'freebsd' or self.getPlatform() == 'linux':




More information about the lldb-commits mailing list