Skip to content

coverage: QNX on-target coverage through the score_coverage gcov backend - #626

Open
dcalavrezo-qorix wants to merge 10 commits into
mainfrom
dcalavrezo_qnx_coverage
Open

dcalavrezo-qorix wants to merge 10 commits into
mainfrom
dcalavrezo_qnx_coverage

Conversation

@dcalavrezo-qorix

@dcalavrezo-qorix dcalavrezo-qorix commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Uses the score_coverage 0.3.1 registry release (release notes), which adds the gcov backend for QNX on-target coverage.

What

QNX on-target coverage for the C++ tests, through the gcov backend of score_coverage:

  • tests run in QEMU via score_qnx_unit_tests (run_under_qnx), which brings the .gcda counters back;
  • Bazel's own per-test collector turns them into LCOV;
  • score_coverage's gcov reporter applies the coverage scope, adds 0 % baselines from the .gcno notes, and produces the same report archive as the Linux run (HTML via gcovr, LCOV, unmapped_files.txt, justifications, gate).

Changes:

  • MODULE.bazel: score_coverage 0.2.0 → 0.3.1;
  • tools/coverage/BUILD: gcov_reporter_wrapper (backend = "gcov", QCC's gcov), tagged manual so bazel build //... on a Linux host does not fetch the QNX SDP;
  • tools/coverage/coverage.bazelrc: coverage:qnx_cov config (QNX build config, run_under_qnx, Bazel's lcov_merger, gcov reporter, --instrument_test_targets, C++ only);
  • .github/workflows/coverage_report.yml: job qnx-coverage-report (QNX SDP + QEMU/KVM setup, bazel coverage --config=qnx_cov, generate_coverage_html --platform qnx), artifact baselibs_cpp_coverage_report_qnx. Same-repository branches only, the QNX secrets are not available to forks.

The Linux job is unchanged.

Validation

The QNX job produced a complete report on this branch: 615 files in the index, every link resolves, 81.6 % raw line coverage. unmapped_files.txt lists 50 Rust sources as not-instrumented (rustc emits no gcov counters; they are measured by the Linux run), 128 files as no-data (mostly headers vendored from external repositories, which Bazel's collector drops on this backend), 107 declaration-only headers and 78 compiled-without-code units, as on Linux.

Per file, the QNX numbers differ from the Linux report of the same tree by design: gcov counts fewer lines (no unused inline functions, no closing braces), so totals differ while no file is missing. The two reports are compared per file, not merged.

Tracking: eclipse-score/tooling#427 (track 1).

Update: bumped to 0.3.1, which requires the explicit --instrumentation_filter=^//score[/:] this branch sets. Bazel guesses the filter from the packages of the test targets; libraries tested from a test subpackage were otherwise compiled without counters or, on QNX, lost their counters (score/os showed 13 % instead of 80 % in the first QNX report). See the 0.3.1 release notes.

@github-actions github-actions Bot added bazel Bazel and Starlark build files ci CI related changes labels Sep 28, 2026
QCC is GCC-based, so QNX coverage uses gcov counters: the tests run in
QEMU through score_qnx_unit_tests (run_under_qnx), which brings the
.gcda files back; Bazel's own per-test collector turns them into LCOV;
score_coverage's gcov reporter (eclipse-score/coverage_tool PR #10)
produces the same report as the Linux run.

- tools/coverage/BUILD: gcov_reporter_wrapper with backend = "gcov"
  and the QCC package's gcov.
- coverage.bazelrc: coverage:qnx_cov on top of bl-x86_64-qnx (run_under,
  C++ tests only, Bazel's lcov_merger, the gcov reporter,
  --instrument_test_targets).
- coverage_report_qnx.yml: the QNX build workflow's setup steps (SDP,
  credential helper, QEMU, KVM) followed by bazel coverage and
  generate_coverage_html --platform qnx; the artifact is uploaded as
  baselibs_cpp_coverage_report_qnx.

VALIDATION ONLY: MODULE.bazel carries a git_override to the
coverage_tool branch; it is replaced by the 0.3.0 registry release once
that is published. Rust sources are listed as not-instrumented in the
QNX report and measured by the Linux run.

Signed-off-by: Dan Calavrezo <195309321+dcalavrezo-qorix@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

Documentation preview for this pull request is available at:
pr-626: https://eclipse-score.github.io/baselibs/pr-626/

A wildcard build on a Linux host without QNX credentials must not fetch
the QNX SDP package the reporter depends on; --coverage_report_generator
names the target explicitly.

Signed-off-by: Dan Calavrezo <195309321+dcalavrezo-qorix@users.noreply.github.com>
@dcalavrezo-qorix

Copy link
Copy Markdown
Contributor Author

First real QNX run, job https://github.com/eclipse-score/baselibs/actions/runs/36388596870/job/108819220167 (bl-x86_64-qnx, 278 tests in QEMU): artifact baselibs_cpp_coverage_report_qnx has 615 files, 616 index links all opening, raw line coverage 81.59 % (gcov semantics; the Linux/LLVM report of the same tree is 87.76 %). unmapped_files.txt: 50 Rust sources not-instrumented, 128 no-data (the vendored flatbuffers headers among them, as documented for this backend), 107 declaration-only, 78 compiled-without-code. Baseline from 668 gcno files covers 160 files no test executed.

The gcov backend for QNX on-target coverage is released. Pin the
release commit until the registry entry (bazel_registry PR #519) is
merged, then drop the override.

Signed-off-by: Dan Calavrezo <195309321+dcalavrezo-qorix@users.noreply.github.com>
Signed-off-by: Dan Calavrezo <195309321+dcalavrezo-qorix@users.noreply.github.com>
The release is in the S-CORE Bazel registry; drop the temporary
git_override that pinned the release commit.

Signed-off-by: Dan Calavrezo <195309321+dcalavrezo-qorix@users.noreply.github.com>
Bazel derives the default --instrumentation_filter from the packages of
the test targets and strips only a trailing /tests to reach the code
under test. Our tests live in test/ subpackages, so libraries such as
//score/os were outside the guessed filter; the gcov collector then
dropped their counters and the QNX report showed them at 0 % (13 % for
score/os against 80 % on Linux). Instrument everything under //score.

Signed-off-by: Dan Calavrezo <195309321+dcalavrezo-qorix@users.noreply.github.com>
0.3.1 requires the explicit --instrumentation_filter this branch already
sets, and warns when a report shows the pattern of a library tested from
a test/ subpackage without data.

Signed-off-by: Dan Calavrezo <195309321+dcalavrezo-qorix@users.noreply.github.com>
@dcalavrezo-qorix dcalavrezo-qorix changed the title coverage: QNX on-target coverage through the score_coverage gcov backend coverage: QNX on-target coverage through the score_coverage gcov backend Sep 29, 2026
@dcalavrezo-qorix

Copy link
Copy Markdown
Contributor Author

@4og @fbaeuerle could you review this one, please? It moves the coverage pipeline to the qualified score_coverage 0.3.1 (rollout tracked in eclipse-score/score#3258). The before/after comparison of the coverage data is in the description and CI is green. This one also adds QNX on-target coverage; the QNX job's report (649 files, 92 % lines) is linked in the description. Thanks!

# in QEMU through score_qnx_unit_tests, which brings the .gcda counters
# back. Same-repository branches only: the QNX secrets are not exposed to
# forks on pull_request events.
qnx-coverage-report:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generated HTML report completely misses qnx-only targets from this folder https://github.com/eclipse-score/baselibs/tree/main/score/os/qnx
Instead it includes files from score/os/linux which have zero coverage.

I'd expect that both linux and qnx coverage tools produce data only for the code that can be compiled on those platform.

# back. Same-repository branches only: the QNX secrets are not exposed to
# forks on pull_request events.
qnx-coverage-report:
name: Coverage bl-x86_64-qnx (gcov, on target)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bl-x86_64-qnx got recently renamed to score-qnx-x86_64

if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-24.04
steps:
- uses: eclipse-score/more-disk-space@3fac5780033e636b114cf69e891dc19d640855c2 # v1.1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The part below looks identical to https://github.com/eclipse-score/cicd-workflows/blob/main/.github/workflows/qnx-build.yml Can it be somehow reused?

Additionally, this job will be failing in forks due to pull_request trigger

# into LCOV; score_coverage's gcov reporter produces the report. Rust sources
# are listed as not-instrumented here and measured by the Linux run.
# ---------------------------------------------------------------------------
coverage:qnx_cov --config=bl-x86_64-qnx

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
coverage:qnx_cov --config=bl-x86_64-qnx
coverage:qnx_cov --config=score-qnx-x86_64

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bazel Bazel and Starlark build files ci CI related changes

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants