[compiler-rt] r343280 - [XRay] Add LD_LIBRARY_PATH to env variables for Unit Tests
Dean Michael Berris via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 27 16:15:05 PDT 2018
Author: dberris
Date: Thu Sep 27 16:15:05 2018
New Revision: 343280
URL: http://llvm.org/viewvc/llvm-project?rev=343280&view=rev
Log:
[XRay] Add LD_LIBRARY_PATH to env variables for Unit Tests
Summary:
This change allows us to use the library path from which the LLVM
libraries are installed, in case the LLVM installation generates shared
libraries.
This should address llvm.org/PR39070.
Reviewers: mboerger, eizan
Subscribers: mgorny, jfb, llvm-commits
Differential Revision: https://reviews.llvm.org/D52597
Modified:
compiler-rt/trunk/lib/xray/tests/CMakeLists.txt
compiler-rt/trunk/test/xray/Unit/lit.site.cfg.in
compiler-rt/trunk/unittests/lit.common.unit.configured.in
Modified: compiler-rt/trunk/lib/xray/tests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/tests/CMakeLists.txt?rev=343280&r1=343279&r2=343280&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/tests/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/xray/tests/CMakeLists.txt Thu Sep 27 16:15:05 2018
@@ -52,11 +52,6 @@ set(XRAY_UNITTEST_LINK_FLAGS
-l${SANITIZER_CXX_ABI_LIBRARY})
if (NOT APPLE)
- append_list_if(COMPILER_RT_HAS_LIBM -lm XRAY_UNITTEST_LINK_FLAGS)
- append_list_if(COMPILER_RT_HAS_LIBRT -lrt XRAY_UNITTEST_LINK_FLAGS)
- append_list_if(COMPILER_RT_HAS_LIBDL -ldl XRAY_UNITTEST_LINK_FLAGS)
- append_list_if(COMPILER_RT_HAS_LIBPTHREAD -pthread XRAY_UNITTEST_LINK_FLAGS)
-
# Needed by LLVMSupport.
append_list_if(
COMPILER_RT_HAS_TERMINFO
@@ -74,6 +69,11 @@ if (NOT APPLE)
# We also add the actual libraries to link as dependencies.
list(APPEND XRAY_UNITTEST_LINK_FLAGS -lLLVMXRay -lLLVMSupport -lLLVMTestingSupport)
endif()
+
+ append_list_if(COMPILER_RT_HAS_LIBM -lm XRAY_UNITTEST_LINK_FLAGS)
+ append_list_if(COMPILER_RT_HAS_LIBRT -lrt XRAY_UNITTEST_LINK_FLAGS)
+ append_list_if(COMPILER_RT_HAS_LIBDL -ldl XRAY_UNITTEST_LINK_FLAGS)
+ append_list_if(COMPILER_RT_HAS_LIBPTHREAD -pthread XRAY_UNITTEST_LINK_FLAGS)
endif()
macro(add_xray_unittest testname)
Modified: compiler-rt/trunk/test/xray/Unit/lit.site.cfg.in
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/xray/Unit/lit.site.cfg.in?rev=343280&r1=343279&r2=343280&view=diff
==============================================================================
--- compiler-rt/trunk/test/xray/Unit/lit.site.cfg.in (original)
+++ compiler-rt/trunk/test/xray/Unit/lit.site.cfg.in Thu Sep 27 16:15:05 2018
@@ -14,3 +14,11 @@ config.test_source_root = config.test_ex
# Do not patch the XRay unit tests pre-main, and also make the error logging
# verbose to get a more accurate error logging mechanism.
config.environment['XRAY_OPTIONS'] = 'patch_premain=false'
+
+# Add the LLVM Library directory to the LD_LIBRARY_PATH to allow tests to look
+# up the shared libraries.
+if 'LD_LIBRARY_PATH' in os.environ:
+ libdirs = os.path.pathsep.join((config.llvm_lib_dir, os.environ['LD_LIBRARY_PATH']))
+ config.environment['LD_LIBRARY_PATH'] = libdirs
+else:
+ config.environment['LD_LIBRARY_PATH'] = config.llvm_lib_dir
Modified: compiler-rt/trunk/unittests/lit.common.unit.configured.in
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/unittests/lit.common.unit.configured.in?rev=343280&r1=343279&r2=343280&view=diff
==============================================================================
--- compiler-rt/trunk/unittests/lit.common.unit.configured.in (original)
+++ compiler-rt/trunk/unittests/lit.common.unit.configured.in Thu Sep 27 16:15:05 2018
@@ -10,6 +10,7 @@ config.compiler_rt_libdir = "@COMPILER_R
config.llvm_build_mode = "@LLVM_BUILD_MODE@"
config.host_arch = "@HOST_ARCH@"
config.host_os = "@HOST_OS@"
+config.llvm_lib_dir = "@LLVM_LIBRARY_DIR@"
# LLVM tools dir and build mode can be passed in lit parameters,
# so try to apply substitution.
More information about the llvm-commits
mailing list