Skip to content
Permalink
Browse files
Add code coverage support in conan, and eliminate gcc warnings when u…
…sing cpputest with build-in memory leak detector.
  • Loading branch information
PengZheng committed Mar 28, 2022
1 parent 04df30e commit a47432c8fd34fbfaad0cc41f9c1b1a2e686dc9f1
Showing 3 changed files with 8 additions and 6 deletions.
@@ -33,10 +33,10 @@ if (ENABLE_ADDRESS_SANITIZER)
set(CMAKE_CXX_FLAGS "-lasan -fsanitize=address -fno-omit-frame-pointer ${CMAKE_CXX_FLAGS}")
endif ()

# if (ENABLE_TESTING)
# set(CMAKE_C_FLAGS "-DCPPUTEST_MEM_LEAK_DETECTION_DISABLED ${CMAKE_C_FLAGS}")
# set(CMAKE_CXX_FLAGS "-DCPPUTEST_MEM_LEAK_DETECTION_DISABLED ${CMAKE_CXX_FLAGS}")
# endif ()
if (ENABLE_TESTING)
set(CMAKE_C_FLAGS "-DCPPUTEST_MEM_LEAK_DETECTION_DISABLED ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-DCPPUTEST_MEM_LEAK_DETECTION_DISABLED ${CMAKE_CXX_FLAGS}")
endif ()
endif()

if (ENABLE_UNDEFINED_SANITIZER)
@@ -135,7 +135,7 @@ function (setup_target_for_coverage)
# Capturing lcov counters and generating report
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/coverage
COMMAND ${LCOV_PATH} --directory ${COVERAGE_SCAN_DIR} --capture --output-file ${OUTPUT_FILE}
COMMAND ${LCOV_PATH} --remove ${OUTPUT_FILE} '**/mock/*' '**/test/*' '**/gtest/*' '**/tst/*' '**/celix/gen/*' '**/googletest_project/*' '**/glog/*' '/usr/*' --output-file ${OUTPUT_FILE}.cleaned
COMMAND ${LCOV_PATH} --remove ${OUTPUT_FILE} '**/mock/*' '**/.conan/*' '**/test/*' '**/gtest/*' '**/tst/*' '**/celix/gen/*' '**/googletest_project/*' '**/glog/*' '/usr/*' --output-file ${OUTPUT_FILE}.cleaned

#test dependencies, so that test is runned
DEPENDENCIES ${TEST_TARGET_NAME}
@@ -40,6 +40,7 @@ class CelixConan(ConanFile):

options = {
"enable_testing": [True, False],
"enable_code_coverage": [True, False],
"enable_address_sanitizer": [True, False],
"enable_undefined_sanitizer": [True, False],
"enable_thread_sanitizer": [True, False],
@@ -81,6 +82,7 @@ class CelixConan(ConanFile):
}
default_options = {
"enable_testing": False,
"enable_code_coverage": False,
"enable_address_sanitizer": False,
"enable_undefined_sanitizer": False,
"enable_thread_sanitizer": False,
@@ -128,7 +130,6 @@ def validate(self):

def package_id(self):
del self.info.options.build_all
del self.info.options.enable_testing
del self.info.options.celix_add_openssl_dep
# the followings are not installed
del self.info.options.build_device_access_example
@@ -156,6 +157,7 @@ def configure(self):
self.options.build_cxx_rsa_integration = False
if not self.options.enable_testing:
self.options.build_pubsub_integration = False
self.options.enable_code_coverage = False
if not self.options.build_device_access:
self.options.build_device_access_example = False
if not self.options.build_log_service:

0 comments on commit a47432c

Please sign in to comment.