Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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).
Expand All @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions quality/coverage/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down
16 changes: 8 additions & 8 deletions quality/coverage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
|---|---|
Expand All @@ -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
```
Expand All @@ -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).
15 changes: 10 additions & 5 deletions quality/coverage/coverage.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
Loading