From 9774a9ebcd39b9141eb8fd70891615131603e941 Mon Sep 17 00:00:00 2001 From: Dan Calavrezo <195309321+dcalavrezo-qorix@users.noreply.github.com> Date: Wed, 30 Sep 2026 09:31:51 +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). rules_rust is already at 0.68.2-score. Scope, config, justification file and both workflows are otherwise unchanged; the README example now names the testlogs subdirectory the workflow uses. Local comparison, //score/... (5 tests), old pipeline vs this commit, LCOV compared record by record: files in report 17 -> 17 identical status 17 of 17 raw line coverage 88.09 % -> 88.09 % raw branch coverage 93.61 % -> 93.61 % kvs_helper.cpp differs in execution counts only (timing-dependent retry loop), not in covered/uncovered status. Tracking: eclipse-score/score#3258 Signed-off-by: Dan Calavrezo <195309321+dcalavrezo-qorix@users.noreply.github.com> --- .github/workflows/coverage.yml | 2 +- .github/workflows/release.yml | 2 +- MODULE.bazel | 8 ++++++-- MODULE.bazel.lock | 2 ++ quality/coverage/BUILD | 4 ++-- quality/coverage/README.md | 16 ++++++++-------- quality/coverage/coverage.bazelrc | 15 ++++++++++----- 7 files changed, 30 insertions(+), 19 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 1e7a8fec2..6cfe7fb81 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -44,7 +44,7 @@ jobs: COVERAGE_THRESHOLD: "0" 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 -- \ --yaml quality/coverage/coverage_justifications.yaml \ --testlogs-subdir score \ --archive-dir coverage_artifact diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ace7b6850..8d034a9df 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -158,7 +158,7 @@ jobs: COVERAGE_THRESHOLD: "0" 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 -- \ --yaml quality/coverage/coverage_justifications.yaml \ --testlogs-subdir score \ --archive-dir coverage_artifact diff --git a/MODULE.bazel b/MODULE.bazel index b2f4a532c..39631dbab 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -31,6 +31,10 @@ bazel_dep(name = "score_python_basics", version = "0.3.4") bazel_dep(name = "score_test_scenarios", version = "0.4.1") bazel_dep(name = "score_tooling", version = "2.2.0") +# LLVM source-based coverage pipeline (C++ + Rust): the qualified S-CORE +# coverage tool, successor of @score_tooling//coverage. See quality/coverage/. +bazel_dep(name = "score_coverage", version = "0.3.1", dev_dependency = True) + # Development dependencies (alphabetically sorted) bazel_dep(name = "aspect_rules_lint", version = "2.7.2", dev_dependency = True) bazel_dep(name = "buildifier_prebuilt", version = "8.5.1.3", dev_dependency = True) @@ -126,7 +130,7 @@ use_repo( # ******************************************************************************* # Coverage toolchain (LLVM source-based coverage pipeline from -# @score_tooling//coverage, see quality/coverage/). Only active during +# @score_coverage, see quality/coverage/). Only active during # `bazel coverage --config=llvm_cov` runs. # # C++ needs the hermetic Clang toolchain below (covmap instrumentation). @@ -145,7 +149,7 @@ llvm = use_extension( llvm.toolchain( cxx_standard = {"": "c++17"}, extra_known_features = [ - "@score_tooling//coverage:enable_llvm_coverage_for_death_tests", + "@score_coverage//:enable_llvm_coverage_for_death_tests", ], link_libs = {"": [ "-lrt", diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index 0ef96a1c3..a3302f3d5 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -1055,6 +1055,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/quality/coverage/BUILD b/quality/coverage/BUILD index 80097527f..da63a80cd 100644 --- a/quality/coverage/BUILD +++ b/quality/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 targets whose transitive sources define the coverage scope: # the KVS implementations (C++ and Rust) and the KVS command line tool @@ -34,7 +34,7 @@ score_coverage_scope( # Passed to Bazel as --coverage_report_generator (see coverage.bazelrc). # Everything else (merger, reporter, justify, effective_coverage, -# generate_coverage_html) comes from @score_tooling//coverage. +# generate_coverage_html) comes from @score_coverage. score_coverage_reporter( name = "reporter_wrapper", testonly = True, diff --git a/quality/coverage/README.md b/quality/coverage/README.md index 255c9756e..1ce6abfb2 100644 --- a/quality/coverage/README.md +++ b/quality/coverage/README.md @@ -13,9 +13,9 @@ # Coverage (consumer layer) -Unified C++ + Rust coverage via the shared LLVM pipeline in -`@score_tooling//coverage`. This directory only holds what is specific to -this repository: +Unified C++ + Rust coverage via the qualified S-CORE coverage tool, +[`score_coverage`](https://eclipse-score.github.io/coverage_tool/main/). This +directory only holds what is specific to this repository: | File | Purpose | |---|---| @@ -28,8 +28,8 @@ this repository: ```bash bazel coverage --config=llvm_cov //score/... --build_tests_only -bazel run @score_tooling//coverage:generate_coverage_html -- \ - --yaml quality/coverage/coverage_justifications.yaml --testlogs-subdir src +bazel run @score_coverage//:generate_coverage_html -- \ + --yaml quality/coverage/coverage_justifications.yaml --testlogs-subdir score xdg-open coverage_linux/index.html ``` @@ -42,7 +42,7 @@ compares *effective* coverage (covered + justified) against `COVERAGE_THRESHOLD` (CI: report-only during introduction, see `.github/workflows/coverage.yml`). -Full documentation lives with the pipeline: -[adoption guide](https://github.com/eclipse-score/tooling/blob/main/coverage/README.md) +Full documentation lives with the tool: +[user manual](https://eclipse-score.github.io/coverage_tool/main/manual/user_manual.html) and -[mechanism deep-dive](https://github.com/eclipse-score/tooling/blob/main/coverage/COVERAGE_GUIDE.md). +[architecture](https://eclipse-score.github.io/coverage_tool/main/architecture/index.html). diff --git a/quality/coverage/coverage.bazelrc b/quality/coverage/coverage.bazelrc index 32d0576a6..49f1a2638 100644 --- a/quality/coverage/coverage.bazelrc +++ b/quality/coverage/coverage.bazelrc @@ -24,12 +24,17 @@ # Uses LLVM's source-based coverage instrumentation (--experimental_use_llvm_covmap) # with a custom merger/reporter that produce HTML reports via llvm-cov directly. # -# NOTE: --experimental_use_llvm_covmap causes Bazel to instrument ALL targets. # Source filtering is handled at report time by the reporter using the coverage -# allowlist generated by the score_coverage_scope target. -# See @score_tooling//coverage (COVERAGE_GUIDE.md) for details. +# allowlist generated by the score_coverage_scope target. Pipeline: +# @score_coverage (the qualified S-CORE coverage tool), guide: +# https://eclipse-score.github.io/coverage_tool/main/manual/user_manual.html 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 @@ -50,11 +55,11 @@ coverage:llvm_cov --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux # rust_toolchain declares llvm_cov. # Use llvm-cov directly for HTML report generation instead of genhtml/lcov. -# The merger (per-test: profraw -> profdata + metadata) lives in score_tooling; +# The merger (per-test: profraw -> profdata + metadata) lives in score_coverage; # the reporter_wrapper (final combined report) is instantiated in # //quality/coverage:BUILD because it carries this repo's coverage scope and # LLVM tool labels. -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=//quality/coverage:reporter_wrapper # Override GENERATE_LLVM_LCOV to keep raw profraw files instead of converting to LCOV.