Skip to content

Commit

Permalink
ci: Silence lsan hits in libzmq
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisklein committed Mar 6, 2023
1 parent 3781495 commit c8fde17
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 5 deletions.
9 changes: 7 additions & 2 deletions cmake/GTestHelper.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
################################################################################
# Copyright (C) 2017-2018 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
# Copyright (C) 2017-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
# #
# This software is distributed under the terms of the #
# GNU Lesser General Public Licence (LGPL) version 3, #
Expand All @@ -20,6 +20,7 @@
# [DEPENDS dep1 [dep2 ...]]
# [LINKS linklib1 [linklib2 ...]
# [INCLUDES dir1 [dir2 ...]
# [ENVIRONMENT var1=op:val1[;var2=op:val2 ...]]
# [TIMEOUT seconds]
# [RUN_SERIAL ON/OFF])
#
Expand Down Expand Up @@ -56,7 +57,7 @@ function(add_testsuite suitename)
cmake_parse_arguments(testsuite
""
"TIMEOUT;RUN_SERIAL"
"SOURCES;LINKS;DEPENDS;INCLUDES;DEFINITIONS"
"SOURCES;LINKS;DEPENDS;INCLUDES;DEFINITIONS;ENVIRONMENT"
${ARGN}
)

Expand All @@ -77,6 +78,9 @@ function(add_testsuite suitename)
if(testsuite_DEFINITIONS)
target_compile_definitions("${target}" PUBLIC ${testsuite_DEFINITIONS})
endif()
if(testsuite_ENVIRONMENT AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.22)
set(env "ENVIRONMENT_MODIFICATION" ${testsuite_ENVIRONMENT})
endif()
if(BUILD_TIDY_TOOL AND RUN_FAIRMQ_TIDY)
fairmq_target_tidy(TARGET ${target})
endif()
Expand All @@ -97,6 +101,7 @@ function(add_testsuite suitename)
TEST_PREFIX ${suitename}.
PROPERTIES RUN_SERIAL ${testsuite_RUN_SERIAL}
TIMEOUT ${testsuite_TIMEOUT}
${env}
)

list(APPEND ALL_TEST_TARGETS ${target})
Expand Down
20 changes: 17 additions & 3 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function(add_example)
)

if(ARG_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "Unexpected unparsed arguments: ${A_UNPARSED_ARGUMENTS}")
message(FATAL_ERROR "Unexpected unparsed arguments: ${ARG_UNPARSED_ARGUMENTS}")
endif()

if(ARG_NAME)
Expand All @@ -29,9 +29,14 @@ function(add_example)
message(FATAL_ERROR "NAME arg is required")
endif()

if(ARG_DEVICES)
if(ENABLE_SANITIZER_LEAK AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.22)
get_filename_component(lsan_supps "${CMAKE_SOURCE_DIR}/test/leak_sanitizer_suppressions.txt" ABSOLUTE)
set(lsan_options "LSAN_OPTIONS=set:suppressions=${lsan_supps}")
endif()

if(ARG_DEVICE)
set(exe_targets)
foreach(device IN LISTS ARG_DEVICES)
foreach(device IN LISTS ARG_DEVICE)
set(exe "${exe_prefix}-${name}-${device}")
list(APPEND exe_targets ${exe})
add_executable(${exe} "${device}.cxx")
Expand Down Expand Up @@ -73,18 +78,27 @@ function(add_example)
set(test "${testsuite}.${name}.${transport}")
add_test(NAME ${test} COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${test_script} ${transport})
set_tests_properties(${test} PROPERTIES TIMEOUT "30")
if(lsan_options)
set_tests_properties(${test} PROPERTIES ENVIRONMENT_MODIFICATION ${lsan_options})
endif()
else()
foreach(transport IN LISTS transports)
if(ARG_VARIANT)
foreach(variant IN LISTS ARG_VARIANT)
set(test "${testsuite}.${name}.${variant}.${transport}")
add_test(NAME ${test} COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${test_script} ${transport} ${variant})
set_tests_properties(${test} PROPERTIES TIMEOUT "30")
if(lsan_options)
set_tests_properties(${test} PROPERTIES ENVIRONMENT_MODIFICATION ${lsan_options})
endif()
endforeach()
else()
set(test "${testsuite}.${name}.${transport}")
add_test(NAME ${test} COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${test_script} ${transport})
set_tests_properties(${test} PROPERTIES TIMEOUT "30")
if(lsan_options)
set_tests_properties(${test} PROPERTIES ENVIRONMENT_MODIFICATION ${lsan_options})
endif()
endif()
endforeach()
endif()
Expand Down
20 changes: 20 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ if(definitions)
set(definitions DEFINITIONS ${definitions})
endif()

if(ENABLE_SANITIZER_LEAK)
get_filename_component(lsan_supps "${CMAKE_CURRENT_SOURCE_DIR}/leak_sanitizer_suppressions.txt" ABSOLUTE)
set(environment ENVIRONMENT "LSAN_OPTIONS=set:suppressions=${lsan_supps}")
endif()

add_testhelper(runTestDevice
SOURCES
helper/runTestDevice.cxx
Expand Down Expand Up @@ -63,6 +68,7 @@ add_testsuite(Protocols
${CMAKE_CURRENT_BINARY_DIR}
TIMEOUT 20
${definitions}
${environment}
)

add_testsuite(Parts
Expand All @@ -76,6 +82,7 @@ add_testsuite(Parts
${CMAKE_CURRENT_SOURCE_DIR}/parts
${CMAKE_CURRENT_BINARY_DIR}
TIMEOUT 20
${environment}
)

add_testsuite(Message
Expand All @@ -89,6 +96,7 @@ add_testsuite(Message
${CMAKE_CURRENT_BINARY_DIR}
TIMEOUT 20
${definitions}
${environment}
)

add_testsuite(Region
Expand All @@ -103,6 +111,7 @@ add_testsuite(Region
${CMAKE_CURRENT_BINARY_DIR}
TIMEOUT 20
${definitions}
${environment}
)

add_testsuite(Device
Expand All @@ -125,6 +134,7 @@ add_testsuite(Device
${CMAKE_CURRENT_SOURCE_DIR}/device
${CMAKE_CURRENT_BINARY_DIR}
TIMEOUT 20
${environment}
)

set(VERSION_MAJOR 1)
Expand Down Expand Up @@ -170,6 +180,7 @@ add_testsuite(Plugins
${CMAKE_CURRENT_BINARY_DIR}
DEPENDS FairMQPlugin_test_dummy fairmq-plugin-test_dummy2
TIMEOUT 20
${environment}
)

add_testsuite(PluginsPrelinked
Expand All @@ -181,6 +192,7 @@ add_testsuite(PluginsPrelinked
INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
TIMEOUT 20
${environment}
)

add_testsuite(PluginServices
Expand All @@ -194,6 +206,7 @@ add_testsuite(PluginServices
INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
TIMEOUT 20
${environment}
)

add_testsuite(EventManager
Expand All @@ -205,6 +218,7 @@ add_testsuite(EventManager
INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
TIMEOUT 20
${environment}
)

add_testsuite(Properties
Expand All @@ -217,6 +231,7 @@ add_testsuite(Properties
INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
TIMEOUT 20
${environment}
)

# add_testsuite(StateMachine
Expand All @@ -239,6 +254,7 @@ add_testsuite(Tools
INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
TIMEOUT 20
${environment}
)

add_testsuite(Channel
Expand All @@ -250,6 +266,7 @@ add_testsuite(Channel
INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
TIMEOUT 20
${environment}
)

add_testsuite(Transport
Expand All @@ -264,6 +281,7 @@ add_testsuite(Transport
${CMAKE_CURRENT_BINARY_DIR}
TIMEOUT 20
${definitions}
${environment}
)

add_testsuite(Poller
Expand All @@ -276,6 +294,7 @@ add_testsuite(Poller
${CMAKE_CURRENT_BINARY_DIR}
TIMEOUT 20
${definitions}
${environment}
)

add_testsuite(MemoryResources
Expand All @@ -288,4 +307,5 @@ add_testsuite(MemoryResources
${CMAKE_CURRENT_BINARY_DIR}
TIMEOUT 20
${definitions}
${environment}
)
1 change: 1 addition & 0 deletions test/leak_sanitizer_suppressions.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
leak:zmq_msg_init_size

0 comments on commit c8fde17

Please sign in to comment.