diff options
| author | Jonas Devlieghere <jonas@devlieghere.com> | 2020-08-28 15:43:35 -0700 |
|---|---|---|
| committer | Jonas Devlieghere <jonas@devlieghere.com> | 2020-08-28 15:45:54 -0700 |
| commit | 141c8475b693e245388cf7a4ac9ec17303988700 (patch) | |
| tree | 15f9075c82817283d7be0c1f05fb6f4966fde288 /lldb/packages/Python | |
| parent | 55e7d91072e865d36953e91a7b2c8bfc219464d6 (diff) | |
[lldb] Get rid of LLDB_LIB_DIR and LLDB_IMPLIB_DIR in dotest
This patch removes the rather confusing LLDB_LIB_DIR and LLDB_IMPLIB_DIR
environment variables. They are confusing because LLDB_LIB_DIR would
point to the bin subdirectory in the build root while LLDB_IMPLIB_DIR
would point to the lib subdirectory. The reason far this was
LLDB.framework, which gets build under bin.
This patch replaces their uses with configuration.lldb_framework_path
and configuration.lldb_libs_dir respectively.
Differential revision: https://reviews.llvm.org/D86817
Diffstat (limited to 'lldb/packages/Python')
| -rw-r--r-- | lldb/packages/Python/lldbsuite/test/decorators.py | 5 | ||||
| -rw-r--r-- | lldb/packages/Python/lldbsuite/test/dotest.py | 9 | ||||
| -rw-r--r-- | lldb/packages/Python/lldbsuite/test/lldbtest.py | 50 |
3 files changed, 21 insertions, 43 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py b/lldb/packages/Python/lldbsuite/test/decorators.py index 85f346d73283..4e47165cdb1f 100644 --- a/lldb/packages/Python/lldbsuite/test/decorators.py +++ b/lldb/packages/Python/lldbsuite/test/decorators.py @@ -510,10 +510,9 @@ def skipIfNoSBHeaders(func): if lldb.remote_platform: return "skip because SBHeaders tests make no sense remotely" - if lldbplatformutil.getHostPlatform() == 'darwin': + if lldbplatformutil.getHostPlatform() == 'darwin' and configuration.lldb_framework_path: header = os.path.join( - os.environ["LLDB_LIB_DIR"], - 'LLDB.framework', + configuration.lldb_framework_path, 'Versions', 'Current', 'Headers', diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py index c96840024b8a..30d6afc231fd 100644 --- a/lldb/packages/Python/lldbsuite/test/dotest.py +++ b/lldb/packages/Python/lldbsuite/test/dotest.py @@ -519,13 +519,6 @@ def setupSysPath(): print("The 'lldb' executable cannot be located. Some of the tests may not be run as a result.") sys.exit(-1) - # confusingly, this is the "bin" directory - lldbLibDir = os.path.dirname(lldbtest_config.lldbExec) - os.environ["LLDB_LIB_DIR"] = lldbLibDir - lldbImpLibDir = configuration.lldb_libs_dir - os.environ["LLDB_IMPLIB_DIR"] = lldbImpLibDir - print("LLDB library dir:", os.environ["LLDB_LIB_DIR"]) - print("LLDB import library dir:", os.environ["LLDB_IMPLIB_DIR"]) os.system('%s -v' % lldbtest_config.lldbExec) lldbDir = os.path.dirname(lldbtest_config.lldbExec) @@ -540,8 +533,6 @@ def setupSysPath(): configuration.skip_categories.append("lldb-vscode") lldbPythonDir = None # The directory that contains 'lldb/__init__.py' - if not configuration.lldb_framework_path and os.path.exists(os.path.join(lldbLibDir, "LLDB.framework")): - configuration.lldb_framework_path = os.path.join(lldbLibDir, "LLDB.framework") if configuration.lldb_framework_path: lldbtest_config.lldb_framework_path = configuration.lldb_framework_path candidatePath = os.path.join( diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py index 4180ba271613..112b19abab39 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbtest.py +++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py @@ -916,28 +916,18 @@ class Base(unittest2.TestCase): self.setPlatformWorkingDir() self.enableLogChannelsForCurrentTest() - lib_dir = os.environ["LLDB_LIB_DIR"] - self.dsym = None + self.lib_lldb = 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, 'lldb_framework_path'): - framework_path = lldbtest_config.lldb_framework_path - # 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 + self.darwinWithFramework = False + + if sys.platform.startswith("darwin") and configuration.lldb_framework_path: + framework = configuration.lldb_framework_path + lib = os.path.join(framework, 'LLDB') + if os.path.exists(lib): + self.framework_dir = os.path.dirname(framework) + self.lib_lldb = lib + self.darwinWithFramework = self.platformIsDarwin() + self.makeBuildDir() def setAsync(self, value): @@ -1499,7 +1489,7 @@ class Base(unittest2.TestCase): 'EXE': exe_name, 'CFLAGS_EXTRAS': "%s %s" % (stdflag, stdlibflag), 'FRAMEWORK_INCLUDES': "-F%s" % self.framework_dir, - 'LD_EXTRAS': "%s -Wl,-rpath,%s" % (self.dsym, self.framework_dir), + 'LD_EXTRAS': "%s -Wl,-rpath,%s" % (self.lib_lldb, self.framework_dir), } elif sys.platform.startswith('win'): d = { @@ -1510,7 +1500,7 @@ class Base(unittest2.TestCase): os.path.join( os.environ["LLDB_SRC"], "include")), - 'LD_EXTRAS': "-L%s -lliblldb" % os.environ["LLDB_IMPLIB_DIR"]} + 'LD_EXTRAS': "-L%s -lliblldb" % lib_dir} else: d = { 'CXX_SOURCES': sources, @@ -1539,7 +1529,7 @@ class Base(unittest2.TestCase): 'DYLIB_NAME': lib_name, 'CFLAGS_EXTRAS': "%s -stdlib=libc++" % stdflag, 'FRAMEWORK_INCLUDES': "-F%s" % self.framework_dir, - 'LD_EXTRAS': "%s -Wl,-rpath,%s -dynamiclib" % (self.dsym, self.framework_dir), + 'LD_EXTRAS': "%s -Wl,-rpath,%s -dynamiclib" % (self.lib_lldb, self.framework_dir), } elif self.getPlatform() == 'windows': d = { @@ -1549,7 +1539,7 @@ class Base(unittest2.TestCase): os.path.join( os.environ["LLDB_SRC"], "include")), - 'LD_EXTRAS': "-shared -l%s\liblldb.lib" % self.os.environ["LLDB_IMPLIB_DIR"]} + 'LD_EXTRAS': "-shared -l%s\liblldb.lib" % lib_dir} else: d = { 'DYLIB_CXX_SOURCES': sources, @@ -1759,13 +1749,11 @@ class Base(unittest2.TestCase): """ 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, lib_dir) - elif sys.platform.startswith("darwin"): - return os.path.join(lib_dir, 'LLDB.framework') - else: - return lib_dir + return "%s:%s" % (existing_library_path, configuration.lldb_libs_dir) + if sys.platform.startswith("darwin") and configuration.lldb_framework_path: + return configuration.lldb_framework_path + return configuration.lldb_libs_dir def getLibcPlusPlusLibs(self): if self.getPlatform() in ('freebsd', 'linux', 'netbsd', 'openbsd'): |
