[PATCH] D52597: [XRay] Add LD_LIBRARY_PATH to env variables for Unit Tests

Dean Michael Berris via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 27 16:17:32 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rCRT343280: [XRay] Add LD_LIBRARY_PATH to env variables for Unit Tests (authored by dberris, committed by ).
Herald added a subscriber: Sanitizers.

Changed prior to commit:
  https://reviews.llvm.org/D52597?vs=167266&id=167412#toc

Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D52597

Files:
  lib/xray/tests/CMakeLists.txt
  test/xray/Unit/lit.site.cfg.in
  unittests/lit.common.unit.configured.in


Index: lib/xray/tests/CMakeLists.txt
===================================================================
--- lib/xray/tests/CMakeLists.txt
+++ lib/xray/tests/CMakeLists.txt
@@ -52,11 +52,6 @@
   -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 @@
     # 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)
Index: unittests/lit.common.unit.configured.in
===================================================================
--- unittests/lit.common.unit.configured.in
+++ unittests/lit.common.unit.configured.in
@@ -10,6 +10,7 @@
 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.
Index: test/xray/Unit/lit.site.cfg.in
===================================================================
--- test/xray/Unit/lit.site.cfg.in
+++ test/xray/Unit/lit.site.cfg.in
@@ -14,3 +14,11 @@
 # 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52597.167412.patch
Type: text/x-patch
Size: 2362 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180927/837b0465/attachment.bin>


More information about the llvm-commits mailing list