From 5829140e514e3334d2a33edc4e354a03ee72d3a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Artur=20Ba=C4=87?= Date: Sat, 24 Feb 2024 12:08:09 +0100 Subject: [PATCH] make sharedmem tests to use different shmem name when run in parallel --- unit_tests/CMakeLists.txt | 12 +++++++++++- unit_tests/shared_mem_util_ut.cc | 2 +- unit_tests/stack_buffer_ut.cc | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/unit_tests/CMakeLists.txt b/unit_tests/CMakeLists.txt index 60c4a54..9160f9e 100644 --- a/unit_tests/CMakeLists.txt +++ b/unit_tests/CMakeLists.txt @@ -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) @@ -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() diff --git a/unit_tests/shared_mem_util_ut.cc b/unit_tests/shared_mem_util_ut.cc index ff66a98..3bcdcbf 100644 --- a/unit_tests/shared_mem_util_ut.cc +++ b/unit_tests/shared_mem_util_ut.cc @@ -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() { diff --git a/unit_tests/stack_buffer_ut.cc b/unit_tests/stack_buffer_ut.cc index 99fec8d..fa10042 100644 --- a/unit_tests/stack_buffer_ut.cc +++ b/unit_tests/stack_buffer_ut.cc @@ -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);