Skip to content

[projmgr] Global Generator: update context selection, defer partial processing failures#2504

Merged
brondani merged 3 commits into
mainfrom
projmgr-generator-improvements
Jun 26, 2026
Merged

[projmgr] Global Generator: update context selection, defer partial processing failures#2504
brondani merged 3 commits into
mainfrom
projmgr-generator-improvements

Conversation

@brondani

@brondani brondani commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Fixes

Implement deferred-failure semantics in context processing and update ProcessGlobalGenerators to conditionally skip context re-derivation based on active target type.

Rationale

Deferred-Failure Pattern: The codebase now implements a robust error-accumulation pattern where multiple context processing failures are collected before reporting, rather than failing fast on the first error. This enables better error visibility and user experience.

Active target-set selection: The --active flag allows users to explicitly select contexts. When used, ProcessGlobalGenerators takes the target-set context selection rather than re-deriving contexts from build/target type matching, improving predictability.

Changes

  • Deferred-Failure Pattern for Partial Processing

    • LoadPacks(): Changed failure handling to defer reporting. When context/pack loading fails, the function now continues processing instead of returning immediately. This allows all contexts to be processed before the function returns false.
    • ListGenerators(): Implemented deferred-failure semantics. When ProcessContext() fails for a context, the function collects all errors by processing all selected contexts before reporting failure.
  • Context Selection in ProcessGlobalGenerators

    • Added conditional re-derivation: ProcessGlobalGenerators now only re-derives contexts when m_activeTargetType is empty. When m_activeTargetType is non-empty (set via --active flag), it uses pre-populated m_selectedContexts as-is.
    • Deferred-failure in layer parsing: Layers are parsed for all selected contexts, with failures deferred until all contexts are processed.
    • Deferred-failure in context processing: All selected contexts are processed with deferred failure reporting.
  • Bug Fix

    • CollectUnusedPacks(): Fixed incorrect iteration over filtered packages. Now correctly retrieves full pack identifier.
  • Pack Path Validation

    • LoadAllRelevantPacks(): Changed logic to track noPackRequirements (all contexts have no pack requirements) instead of just checking if pdscFiles is empty. This ensures proper handling of pack loading policies.
  • New tests

    • ListGenerators_DeferredFailure: Validates deferred-failure semantics
    • ListGenerators_AllContextsIterated: Validates that all contexts are processed before failure is reported
    • ProcessGlobalGenerators_ActiveTargetType: Tests context selection with --active flag
  • Test data updates

    • Added device-specific linker script and region files for RteTestGen_ARMCM0
    • Updated PackMissing reference files to reflect accurate component, API, and license information

Checklist

  • 🤖 This change is covered by unit tests (if applicable).
  • 🤹 Manual testing has been performed (if necessary).
  • 🛡️ Security impacts have been considered (if relevant).
  • 📖 Documentation updates are complete (if required).
  • 🧠 Third-party dependencies and TPIP updated (if required).

@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown

Test Results

    3 files   -    55     21 suites   - 155   17m 50s ⏱️ - 6m 0s
  472 tests  -   448    472 ✅  -   431  0 💤  - 17  0 ❌ ±0 
1 416 runs   - 1 481  1 416 ✅  - 1 413  0 💤  - 68  0 ❌ ±0 

Results for commit e27a5fa. ± Comparison against base commit 2054682.

This pull request removes 451 and adds 3 tests. Note that renamed tests count towards both.
AuxCmdTests ‑ MkdirCmdTest
AuxCmdTests ‑ RmdirCmdTest
AuxCmdTests ‑ TouchCmdTest
BuildSystemGeneratorTests ‑ GenAuditFile
BuildSystemGeneratorTests ‑ GenAuditFile_WithOut_Existing_Audit_File
BuildSystemGeneratorTests ‑ GenAuditFile_With_Existing_Audit_File
BuildSystemGeneratorTests ‑ GetString
BuildSystemGeneratorTests ‑ StrConv
BuildSystemGeneratorTests ‑ StrNorm
CBuildGCCTests ‑ Asm
…
ProjMgrUnitTests ‑ ListGenerators_AllContextsIterated
ProjMgrUnitTests ‑ ListGenerators_DeferredFailure
ProjMgrUnitTests ‑ ProcessGlobalGenerators_ActiveTargetType

♻️ This comment has been updated with latest results.

Copilot AI left a comment

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.

Pull request overview

This PR updates projmgr’s global generator and context processing flow to support deferred-failure semantics (process all selected contexts, then fail) and to honor --active context selection by avoiding unnecessary context re-derivation.

Changes:

  • Implement deferred-failure behavior in pack/context processing paths (LoadPacks, ListGenerators, ProcessGlobalGenerators).
  • Update pack loading policy checks to use “no pack requirements across contexts” rather than relying on an empty PDSC list.
  • Fix unused-pack collection to use the correct full pack identifier, and extend tests + reference outputs accordingly.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tools/projmgr/src/ProjMgrWorker.cpp Implements deferred-failure behavior, adjusts context selection rules for global generators, and fixes unused-pack ID collection.
tools/projmgr/test/src/ProjMgrUnitTests.cpp Adds unit tests validating deferred-failure semantics and --active behavior for global generators.
tools/projmgr/test/data/TestSolution/PackMissing/ref/project+Gen.cbuild.yml Updates reference cbuild output with device/pack/component/license details.
tools/projmgr/test/data/TestSolution/PackMissing/ref/project+CM0.cbuild.yml Updates reference cbuild output with device/pack/component/license details.
tools/projmgr/test/data/TestSolution/PackMissing/ref/missing_pack.cbuild-idx.yml Updates reference idx output (error message expectations).
tools/projmgr/test/data/TestGenerator/RTE/Device/RteTestGen_ARMCM0/regions_RteTestGen_ARMCM0.h Adds device-specific regions header test data.
tools/projmgr/test/data/TestGenerator/RTE/Device/RteTestGen_ARMCM0/ac6_linker_script.sct.src Adds device-specific linker script template test data.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tools/projmgr/src/ProjMgrWorker.cpp Outdated
@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.27%. Comparing base (2054682) to head (e27a5fa).

Files with missing lines Patch % Lines
tools/projmgr/src/ProjMgrWorker.cpp 90.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2504      +/-   ##
==========================================
+ Coverage   65.24%   65.27%   +0.03%     
==========================================
  Files         147      147              
  Lines       26677    26687      +10     
  Branches    16166    16169       +3     
==========================================
+ Hits        17406    17421      +15     
+ Misses       7071     7070       -1     
+ Partials     2200     2196       -4     
Flag Coverage Δ
projmgr-cov 87.99% <90.00%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
tools/projmgr/src/ProjMgrWorker.cpp 87.50% <90.00%> (+0.10%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@edriouk edriouk left a comment

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.

LGTM

@brondani brondani merged commit 93506fc into main Jun 26, 2026
33 checks passed
@brondani brondani deleted the projmgr-generator-improvements branch June 26, 2026 15:16
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.

3 participants