Skip to content

Commit

Permalink
make sharedmem tests to use different shmem name when run in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
Artur Bać committed Feb 24, 2024
1 parent f7a06d1 commit 5829140
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
12 changes: 11 additions & 1 deletion unit_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
endif()

include(small_vectors_ut)
set(COMPILER_ID "${CMAKE_CXX_COMPILER_ID}")
set(COMPILER_VERSION "${CMAKE_CXX_COMPILER_VERSION}")
set(COMPILER_INFO "${COMPILER_ID} ${COMPILER_VERSION}")
message(STATUS "Compiler Info: ${COMPILER_INFO}")

get_filename_component(LAST_PATH_ELEMENT "${CMAKE_BINARY_DIR}" NAME)
set(COMPILER_INFO "${COMPILER_INFO}_at_${LAST_PATH_ELEMENT}")
message(STATUS "Compiler and Standard Library Info: ${COMPILER_INFO}")


add_unittest(unaligned_ut)
target_compile_options(unaligned_ut PRIVATE -Wno-float-equal)
Expand All @@ -55,10 +64,11 @@ if(Boost_FOUND)

add_unittest(shared_mem_util_ut)
target_link_libraries(shared_mem_util_ut PRIVATE Boost::system )

target_compile_definitions(shared_mem_util_ut PRIVATE SMALL_VECTORS_COMPILER_INFO="${COMPILER_INFO}")
# add_unittest(ring_queue_ut)
# target_link_libraries(ring_queue_ut PRIVATE Boost::system )

add_unittest(stack_buffer_ut)
target_link_libraries(stack_buffer_ut PRIVATE Boost::system )
target_compile_definitions(stack_buffer_ut PRIVATE SMALL_VECTORS_COMPILER_INFO="${COMPILER_INFO}")
endif()
2 changes: 1 addition & 1 deletion unit_tests/shared_mem_util_ut.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct destruction_only
}
};

constexpr auto shmem_name{"shmem test"};
constexpr auto shmem_name{"shmem test for " SMALL_VECTORS_COMPILER_INFO };

int main()
{
Expand Down
2 changes: 1 addition & 1 deletion unit_tests/stack_buffer_ut.cc
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ int main()
result |= metatests::run_consteval_test(fn_test);
};

constexpr auto shmem_name{"shmem test"};
constexpr auto shmem_name{"shmem test for " SMALL_VECTORS_COMPILER_INFO};
bip::shared_memory_object shm{bip::open_or_create, shmem_name, bip::read_write};
shm.truncate(8192);

Expand Down

0 comments on commit 5829140

Please sign in to comment.