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 .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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
Expand Down
8 changes: 6 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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++"},
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.

9 changes: 4 additions & 5 deletions tools/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 components of this module (the public faces the old
# cpp-coverage workflow also targeted via //score/...). The scope aspect walks
Expand All @@ -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",
],
Expand Down
10 changes: 8 additions & 2 deletions tools/coverage/coverage.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,20 @@

# ============================================================================
# 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
# --extra_toolchains wins resolution and a GCC toolchain produces no covmap.
# ============================================================================

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 @@ -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.
Expand Down
Loading