Skip to content

Commit ba965cd

Browse files
authored
[test] Use LD_LIBRARY_PATH to ensure that a new lib is used (#1989) (#1990)
Add the library `BINARY_DIR` to `LD_LIBRARY_PATH` to ensure that the freshly built `libLLVMSPIRVLib.so` is tested. Otherwise, llvm-spirv spawned by the test suite may use the previously installed `libLLVMSPIRVLib.so`. I have noticed the problem after rebuilding LLVM with `-DLLVM_ENABLE_ASSSERTIONS=ON`. This meant that the previous version of `libLLVMSPIRVLib.so` now crashed, effectively causing the test suite to fail incorrectly. Signed-off-by: Michał Górny <mgorny@gentoo.org>
1 parent 4dca3f4 commit ba965cd

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ llvm_canonicalize_cmake_booleans(SPIRV_SKIP_DEBUG_INFO_TESTS)
33

44
# required by lit.site.cfg.py.in
55
get_target_property(LLVM_SPIRV_DIR llvm-spirv BINARY_DIR)
6+
get_target_property(LLVM_SPIRV_LIB_DIR LLVMSPIRVLib BINARY_DIR)
67
set(LLVM_SPIRV_TEST_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
78

89
if(SPIRV_TOOLS_FOUND AND NOT SPIRV-Tools-tools_FOUND)

test/lit.cfg.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
else:
7777
config.substitutions.append(('spirv-val', ':'))
7878

79+
llvm_config.with_system_environment('LD_LIBRARY_PATH')
7980
if using_spirv_tools:
80-
llvm_config.with_system_environment('LD_LIBRARY_PATH')
8181
llvm_config.with_environment('LD_LIBRARY_PATH', config.spirv_tools_lib_dir, append_path=True)
82+
llvm_config.with_environment('LD_LIBRARY_PATH', config.llvm_spirv_lib_dir, append_path=True)

test/lit.site.cfg.py.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ config.llvm_src_root = "@LLVM_SOURCE_DIR@"
66
config.llvm_obj_root = "@LLVM_BINARY_DIR@"
77
config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
88
config.llvm_spirv_dir = "@LLVM_SPIRV_DIR@"
9+
config.llvm_spirv_lib_dir = "@LLVM_SPIRV_LIB_DIR@"
910
config.llvm_libs_dir = "@LLVM_LIBS_DIR@"
1011
config.llvm_shlib_dir = "@SHLIBDIR@"
1112
config.llvm_plugin_ext = "@LLVM_PLUGIN_EXT@"

0 commit comments

Comments
 (0)