mirror of
https://github.com/intel/llvm.git
synced 2026-01-20 10:58:11 +08:00
[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 llvm-svn: 343280
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -14,3 +14,11 @@ config.test_source_root = config.test_exec_root
|
||||
# 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
|
||||
|
||||
@@ -10,6 +10,7 @@ config.compiler_rt_libdir = "@COMPILER_RT_RESOLVED_LIBRARY_OUTPUT_DIR@"
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user