From cffabad7e0fcc1ad6168baa02414bbecacecc560 Mon Sep 17 00:00:00 2001 From: Dan Calavrezo <195309321+dcalavrezo-qorix@users.noreply.github.com> Date: Wed, 30 Sep 2026 11:29:52 +0300 Subject: [PATCH] Migrate coverage pipeline to score_coverage 0.3.1 The LLVM coverage pipeline under @score_tooling//coverage moved to its own qualified module, score_coverage (eclipse-score/coverage_tool, TCL LOW). Switch the labels one-to-one, add the module as a dev dependency and set --instrumentation_filter=^//score[/:] as the 0.3.1 manual requires (Bazel's guessed filter covers only the packages of the test targets). Scope, config, justification file, workflow and the gate at 85 are otherwise unchanged. The scope comment no longer calls the cc_binary entry-point sources a gap: the module collects them and lists them as no-data in unmapped_files.txt. Local comparison, //score/... (51 tests), old pipeline vs this commit, LCOV compared record by record: files in report 86 -> 86 identical status 84 of 86 raw line coverage 87.25 % -> 87.18 % effective line cov. 89.34 % -> 89.26 % (58 justified lines, same justifications applied, same stale entry) raw branch coverage 81.43 % -> 81.43 % The two status differences are environment effects, not the pipeline: pdelay_measurer.cpp flips between two runs of the new module as well (timestamp-dependent checks), and shared_memory_handler.h lines 110-111 are the construct callback that runs only when the shared memory segment is created rather than reopened. Tracking: eclipse-score/score#3258 Signed-off-by: Dan Calavrezo <195309321+dcalavrezo-qorix@users.noreply.github.com> --- .bazelrc | 2 +- .github/workflows/code-coverage.yml | 4 ++-- MODULE.bazel | 8 ++++++-- MODULE.bazel.lock | 2 ++ tools/coverage/BUILD | 9 ++++----- tools/coverage/coverage.bazelrc | 10 ++++++++-- 6 files changed, 23 insertions(+), 12 deletions(-) diff --git a/.bazelrc b/.bazelrc index 782efb3d..230dc427 100644 --- a/.bazelrc +++ b/.bazelrc @@ -77,7 +77,7 @@ build:arm64-qnx --extra_toolchains=@score_qcc_aarch64_toolchain//:aarch64-qnx-sd # Import local user workspace file, if exists # ------------------------------------------------------------------------------- # Unified LLVM source-based coverage (C++), see tools/coverage/ and -# @score_tooling//coverage. Use: bazel coverage --config=llvm_cov //score/... --build_tests_only +# @score_coverage. Use: bazel coverage --config=llvm_cov //score/... --build_tests_only import %workspace%/tools/coverage/coverage.bazelrc # Local user overrides — kept LAST so they can override everything above. diff --git a/.github/workflows/code-coverage.yml b/.github/workflows/code-coverage.yml index 39836590..4f389aff 100644 --- a/.github/workflows/code-coverage.yml +++ b/.github/workflows/code-coverage.yml @@ -40,7 +40,7 @@ jobs: with: unique-cache-name: ${{ github.workflow }}-${{ github.job }} - - name: Run coverage (LLVM source-based, @score_tooling//coverage) + - name: Run coverage (LLVM source-based, @score_coverage) run: | set -euo pipefail bazel coverage --lockfile_mode=error --config=llvm_cov \ @@ -51,7 +51,7 @@ jobs: COVERAGE_THRESHOLD: "85" run: | set -euo pipefail - bazel run --lockfile_mode=error @score_tooling//coverage:generate_coverage_html -- \ + bazel run --lockfile_mode=error @score_coverage//:generate_coverage_html -- \ --testlogs-subdir score \ --archive-dir coverage_artifact \ --yaml tools/coverage/coverage_justifications.yaml diff --git a/MODULE.bazel b/MODULE.bazel index b42d69f4..c689d479 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -82,6 +82,10 @@ bazel_dep(name = "score_platform", version = "0.7.1", dev_dependency = True) bazel_dep(name = "score_process_description", version = "2.1.2", dev_dependency = True) bazel_dep(name = "score_tooling", version = "2.2.1", dev_dependency = True) +# LLVM source-based coverage pipeline (C++): the qualified S-CORE coverage +# tool, successor of @score_tooling//coverage. See tools/coverage/. +bazel_dep(name = "score_coverage", version = "0.3.1", dev_dependency = True) + # lobster is a non-dev bazel_dep of score_tooling; its own git_override is ignored # by Bazel for non-root modules, so the root module must declare it too. bazel_dep(name = "lobster", version = "0.0.0", dev_dependency = True) @@ -114,13 +118,13 @@ llvm.toolchain( ) # Coverage-only Clang instance (covmap instrumentation for the LLVM coverage -# pipeline from @score_tooling//coverage; active only under --config=llvm_cov). +# pipeline from @score_coverage; active only under --config=llvm_cov). # Separate from the 19.1.7 instance above so clang-tidy behavior is untouched. llvm.toolchain( name = "llvm_toolchain_coverage", cxx_standard = {"": "c++17"}, extra_known_features = [ - "@score_tooling//coverage:enable_llvm_coverage_for_death_tests", + "@score_coverage//:enable_llvm_coverage_for_death_tests", ], llvm_version = "22.1.7", stdlib = {"": "stdc++"}, diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index c0d45fdc..3a0d0bc4 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -1031,6 +1031,8 @@ "https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/modules/score_bazel_platforms/1.1.0/source.json": "9797d56e9dd68e9d3e8b674402df2d6d5e2174f84184ca4cbee78fc07dc117d9", "https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/modules/score_communication/0.4.0/MODULE.bazel": "19e98105c4b1ca674027dfa4c5010eebbdf74d7cbd9524cb84a8fad63a8bcebe", "https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/modules/score_communication/0.4.0/source.json": "a3378155debe445305828cfa94464ad5f53d5b7e27488b3c053b02e49801aaeb", + "https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/modules/score_coverage/0.3.1/MODULE.bazel": "e11bb5c649f1c42b2e6933d0c297cb44c45d806d61d9fa71b1185830d284edac", + "https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/modules/score_coverage/0.3.1/source.json": "328c3bb04ec50bb2cbd81070af41ac7247022cb006724340e251c73159e369b4", "https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/modules/score_cr_checker/0.2.2/MODULE.bazel": "dc36d9c35543db918c3fb5b93a8e684431f56c7c784cf2a1b90f35802a373c98", "https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/modules/score_cr_checker/0.3.1/MODULE.bazel": "f49e037d7fbc0b2a8b2734fc6b47334e8cc8589ca7a5aa0f3ccca85cc5f79fac", "https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/modules/score_crates/0.0.10/MODULE.bazel": "80599c71cfc5827a189ab40fe2f320c8f52e0fca5bcc7c8bf8bfbdead7f97a74", diff --git a/tools/coverage/BUILD b/tools/coverage/BUILD index b4ba9a61..40e0fbbb 100644 --- a/tools/coverage/BUILD +++ b/tools/coverage/BUILD @@ -11,7 +11,7 @@ # SPDX-License-Identifier: Apache-2.0 # ******************************************************************************* -load("@score_tooling//coverage:defs.bzl", "score_coverage_reporter", "score_coverage_scope") +load("@score_coverage//:defs.bzl", "score_coverage_reporter", "score_coverage_scope") # The production components of this module (the public faces the old # cpp-coverage workflow also targeted via //score/...). The scope aspect walks @@ -31,10 +31,9 @@ score_coverage_scope( "//score/time/vehicle_time", # The daemons transitively bring in clock_core, high_res_steady_clock # and ts_client's gptp_ipc (verified via bazel query deps()). - # KNOWN GAP: the cc_binary entry-point sources themselves (main.cpp, - # time_daemon.cpp, time_slave.cpp) are not collected — cc_binary - # provides no CcInfo for the scope aspect. Entry-point wiring is not - # unit-testable; tracked as a scope-aspect enhancement in score_tooling. + # The cc_binary entry-point sources (main.cpp, time_daemon.cpp, + # time_slave.cpp) are collected too and appear in unmapped_files.txt + # as no-data: entry-point wiring is not unit-testable. "//score/time_daemon", "//score/time_slave", ], diff --git a/tools/coverage/coverage.bazelrc b/tools/coverage/coverage.bazelrc index e9623110..7aefd25f 100644 --- a/tools/coverage/coverage.bazelrc +++ b/tools/coverage/coverage.bazelrc @@ -13,7 +13,8 @@ # ============================================================================ # LLVM source-based coverage (Linux, Clang covmap) — C++ -# Pipeline: @score_tooling//coverage (see its README.md for the guide). +# Pipeline: @score_coverage (the qualified S-CORE coverage tool), guide: +# https://eclipse-score.github.io/coverage_tool/main/manual/user_manual.html # Use with: bazel coverage --config=llvm_cov //score/... --build_tests_only # # Do NOT combine with configs that register other C++ toolchains: the last @@ -21,6 +22,11 @@ # ============================================================================ coverage:llvm_cov --nocache_test_results +# Instrument everything under //score. Left unset, Bazel guesses the filter +# from the packages of the test targets (stripping only a trailing "/tests"); +# a library tested from a "test" subpackage is then compiled without counters +# unless one of its deps happens to be instrumented (score_coverage 0.3.1). +coverage:llvm_cov --instrumentation_filter=^//score[/:] coverage:llvm_cov --cxxopt=-O0 coverage:llvm_cov --combined_report=lcov coverage:llvm_cov --experimental_fetch_all_coverage_outputs @@ -35,7 +41,7 @@ coverage:llvm_cov --experimental_generate_llvm_lcov coverage:llvm_cov --experimental_use_llvm_covmap coverage:llvm_cov --extra_toolchains=@llvm_toolchain_coverage//:cc-toolchain-x86_64-linux -coverage:llvm_cov --coverage_output_generator=@score_tooling//coverage:merger +coverage:llvm_cov --coverage_output_generator=@score_coverage//:merger coverage:llvm_cov --coverage_report_generator=//tools/coverage:reporter_wrapper # Keep raw profraw files; the merger handles profraw -> profdata directly.