[Lldb-commits] [lldb] r285541 - [Test Suite] Properly respect --framework option
Chris Bieneman via lldb-commits
lldb-commits at lists.llvm.org
Sun Oct 30 21:48:10 PDT 2016
Author: cbieneman
Date: Sun Oct 30 23:48:10 2016
New Revision: 285541
URL: http://llvm.org/viewvc/llvm-project?rev=285541&view=rev
Log:
[Test Suite] Properly respect --framework option
Summary:
dotest.py has a framework option that is not respected. This patch makes the framework path properly configurable via the --framework option.
This patch also adds a function to the lldbtest.Base class named "hasDarwinFramework" which allows us to not rely on the host platform to determine if a framework is present. If running on Darwin, and not building a framework, this will follow the *nix code paths which are appropriate for Darwin.
Reviewers: tfiala
Subscribers: lldb-commits, mgorny
Differential Revision: https://reviews.llvm.org/D25886
Modified:
lldb/trunk/packages/Python/lldbsuite/test/dotest.py
lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
lldb/trunk/test/CMakeLists.txt
Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest.py?rev=285541&r1=285540&r2=285541&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/dotest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py Sun Oct 30 23:48:10 2016
@@ -688,7 +688,10 @@ def setupSysPath():
configuration.skipCategories.append("lldb-mi")
lldbPythonDir = None # The directory that contains 'lldb/__init__.py'
+ if os.path.exists(os.path.join(lldbLibDir, "LLDB.framework")):
+ configuration.lldbFrameworkPath = lldbLibDir
if configuration.lldbFrameworkPath:
+ lldbtest_config.lldbFrameworkPath = configuration.lldbFrameworkPath
candidatePath = os.path.join(
configuration.lldbFrameworkPath, 'Resources', 'Python')
if os.path.isfile(os.path.join(candidatePath, 'lldb/__init__.py')):
Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=285541&r1=285540&r2=285541&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Sun Oct 30 23:48:10 2016
@@ -829,6 +829,29 @@ class Base(unittest2.TestCase):
# Initialize debug_info
self.debug_info = None
+ lib_dir = os.environ["LLDB_LIB_DIR"]
+ self.dsym = None
+ self.framework_dir = None
+ self.darwinWithFramework = self.platformIsDarwin()
+ if sys.platform.startswith("darwin"):
+ # Handle the framework environment variable if it is set
+ if hasattr(lldbtest_config, 'lldbFrameworkPath'):
+ framework_path = lldbtest_config.lldbFrameworkPath
+ # Framework dir should be the directory containing the framework
+ self.framework_dir = framework_path[:framework_path.rfind('LLDB.framework')]
+ # If a framework dir was not specified assume the Xcode build
+ # directory layout where the framework is in LLDB_LIB_DIR.
+ else:
+ self.framework_dir = lib_dir
+ self.dsym = os.path.join(self.framework_dir, 'LLDB.framework', 'LLDB')
+ # If the framework binary doesn't exist, assume we didn't actually
+ # build a framework, and fallback to standard *nix behavior by
+ # setting framework_dir and dsym to None.
+ if not os.path.exists(self.dsym):
+ self.framework_dir = None
+ self.dsym = None
+ self.darwinWithFramework = False
+
def setAsync(self, value):
""" Sets async mode to True/False and ensures it is reset after the testcase completes."""
old_async = self.dbg.GetAsync()
@@ -1276,6 +1299,9 @@ class Base(unittest2.TestCase):
"""Returns true if the OS triple for the selected platform is any valid apple OS"""
return lldbplatformutil.platformIsDarwin()
+ def hasDarwinFramework(self):
+ return self.darwinWithFramework
+
def getPlatform(self):
"""Returns the target platform the test suite is running on."""
return lldbplatformutil.getPlatform()
@@ -1373,15 +1399,14 @@ class Base(unittest2.TestCase):
stdlibflag = self.getstdlibFlag()
lib_dir = os.environ["LLDB_LIB_DIR"]
- if sys.platform.startswith("darwin"):
- dsym = os.path.join(lib_dir, 'LLDB.framework', 'LLDB')
+ if self.hasDarwinFramework():
d = {'CXX_SOURCES': sources,
'EXE': exe_name,
'CFLAGS_EXTRAS': "%s %s" % (stdflag, stdlibflag),
- 'FRAMEWORK_INCLUDES': "-F%s" % lib_dir,
- 'LD_EXTRAS': "%s -Wl,-rpath,%s" % (dsym, lib_dir),
+ 'FRAMEWORK_INCLUDES': "-F%s" % self.framework_dir,
+ 'LD_EXTRAS': "%s -Wl,-rpath,%s" % (self.dsym, self.framework_dir),
}
- elif sys.platform.rstrip('0123456789') in ('freebsd', 'linux', 'netbsd') or os.environ.get('LLDB_BUILD_TYPE') == 'Makefile':
+ elif sys.platform.rstrip('0123456789') in ('freebsd', 'linux', 'netbsd', 'darwin') or os.environ.get('LLDB_BUILD_TYPE') == 'Makefile':
d = {
'CXX_SOURCES': sources,
'EXE': exe_name,
@@ -1390,7 +1415,7 @@ class Base(unittest2.TestCase):
os.path.join(
os.environ["LLDB_SRC"],
"include")),
- 'LD_EXTRAS': "-L%s -llldb" % lib_dir}
+ 'LD_EXTRAS': "-L%s/../lib -llldb -Wl,-rpath,%s/../lib" % (lib_dir, lib_dir)}
elif sys.platform.startswith('win'):
d = {
'CXX_SOURCES': sources,
@@ -1414,15 +1439,14 @@ class Base(unittest2.TestCase):
stdflag = self.getstdFlag()
lib_dir = os.environ["LLDB_LIB_DIR"]
- if self.platformIsDarwin():
- dsym = os.path.join(lib_dir, 'LLDB.framework', 'LLDB')
+ if self.hasDarwinFramework():
d = {'DYLIB_CXX_SOURCES': sources,
'DYLIB_NAME': lib_name,
'CFLAGS_EXTRAS': "%s -stdlib=libc++" % stdflag,
- 'FRAMEWORK_INCLUDES': "-F%s" % lib_dir,
- 'LD_EXTRAS': "%s -Wl,-rpath,%s -dynamiclib" % (dsym, lib_dir),
+ 'FRAMEWORK_INCLUDES': "-F%s" % self.framework_dir,
+ 'LD_EXTRAS': "%s -Wl,-rpath,%s -dynamiclib" % (self.dsym, self.framework_dir),
}
- elif self.getPlatform() in ('freebsd', 'linux', 'netbsd') or os.environ.get('LLDB_BUILD_TYPE') == 'Makefile':
+ elif sys.platform.rstrip('0123456789') in ('freebsd', 'linux', 'netbsd', 'darwin') or os.environ.get('LLDB_BUILD_TYPE') == 'Makefile':
d = {
'DYLIB_CXX_SOURCES': sources,
'DYLIB_NAME': lib_name,
@@ -1430,7 +1454,7 @@ class Base(unittest2.TestCase):
os.path.join(
os.environ["LLDB_SRC"],
"include")),
- 'LD_EXTRAS': "-shared -L%s -llldb" % lib_dir}
+ 'LD_EXTRAS': "-shared -L%s/../lib -llldb -Wl,-rpath,%s/../lib" % (lib_dir, lib_dir)}
elif self.getPlatform() == 'windows':
d = {
'DYLIB_CXX_SOURCES': sources,
Modified: lldb/trunk/test/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/CMakeLists.txt?rev=285541&r1=285540&r2=285541&view=diff
==============================================================================
--- lldb/trunk/test/CMakeLists.txt (original)
+++ lldb/trunk/test/CMakeLists.txt Sun Oct 30 23:48:10 2016
@@ -89,6 +89,10 @@ if(LLDB_CODESIGN_IDENTITY)
list(APPEND LLDB_TEST_COMMON_ARGS --codesign-identity "${LLDB_CODESIGN_IDENTITY}")
endif()
+if(LLDB_BUILD_FRAMEWORK)
+ list(APPEND LLDB_TEST_COMMON_ARGS --framework $<TARGET_FILE_DIR:liblldb>)
+endif()
+
add_python_test_target(check-lldb-single
${LLDB_SOURCE_DIR}/test/dotest.py
"--no-multiprocess;${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS}"
More information about the lldb-commits
mailing list