From 600076bc7518f313bef43da5b6dbe21887036f38 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Fri, 3 May 2024 11:59:56 -0700 Subject: [PATCH] Enable sanitizers for service tests --- .../tests/FleetProvisioning/CMakeLists.txt | 16 ++++++++++++++++ servicetests/tests/JobsExecution/CMakeLists.txt | 16 ++++++++++++++++ servicetests/tests/ShadowUpdate/CMakeLists.txt | 16 ++++++++++++++++ 3 files changed, 48 insertions(+) diff --git a/servicetests/tests/FleetProvisioning/CMakeLists.txt b/servicetests/tests/FleetProvisioning/CMakeLists.txt index efcb43bdc..e01f57e42 100644 --- a/servicetests/tests/FleetProvisioning/CMakeLists.txt +++ b/servicetests/tests/FleetProvisioning/CMakeLists.txt @@ -25,4 +25,20 @@ find_package(IotIdentity-cpp REQUIRED) install(TARGETS ${PROJECT_NAME} DESTINATION bin) +if (UNIX AND NOT APPLE) + include(GNUInstallDirs) +elseif(NOT DEFINED CMAKE_INSTALL_LIBDIR) + set(CMAKE_INSTALL_LIBDIR "lib") + + if (${CMAKE_INSTALL_LIBDIR} STREQUAL "lib64") + set(FIND_LIBRARY_USE_LIB64_PATHS true) + endif() +endif() + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_PREFIX_PATH}/${CMAKE_INSTALL_LIBDIR}/cmake") + +include(AwsSanitizers) +enable_language(C) +aws_add_sanitizers(${PROJECT_NAME}) + target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-crt-cpp AWS::IotIdentity-cpp) diff --git a/servicetests/tests/JobsExecution/CMakeLists.txt b/servicetests/tests/JobsExecution/CMakeLists.txt index 70577d337..64ffbea46 100644 --- a/servicetests/tests/JobsExecution/CMakeLists.txt +++ b/servicetests/tests/JobsExecution/CMakeLists.txt @@ -25,4 +25,20 @@ find_package(IotJobs-cpp REQUIRED) install(TARGETS ${PROJECT_NAME} DESTINATION bin) +if (UNIX AND NOT APPLE) + include(GNUInstallDirs) +elseif(NOT DEFINED CMAKE_INSTALL_LIBDIR) + set(CMAKE_INSTALL_LIBDIR "lib") + + if (${CMAKE_INSTALL_LIBDIR} STREQUAL "lib64") + set(FIND_LIBRARY_USE_LIB64_PATHS true) + endif() +endif() + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_PREFIX_PATH}/${CMAKE_INSTALL_LIBDIR}/cmake") + +include(AwsSanitizers) +enable_language(C) +aws_add_sanitizers(${PROJECT_NAME}) + target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-crt-cpp AWS::IotJobs-cpp) diff --git a/servicetests/tests/ShadowUpdate/CMakeLists.txt b/servicetests/tests/ShadowUpdate/CMakeLists.txt index 3e10518c6..7a87b4856 100644 --- a/servicetests/tests/ShadowUpdate/CMakeLists.txt +++ b/servicetests/tests/ShadowUpdate/CMakeLists.txt @@ -25,4 +25,20 @@ find_package(IotShadow-cpp REQUIRED) install(TARGETS ${PROJECT_NAME} DESTINATION bin) +if (UNIX AND NOT APPLE) + include(GNUInstallDirs) +elseif(NOT DEFINED CMAKE_INSTALL_LIBDIR) + set(CMAKE_INSTALL_LIBDIR "lib") + + if (${CMAKE_INSTALL_LIBDIR} STREQUAL "lib64") + set(FIND_LIBRARY_USE_LIB64_PATHS true) + endif() +endif() + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_PREFIX_PATH}/${CMAKE_INSTALL_LIBDIR}/cmake") + +include(AwsSanitizers) +enable_language(C) +aws_add_sanitizers(${PROJECT_NAME}) + target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-crt-cpp AWS::IotShadow-cpp)