mgorny updated this revision to Diff 188399. mgorny edited the summary of this revision. mgorny added a comment.
While working on other patches, I've noticed top-level lit.site.cfg* has SHLIBDIR which serves the same purpose as in clang. I've updated this patch to include it for Suite tests, and therefore future-proof it for stand-alone builds with shared LLDB libraries. This is also what clang does, exactly. I've also fixed indentation to match LLDB style. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D58610/new/ https://reviews.llvm.org/D58610 Files: lldb/lit/Suite/lit.cfg lldb/lit/Suite/lit.site.cfg.in Index: lldb/lit/Suite/lit.site.cfg.in =================================================================== --- lldb/lit/Suite/lit.site.cfg.in +++ lldb/lit/Suite/lit.site.cfg.in @@ -5,6 +5,7 @@ config.llvm_obj_root = "@LLVM_BINARY_DIR@" config.llvm_tools_dir = "@LLVM_TOOLS_DIR@" config.llvm_libs_dir = "@LLVM_LIBS_DIR@" +config.llvm_shlib_dir = "@SHLIBDIR@" config.llvm_build_mode = "@LLVM_BUILD_MODE@" config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@" config.lldb_obj_root = "@LLDB_BINARY_DIR@" Index: lldb/lit/Suite/lit.cfg =================================================================== --- lldb/lit/Suite/lit.cfg +++ lldb/lit/Suite/lit.cfg @@ -3,6 +3,7 @@ # Configuration file for the 'lit' test runner. import os +import platform import shlex import lit.formats @@ -32,6 +33,28 @@ 'detect_stack_use_after_return=1' config.environment['DYLD_INSERT_LIBRARIES'] = runtime +# Shared library build of LLVM may require LD_LIBRARY_PATH or equivalent. +def find_shlibpath_var(): + if platform.system() in ['Linux', 'FreeBSD', 'NetBSD', 'SunOS']: + yield 'LD_LIBRARY_PATH' + elif platform.system() == 'Darwin': + yield 'DYLD_LIBRARY_PATH' + elif platform.system() == 'Windows': + yield 'PATH' + +for shlibpath_var in find_shlibpath_var(): + # In stand-alone build llvm_shlib_dir specifies LLDB's lib directory + # while llvm_libs_dir specifies LLVM's lib directory. + shlibpath = os.path.pathsep.join( + (config.llvm_shlib_dir, + config.llvm_libs_dir, + config.environment.get(shlibpath_var, ''))) + config.environment[shlibpath_var] = shlibpath + break +else: + lit_config.warning("unable to inject shared library path on '{}'" + .format(platform.system())) + # Build dotest command. dotest_cmd = [config.dotest_path, '-q'] dotest_cmd.extend(config.dotest_args_str.split(';'))
Index: lldb/lit/Suite/lit.site.cfg.in =================================================================== --- lldb/lit/Suite/lit.site.cfg.in +++ lldb/lit/Suite/lit.site.cfg.in @@ -5,6 +5,7 @@ config.llvm_obj_root = "@LLVM_BINARY_DIR@" config.llvm_tools_dir = "@LLVM_TOOLS_DIR@" config.llvm_libs_dir = "@LLVM_LIBS_DIR@" +config.llvm_shlib_dir = "@SHLIBDIR@" config.llvm_build_mode = "@LLVM_BUILD_MODE@" config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@" config.lldb_obj_root = "@LLDB_BINARY_DIR@" Index: lldb/lit/Suite/lit.cfg =================================================================== --- lldb/lit/Suite/lit.cfg +++ lldb/lit/Suite/lit.cfg @@ -3,6 +3,7 @@ # Configuration file for the 'lit' test runner. import os +import platform import shlex import lit.formats @@ -32,6 +33,28 @@ 'detect_stack_use_after_return=1' config.environment['DYLD_INSERT_LIBRARIES'] = runtime +# Shared library build of LLVM may require LD_LIBRARY_PATH or equivalent. +def find_shlibpath_var(): + if platform.system() in ['Linux', 'FreeBSD', 'NetBSD', 'SunOS']: + yield 'LD_LIBRARY_PATH' + elif platform.system() == 'Darwin': + yield 'DYLD_LIBRARY_PATH' + elif platform.system() == 'Windows': + yield 'PATH' + +for shlibpath_var in find_shlibpath_var(): + # In stand-alone build llvm_shlib_dir specifies LLDB's lib directory + # while llvm_libs_dir specifies LLVM's lib directory. + shlibpath = os.path.pathsep.join( + (config.llvm_shlib_dir, + config.llvm_libs_dir, + config.environment.get(shlibpath_var, ''))) + config.environment[shlibpath_var] = shlibpath + break +else: + lit_config.warning("unable to inject shared library path on '{}'" + .format(platform.system())) + # Build dotest command. dotest_cmd = [config.dotest_path, '-q'] dotest_cmd.extend(config.dotest_args_str.split(';'))
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits