Skip to content

Evaluate the coverage scope for the run's platform - #24

Merged
dcalavrezo-qorix merged 6 commits into
mainfrom
dcalavrezo_scope_platform
Oct 7, 2026
Merged

dcalavrezo-qorix merged 6 commits into
mainfrom
dcalavrezo_scope_platform

Conversation

@dcalavrezo-qorix

@dcalavrezo-qorix dcalavrezo-qorix commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Closes #23.

Why

baselibs' first QNX report (eclipse-score/baselibs#626, found by @4og) listed score/os/linux/* at 0 % and contained no file from score/os/qnx/. Bazel analyses --coverage_report_generator in the exec configuration (BaseRuleClasses.coverageReportGeneratorAttribute with ExecutionTransitionFactory), and the scope is a dependency of it. So every select() on the platform resolved for the Linux host whatever --platforms the coverage run used, and the allowlist of the QNX run was identical to the Linux run's (978 files).

What

score_coverage_scope gains an optional platform label. The transition that already set --collect_code_coverage now also sets --platforms to that label and is applied to the scope rule itself (incoming edge), not only to deps: a select() in an attribute is resolved in the configuration of the rule that owns it, so a per-platform root list in the scope's deps must be resolved for the platform too. The aspect traversal, the baseline objects, the gcno notes and the scope's own select()s are therefore those of the target platform, while the report generator keeps running on the host. Platform scopes carry tags = ["manual"], like the gcov reporter. Without platform nothing changes. Consumers declare one scope per platform (coverage_scope_qnx) and point the gcov reporter at it; platform-only roots go behind a select(), since an incompatible root fails the analysis.

Verification

Check Result
Analysis tests: select() on a fixture-only constraint resolves to the target variant with platform, to the host variant without 2 new tests, 16 pass
Integration workspace: //src:platform_dep selected on //platforms:gcov_target (child of the GCC platform with a fixture-only constraint); coverage:gcov targets it, host platform unchanged LLVM golden gains platform_host.cpp, gcov golden platform_target.cpp, hand-derived; two checks assert the other variant is absent; 27 checks pass
bazel test //score_coverage/tests/... //tools:all 24 targets pass
lint, format check, //docs:docs_check clean

Docs

Manual step 3 (the scope is evaluated for a platform, one scope per platform) and step 4b (the gcov reporter uses coverage_scope_qnx); architecture; requirement tool_req__coverage_scope_platform; potential error ERR-14; known-problems row for scopes declared without platform; release notes 0.4.0, and 0.3.1 dated; verification report counts.

Validated on baselibs

Pinned to this branch in eclipse-score/baselibs#626 with a QNX scope (platform = x86_64-qnx-sdp_8.0.0-posix, Linux-only and QNX-only roots behind a select()). Three findings went back into this PR: the scope must be tagged manual (wildcard Linux builds otherwise analyse it for QNX without the toolchains); a root incompatible with the platform does not fail the run but makes Bazel skip every test, documented with the diagnostic; and the select() in the scope's deps was resolved for the host until the transition moved to the rule. With a stand-in toolchain the QNX allowlist now has 976 files, 86 under score/os/qnx, none under score/os/linux, and the tests are compatible.

Follow-up after release

baselibs #626 and communication #1171: add coverage_scope_qnx with the QNX platform, point the gcov reporters at it, and move baselibs' explicit Linux-only roots (//score/os/linux, //score/os/linux/utils:network_interface) behind a select().

baselibs' QNX report listed score/os/linux at 0 % and no score/os/qnx
file at all (coverage_tool#23). Bazel analyses --coverage_report_generator
in the exec configuration, and the scope is a dependency of it, so every
select() on the platform resolved for the Linux host whatever --platforms
the coverage run used; the allowlist was identical for the Linux and the
QNX run.

score_coverage_scope gains `platform`: the transition on `deps` sets
--platforms to it next to --collect_code_coverage, so the traversal, the
baseline objects and the gcno notes are those of the target platform.
Without `platform` nothing changes. Consumers declare one scope per
platform and put platform-only roots behind a select().

- Analysis tests: a library selected on a fixture-only constraint is
  listed as the target variant with `platform` and as the host variant
  without.
- Integration workspace: //src:platform_dep selected on
  //platforms:gcov_target, a child of the GCC platform; coverage:gcov
  targets it while the host platform stays the plain GCC platform. The
  LLVM golden gets platform_host.cpp, the gcov golden platform_target.cpp;
  two checks assert the other variant is absent.
- Docs: manual steps 3 and 4b, architecture, requirement
  tool_req__coverage_scope_platform, ERR-14, known problem, release notes
  0.4.0 (0.3.1 dated), verification report (16 analysis tests, 27 checks).

Closes #23

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

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

License Check Results

🚀 The license check job ran with the Bazel command:

bazel run //:license-check

Status: ⚠️ Needs Review

Click to expand output
[License Check Output]
Extracting Bazel installation...
Starting local Bazel server (8.6.0) and connecting to it...
INFO: Invocation ID: 9d2a4421-3879-4289-b556-7cbef121def0
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Loading: 
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
Analyzing: target //:license-check (1 packages loaded, 0 targets configured)
Analyzing: target //:license-check (1 packages loaded, 0 targets configured)

Analyzing: target //:license-check (5 packages loaded, 6 targets configured)

Analyzing: target //:license-check (5 packages loaded, 6 targets configured)

Analyzing: target //:license-check (5 packages loaded, 6 targets configured)

Analyzing: target //:license-check (5 packages loaded, 6 targets configured)

Analyzing: target //:license-check (5 packages loaded, 6 targets configured)

Analyzing: target //:license-check (5 packages loaded, 6 targets configured)

Analyzing: target //:license-check (5 packages loaded, 6 targets configured)

Analyzing: target //:license-check (5 packages loaded, 6 targets configured)

Analyzing: target //:license-check (5 packages loaded, 6 targets configured)

Analyzing: target //:license-check (30 packages loaded, 10 targets configured)

Analyzing: target //:license-check (85 packages loaded, 10 targets configured)

Analyzing: target //:license-check (139 packages loaded, 347 targets configured)

Analyzing: target //:license-check (151 packages loaded, 3291 targets configured)

Analyzing: target //:license-check (151 packages loaded, 3291 targets configured)

Analyzing: target //:license-check (151 packages loaded, 3291 targets configured)

Analyzing: target //:license-check (161 packages loaded, 5152 targets configured)

Analyzing: target //:license-check (163 packages loaded, 9808 targets configured)

Analyzing: target //:license-check (168 packages loaded, 9834 targets configured)

Analyzing: target //:license-check (168 packages loaded, 9834 targets configured)

Analyzing: target //:license-check (174 packages loaded, 9974 targets configured)

Analyzing: target //:license-check (177 packages loaded, 11874 targets configured)

Analyzing: target //:license-check (178 packages loaded, 11994 targets configured)

INFO: Analyzed target //:license-check (179 packages loaded, 12118 targets configured).
[12 / 16] JavaToolchainCompileClasses external/rules_java+/toolchains/platformclasspath_classes; 0s disk-cache, processwrapper-sandbox ... (2 actions running)
[14 / 16] JavaToolchainCompileBootClasspath external/rules_java+/toolchains/platformclasspath.jar; 0s disk-cache, processwrapper-sandbox
[15 / 16] Building tools/license.check.license_check.jar (); 0s disk-cache, multiplex-worker
INFO: Found 1 target...
Target //tools:license.check.license_check up-to-date:
  bazel-bin/tools/license.check.license_check
  bazel-bin/tools/license.check.license_check.jar
INFO: Elapsed time: 38.718s, Critical Path: 2.62s
INFO: 16 processes: 12 internal, 3 processwrapper-sandbox, 1 worker.
INFO: Build completed successfully, 16 total actions
INFO: Running command line: bazel-bin/tools/license.check.license_check tools/formatted.txt <args omitted>
usage: org.eclipse.dash.licenses.cli.Main [-batch <int>] [-cd <url>]
       [-confidence <int>] [-ef <url>] [-excludeSources <sources>] [-help] [-lic
       <url>] [-project <shortname>] [-repo <url>] [-review] [-summary <file>]
       [-timeout <seconds>] [-token <token>]

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

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

Signed-off-by: Dan Calavrezo <195309321+dcalavrezo-qorix@users.noreply.github.com>
@dcalavrezo-qorix
dcalavrezo-qorix force-pushed the dcalavrezo_scope_platform branch from 0edecc7 to e9be6fe Compare October 6, 2026 12:10
A wildcard build on the host analyses a platform scope for the other
platform without that platform's toolchains registered and fails
toolchain resolution (seen on baselibs' Linux jobs). Document the tag
next to the attribute and apply it in the integration workspace.

Signed-off-by: Dan Calavrezo <195309321+dcalavrezo-qorix@users.noreply.github.com>
Seen on baselibs: a Rust root incompatible with QNX made the scope, the
report generator and every test incompatible; bazel coverage executed no
test and wrote no report. Manual, known problems and ERR-14 describe the
symptom, the diagnostic build of the scope and the remedy.

Signed-off-by: Dan Calavrezo <195309321+dcalavrezo-qorix@users.noreply.github.com>
Signed-off-by: Dan Calavrezo <195309321+dcalavrezo-qorix@users.noreply.github.com>
A select() in an attribute is resolved in the configuration of the rule
that owns the attribute. With the transition on `deps` only, a
per-platform root list in the scope's deps resolved for the host while
the roots were built for the target platform: on baselibs the QNX scope
received the Linux-only roots, became incompatible, and with it the
report generator and every test (bazel coverage skipped all 284).

The transition now sits on the rule (incoming edge), so the rule, its
select()s and its dependencies all live in the target platform's
configuration.

- Analysis test: a per-platform root select in the scope's deps with the
  host root incompatible with the fixture platform; the allowlist holds
  the target root and the scope is compatible.
- Integration workspace: the same pattern with //src:host_root
  (incompatible on //platforms:gcov_target) and //src:target_root in the
  scope's deps; both goldens gain the untested root at 0 %; checks assert
  the other root is absent.
- Manual and release notes: the select() in deps is resolved for the
  platform too.

Verified on baselibs with a stand-in toolchain for the QNX platform: the
QNX allowlist now has 976 files, 86 under score/os/qnx, none under
score/os/linux, no Rust; acl_test is compatible under the coverage flags.

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

Copy link
Copy Markdown
Contributor Author

Validated end to end on eclipse-score/baselibs#626 (QNX on target, run 37473583990): with a QNX scope the report contains 56 score/os/qnx files (0 before) and no score/os/linux file (16 at 0 % before); 278 tests executed; 89.3 % lines over 684 files. The validation surfaced three things that are part of this PR now: the platform scope must be tagged manual; an incompatible root makes Bazel skip every test silently (documented with the diagnostic, including a stand-in toolchain for Linux hosts); and a select() in the scope's deps is resolved in the rule's own configuration, so the transition moved from deps to the rule. Ready for review.

@dcalavrezo-qorix
dcalavrezo-qorix force-pushed the dcalavrezo_scope_platform branch from 5d74f70 to afefbed Compare October 6, 2026 14:33
Comment on lines +69 to +71
"Coverage by directory" "Files at exact 0% (3)" \
"| In-scope files without coverage data | 2 |" \
"In-scope files without coverage data (2)" '- `src/unused_api.h`' '- `src/platform_dep.h`' \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can this be explained? Why suddenly a change in the number?

@dcalavrezo-qorix
dcalavrezo-qorix merged commit 25a3d68 into main Oct 7, 2026
15 checks passed
@dcalavrezo-qorix
dcalavrezo-qorix deleted the dcalavrezo_scope_platform branch October 7, 2026 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scope is evaluated in the exec configuration: platform select()s resolve for the host, not the target

2 participants