Skip to content

Commit

Permalink
Ignore system-wide installed HWLOC for test/conformance_arena_constra…
Browse files Browse the repository at this point in the history
…ints (#1624)

Signed-off-by: Isaev, Ilya <[email protected]>
Co-authored-by: Aleksei Fedotov <[email protected]>
  • Loading branch information
isaevil and aleksei-fedotov authored Jan 31, 2025
1 parent 79b5d68 commit 1684f05
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,35 @@ function(tbb_add_tbbbind_test)
endif()
ProcessorCount(SYSTEM_CONCURRENCY)

# Make sure fake HWLOC is found before system one
if (UNIX AND NOT TARGET HWLOC::hwloc_stub AND NOT TBB_TCM_TESTING)
# The idea is to produce fake HWLOC library and link it with the test
# to ensure that TBBBind won't be loaded in order to simulate the case
# when real HWLOC is not present in the system.
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/stubhwloc.cpp "void hwloc_stub(){}")
add_library(hwloc_stub SHARED ${CMAKE_CURRENT_BINARY_DIR}/stubhwloc.cpp)
add_library(HWLOC::hwloc_stub ALIAS hwloc_stub)

set_target_properties(hwloc_stub PROPERTIES
OUTPUT_NAME "hwloc" SOVERSION 15
)
endif()

set_tests_properties(${_tbbbind_test_NAME} PROPERTIES
PASS_REGULAR_EXPRESSION "oneTBB: TBBBIND.*UNAVAILABLE"
FAIL_REGULAR_EXPRESSION "Status:.*FAILURE"
)

if (TARGET HWLOC::hwloc_stub)
_tbb_get_hwloc_runtime_vars(
ENV_EXTENSION_VARIABLE HWLOC_RUNTIME_VARS
HWLOC_VERSION_LIST "hwloc_stub"
)
target_link_libraries(${_tbbbind_test_NAME} PRIVATE HWLOC::hwloc_stub)

set_property(TEST ${_tbbbind_test_NAME} PROPERTY ENVIRONMENT "${HWLOC_RUNTIME_VARS}" APPEND)
endif()

if (TARGET HWLOC::hwloc_2_5 AND NOT HWLOC_2_5_TESTS_STATUS_SHOWN)
message(STATUS "HWLOC 2.5 dependent tests were enabled.")
set(HWLOC_2_5_TESTS_STATUS_SHOWN TRUE PARENT_SCOPE)
Expand Down

0 comments on commit 1684f05

Please sign in to comment.