Skip to content

Commit

Permalink
Use LD_LIBRARY_PATH to ensure that a new lib is used (intel#1989) (in…
Browse files Browse the repository at this point in the history
…tel#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 <[email protected]>

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@ba965cd
  • Loading branch information
mgorny authored and kchusha committed May 10, 2023
1 parent aed8d20 commit b1163aa
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions llvm-spirv/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ llvm_canonicalize_cmake_booleans(SPIRV_SKIP_DEBUG_INFO_TESTS)

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

if(SPIRV_TOOLS_FOUND AND NOT SPIRV-Tools-tools_FOUND)
Expand Down
3 changes: 2 additions & 1 deletion llvm-spirv/test/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
else:
config.substitutions.append(('spirv-val', ':'))

llvm_config.with_system_environment('LD_LIBRARY_PATH')
if using_spirv_tools:
llvm_config.with_system_environment('LD_LIBRARY_PATH')
llvm_config.with_environment('LD_LIBRARY_PATH', config.spirv_tools_lib_dir, append_path=True)
llvm_config.with_environment('LD_LIBRARY_PATH', config.llvm_spirv_lib_dir, append_path=True)
1 change: 1 addition & 0 deletions llvm-spirv/test/lit.site.cfg.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ config.llvm_src_root = "@LLVM_SOURCE_DIR@"
config.llvm_obj_root = "@LLVM_BINARY_DIR@"
config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
config.llvm_spirv_dir = "@LLVM_SPIRV_DIR@"
config.llvm_spirv_lib_dir = "@LLVM_SPIRV_LIB_DIR@"
config.llvm_libs_dir = "@LLVM_LIBS_DIR@"
config.llvm_shlib_dir = "@SHLIBDIR@"
config.llvm_plugin_ext = "@LLVM_PLUGIN_EXT@"
Expand Down

0 comments on commit b1163aa

Please sign in to comment.