[Lldb-commits] [PATCH] D73767: [lldb] [test] Respect LLVM_LIBDIR_SUFFIX when linking liblldb

Michał Górny via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Jan 31 00:46:16 PST 2020


mgorny created this revision.
mgorny added reviewers: labath, beanz.

Pass LLVM_LIBDIR_SUFFIX over to dotest, and append it to 'lib' when
linking liblldb.  This fixes link failures when tests are run within
stand-alone builds on systems where LLVM_LIBDIR_SUFFIX is not empty.


https://reviews.llvm.org/D73767

Files:
  lldb/packages/Python/lldbsuite/test/configuration.py
  lldb/packages/Python/lldbsuite/test/dotest.py
  lldb/packages/Python/lldbsuite/test/dotest_args.py
  lldb/packages/Python/lldbsuite/test/lldbtest.py
  lldb/test/API/lit.cfg.py
  lldb/test/API/lit.site.cfg.py.in


Index: lldb/test/API/lit.site.cfg.py.in
===================================================================
--- lldb/test/API/lit.site.cfg.py.in
+++ lldb/test/API/lit.site.cfg.py.in
@@ -10,6 +10,7 @@
 config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
 config.lldb_obj_root = "@LLDB_BINARY_DIR@"
 config.lldb_src_root = "@LLDB_SOURCE_DIR@"
+config.libdir_suffix = "@LLVM_LIBDIR_SUFFIX@"
 config.cmake_cxx_compiler = "@CMAKE_CXX_COMPILER@"
 config.host_os = "@HOST_OS@"
 config.host_triple = "@LLVM_HOST_TRIPLE@"
Index: lldb/test/API/lit.cfg.py
===================================================================
--- lldb/test/API/lit.cfg.py
+++ lldb/test/API/lit.cfg.py
@@ -114,6 +114,9 @@
 if config.filecheck:
   dotest_cmd += ['--filecheck', config.filecheck]
 
+if config.libdir_suffix:
+  dotest_cmd += ['--libdir-suffix', config.libdir_suffix]
+
 # We don't want to force users passing arguments to lit to use `;` as a
 # separator. We use Python's simple lexical analyzer to turn the args into a
 # list. Pass there arguments last so they can override anything that was
Index: lldb/packages/Python/lldbsuite/test/lldbtest.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1426,7 +1426,9 @@
                                                  os.path.join(
                                                      os.environ["LLDB_SRC"],
                                                      "include")),
-                'LD_EXTRAS': "-L%s/../lib -llldb -Wl,-rpath,%s/../lib" % (lib_dir, lib_dir)}
+                'LD_EXTRAS': "-L%s/../lib%s -llldb -Wl,-rpath,%s/../lib%s" % (
+                    lib_dir, configuration.libdir_suffix,
+                    lib_dir, configuration.libdir_suffix)}
         if self.TraceOn():
             print(
                 "Building LLDB Driver (%s) from sources %s" %
Index: lldb/packages/Python/lldbsuite/test/dotest_args.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/dotest_args.py
+++ lldb/packages/Python/lldbsuite/test/dotest_args.py
@@ -172,6 +172,11 @@
         dest='clang_module_cache_dir',
         metavar='The clang module cache directory used by Clang',
         help='The clang module cache directory used in the Make files by Clang while building tests. Defaults to <test build directory>/module-cache-clang.')
+    group.add_argument(
+        '--libdir-suffix',
+        dest='libdir_suffix',
+        metavar='suffix',
+        help='The suffix appended to "lib" directory, e.g. "64"')
 
     # Configuration options
     group = parser.add_argument_group('Remote platform options')
Index: lldb/packages/Python/lldbsuite/test/dotest.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/dotest.py
+++ lldb/packages/Python/lldbsuite/test/dotest.py
@@ -452,6 +452,9 @@
 
     os.environ['CLANG_MODULE_CACHE_DIR'] = configuration.clang_module_cache_dir
 
+    if args.libdir_suffix:
+        configuration.libdir_suffix = args.libdir_suffix
+
     # Gather all the dirs passed on the command line.
     if len(args.args) > 0:
         configuration.testdirs = [os.path.realpath(os.path.abspath(x)) for x in args.args]
Index: lldb/packages/Python/lldbsuite/test/configuration.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/configuration.py
+++ lldb/packages/Python/lldbsuite/test/configuration.py
@@ -136,6 +136,10 @@
 # same base name.
 all_tests = set()
 
+# The suffix appended to 'lib' directory, used to find LLDB library.
+libdir_suffix = ''
+
+
 def shouldSkipBecauseOfCategories(test_categories):
     if use_categories:
         if len(test_categories) == 0 or len(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73767.241644.patch
Type: text/x-patch
Size: 3841 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200131/5041c036/attachment.bin>


More information about the lldb-commits mailing list