From 9764008af2bbc4c9622b0f78c20029972779a0e0 Mon Sep 17 00:00:00 2001 From: ruffsl Date: Sun, 20 Jun 2021 11:32:59 -0700 Subject: [PATCH 01/10] Include filter only by packge name as using package source paths can exclude coverage from other packages such as header files reported usign under workspace's install path --- tools/code_coverage_report.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/code_coverage_report.bash b/tools/code_coverage_report.bash index ccc8220b91..ed6355388b 100755 --- a/tools/code_coverage_report.bash +++ b/tools/code_coverage_report.bash @@ -44,7 +44,7 @@ mkdir -p ${LCOVDIR} # - rviz plugins, which are not used for real navigation INCLUDE_PACKAGES=$( colcon list \ - --paths-only \ + --names-only \ --packages-ignore-regex \ ".*_msgs" \ ".*_tests" \ From 5265b2c11925f948b9e407564edad070edeae7e3 Mon Sep 17 00:00:00 2001 From: ruffsl Date: Sun, 20 Jun 2021 11:38:27 -0700 Subject: [PATCH 02/10] formating --- tools/code_coverage_report.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/code_coverage_report.bash b/tools/code_coverage_report.bash index ed6355388b..ad59281cd0 100755 --- a/tools/code_coverage_report.bash +++ b/tools/code_coverage_report.bash @@ -52,11 +52,11 @@ INCLUDE_PACKAGES=$( | xargs) # Capture executed code data. -fastcov \ +fastcov --lcov \ -d build \ --exclude test/ \ --include $INCLUDE_PACKAGES \ - --output ${LCOVDIR}/total_coverage.info --lcov + --output ${LCOVDIR}/total_coverage.info if [ $COVERAGE_REPORT_VIEW = codecovio ]; then curl -s https://codecov.io/bash > codecov From 26a29383d1e36189d7f72ff6fdda3e31452d8781 Mon Sep 17 00:00:00 2001 From: ruffsl Date: Sun, 20 Jun 2021 11:40:25 -0700 Subject: [PATCH 03/10] Process gcno Process both gcno and gcda coverage files. This option is useful for capturing untested files in the coverage report. --- tools/code_coverage_report.bash | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/code_coverage_report.bash b/tools/code_coverage_report.bash index ad59281cd0..2cb240deb0 100755 --- a/tools/code_coverage_report.bash +++ b/tools/code_coverage_report.bash @@ -56,6 +56,7 @@ fastcov --lcov \ -d build \ --exclude test/ \ --include $INCLUDE_PACKAGES \ + --process-gcno \ --output ${LCOVDIR}/total_coverage.info if [ $COVERAGE_REPORT_VIEW = codecovio ]; then From 08c60ad30e38f5d33f902e6fbce0fec5057a1bf9 Mon Sep 17 00:00:00 2001 From: ruffsl Date: Sun, 20 Jun 2021 11:41:27 -0700 Subject: [PATCH 04/10] Validate sources Check if every source file exists --- tools/code_coverage_report.bash | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/code_coverage_report.bash b/tools/code_coverage_report.bash index 2cb240deb0..94f9fa5eef 100755 --- a/tools/code_coverage_report.bash +++ b/tools/code_coverage_report.bash @@ -57,6 +57,7 @@ fastcov --lcov \ --exclude test/ \ --include $INCLUDE_PACKAGES \ --process-gcno \ + --validate-sources \ --output ${LCOVDIR}/total_coverage.info if [ $COVERAGE_REPORT_VIEW = codecovio ]; then From 81d002b12097a32fb401a6ea6ee4a42718c99b95 Mon Sep 17 00:00:00 2001 From: ruffsl Date: Sun, 20 Jun 2021 11:41:53 -0700 Subject: [PATCH 05/10] Dump statistic Dump total statistic at the end --- tools/code_coverage_report.bash | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/code_coverage_report.bash b/tools/code_coverage_report.bash index 94f9fa5eef..42cd88e9f4 100755 --- a/tools/code_coverage_report.bash +++ b/tools/code_coverage_report.bash @@ -58,6 +58,7 @@ fastcov --lcov \ --include $INCLUDE_PACKAGES \ --process-gcno \ --validate-sources \ + --dump-statistic \ --output ${LCOVDIR}/total_coverage.info if [ $COVERAGE_REPORT_VIEW = codecovio ]; then From 20f28949904ef965c8b5b011f3e387037adc93ce Mon Sep 17 00:00:00 2001 From: ruffsl Date: Sun, 20 Jun 2021 11:42:37 -0700 Subject: [PATCH 06/10] Branch coverage Include only the most useful branches in the coverage report. --- tools/code_coverage_report.bash | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/code_coverage_report.bash b/tools/code_coverage_report.bash index 42cd88e9f4..9853127b04 100755 --- a/tools/code_coverage_report.bash +++ b/tools/code_coverage_report.bash @@ -56,6 +56,7 @@ fastcov --lcov \ -d build \ --exclude test/ \ --include $INCLUDE_PACKAGES \ + --branch-coverage \ --process-gcno \ --validate-sources \ --dump-statistic \ From 46ef47b9e40e48320436d0a16b91cf94b76f8bb3 Mon Sep 17 00:00:00 2001 From: ruffsl Date: Sun, 20 Jun 2021 12:42:16 -0700 Subject: [PATCH 07/10] Fix install path --- codecov.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/codecov.yml b/codecov.yml index 202b5fdbbc..520a7b9751 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1,5 +1,6 @@ fixes: - - "src/navigation2/::" + - "**/src/navigation2/::" + - "**/install/::" ignore: - "*/**/test/*" # ignore package test directories, e.g. nav2_dwb_controller/costmap_queue/tests From d9cce81650000e09429d22a1d4ff845421cc23d2 Mon Sep 17 00:00:00 2001 From: ruffsl Date: Sun, 20 Jun 2021 13:12:59 -0700 Subject: [PATCH 08/10] Explicitly exclude packages to ignore rviz package but still explicitly include packages as the include filter is what mostly speeds up processing --- tools/code_coverage_report.bash | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/code_coverage_report.bash b/tools/code_coverage_report.bash index 9853127b04..c1479dcf3f 100755 --- a/tools/code_coverage_report.bash +++ b/tools/code_coverage_report.bash @@ -42,19 +42,25 @@ mkdir -p ${LCOVDIR} # - messages, which are auto generated files # - system tests, which are themselves all test artifacts # - rviz plugins, which are not used for real navigation -INCLUDE_PACKAGES=$( +EXCLUDE_PACKAGES=$( colcon list \ --names-only \ - --packages-ignore-regex \ + --packages-select-regex \ ".*_msgs" \ ".*_tests" \ ".*_rviz.*" \ | xargs) +INCLUDE_PACKAGES=$( + colcon list \ + --names-only \ + --packages-ignore \ + $EXCLUDE_PACKAGES \ + | xargs) # Capture executed code data. fastcov --lcov \ -d build \ - --exclude test/ \ + --exclude test/ $EXCLUDE_PACKAGES \ --include $INCLUDE_PACKAGES \ --branch-coverage \ --process-gcno \ From ca20f90889d22a1d1bc3d87b45d53e88c9a068e5 Mon Sep 17 00:00:00 2001 From: ruffsl Date: Sun, 20 Jun 2021 19:51:51 -0700 Subject: [PATCH 09/10] Revert "Branch coverage" This reverts commit 20f28949904ef965c8b5b011f3e387037adc93ce. --- tools/code_coverage_report.bash | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/code_coverage_report.bash b/tools/code_coverage_report.bash index c1479dcf3f..f4510238c6 100755 --- a/tools/code_coverage_report.bash +++ b/tools/code_coverage_report.bash @@ -62,7 +62,6 @@ fastcov --lcov \ -d build \ --exclude test/ $EXCLUDE_PACKAGES \ --include $INCLUDE_PACKAGES \ - --branch-coverage \ --process-gcno \ --validate-sources \ --dump-statistic \ From 5543fd5032fc7966e04518073774d1f7b5cf2480 Mon Sep 17 00:00:00 2001 From: Ruffin Date: Tue, 22 Jun 2021 22:16:51 -0700 Subject: [PATCH 10/10] Keep path fixes relative to workspace As the working directory used for running code coverage report script is already at the root of the colcon workspace, avoiding the use of unnecessary path globbing --- codecov.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codecov.yml b/codecov.yml index 520a7b9751..b30da12897 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1,6 +1,6 @@ fixes: - - "**/src/navigation2/::" - - "**/install/::" + - "src/navigation2/::" + - "install/::" ignore: - "*/**/test/*" # ignore package test directories, e.g. nav2_dwb_controller/costmap_queue/tests