This is an automated email from the ASF dual-hosted git repository.

astitcher pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git


The following commit(s) were added to refs/heads/main by this push:
     new 4aa238174 PROTON-2882: Fix the Coverage build to work with the current 
tree/tools
4aa238174 is described below

commit 4aa2381749a52b761fc984a0f21eeb41074cec9b
Author: Andrew Stitcher <astitc...@apache.org>
AuthorDate: Fri Mar 28 17:38:06 2025 -0400

    PROTON-2882: Fix the Coverage build to work with the current tree/tools
---
 CMakeLists.txt             |  4 ++--
 python/CMakeLists.txt      | 11 ++++++-----
 scripts/record-coverage.sh |  4 ++--
 3 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2e928efeb..d03973235 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -105,8 +105,8 @@ else (CMAKE_CONFIGURATION_TYPES)
 
   # Set up extra coverage analysis options for gcc and clang
   if (CMAKE_COMPILER_IS_GNUCC)
-    set (CMAKE_C_FLAGS_COVERAGE "-g -O0 --coverage")
-    set (CMAKE_CXX_FLAGS_COVERAGE "-g -O0 --coverage")
+    set (CMAKE_C_FLAGS_COVERAGE "-g -O0 --coverage -fprofile-update=atomic")
+    set (CMAKE_CXX_FLAGS_COVERAGE "-g -O0 --coverage -fprofile-update=atomic ")
     set (CMAKE_EXE_LINKER_FLAGS_COVERAGE "--coverage")
     set (CMAKE_MODULE_LINKER_FLAGS_COVERAGE "--coverage")
     set (CMAKE_SHARED_LINKER_FLAGS_COVERAGE "--coverage")
diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt
index 42874571f..1cc04f235 100644
--- a/python/CMakeLists.txt
+++ b/python/CMakeLists.txt
@@ -197,13 +197,14 @@ if (BUILD_TESTING)
   set (py_tests "${py_src}/tests")
   set (tests_py "${py_src}/../tests/py")
 
-  set (py_path $<TARGET_FILE_DIR:msgr-recv> ${py_bld} $ENV{PATH})
+  set (py_path $<$<TARGET_EXISTS:msgr-recv>:$<TARGET_FILE_DIR:msgr-recv>> 
${py_bld} $ENV{PATH})
   set (py_pythonpath ${py_tests} ${py_src} ${py_bin} ${tests_py} 
$ENV{PYTHONPATH})
   to_native_path ("${py_pythonpath}" py_pythonpath)
   to_native_path ("${py_path}" py_path)
 
   if (CMAKE_BUILD_TYPE MATCHES "Coverage")
-    set (python_coverage_options -m coverage run --parallel-mode)
+    set (python_coverage_module "coverage")
+    set (python_coverage_options -m ${python_coverage_module} run 
--parallel-mode)
   endif(CMAKE_BUILD_TYPE MATCHES "Coverage")
 
   if (ENABLE_PYTHON_ISOLATED)
@@ -221,7 +222,7 @@ if (BUILD_TESTING)
     add_custom_command(
       OUTPUT .timestamp.test_env
       COMMAND ${Python_EXECUTABLE} -m venv ${pytest_venv}
-      COMMAND ${pytest_executable} -m pip install --disable-pip-version-check 
cffi
+      COMMAND ${pytest_executable} -m pip install --disable-pip-version-check 
cffi "${python_coverage_module}"
       COMMAND ${CMAKE_COMMAND} -E env
         "CMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}"
         "QPID_PROTON_CORE_TARGET_DIR=$<TARGET_FILE_DIR:qpid-proton-core>"
@@ -231,7 +232,7 @@ if (BUILD_TESTING)
       COMMAND ${CMAKE_COMMAND} -E touch .timestamp.test_env
       BYPRODUCTS ${pytest_executable}
     )
-  add_custom_target(pytest_cffi ALL DEPENDS .timestamp.test_env)
+    add_custom_target(pytest_cffi ALL DEPENDS .timestamp.test_env)
   elseif(CFFI_MODULE_FOUND)
     set(pytest_executable "${Python_EXECUTABLE}")
     set(pytest_venv "${py_bin}")
@@ -245,7 +246,7 @@ if (BUILD_TESTING)
       COMMAND ${CMAKE_COMMAND} -E touch .timestamp.test_env
       DEPENDS pysrc_copied qpid-proton-core
     )
-  add_custom_target(pytest_cffi ALL DEPENDS .timestamp.test_env)
+    add_custom_target(pytest_cffi ALL DEPENDS .timestamp.test_env)
   endif()
 
 
diff --git a/scripts/record-coverage.sh b/scripts/record-coverage.sh
index 3d1aa1d5d..619d5b996 100755
--- a/scripts/record-coverage.sh
+++ b/scripts/record-coverage.sh
@@ -51,8 +51,8 @@ lcov -c -d $BLDPATH -o proton-ctest.info
 # Total them up
 lcov --add proton-base.info --add proton-ctest.info > proton-total-raw.info
 
-# Snip out stuff in /usr (we don't care about coverage in system code)
-lcov --remove proton-total-raw.info "/usr/include*" "/usr/share*" > 
proton-total.info
+# Snip out stuff in /usr (we don't care about coverage in system code) & in 
unit test framework
+lcov --ignore-errors unused --remove proton-total-raw.info "/usr/include*" 
"/usr/share*" "tests/include/*"> proton-total.info
 
 # Generate report
 rm -rf html


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org
For additional commands, e-mail: commits-h...@qpid.apache.org

Reply via email to