Skip to content

[Test] Add composition switcher test coverage + per-PR ge_current run - #11692

Open
Harini Malothu (HariniMalothu17) wants to merge 7 commits into
mainfrom
switcher-tests-github
Open

[Test] Add composition switcher test coverage + per-PR ge_current run#11692
Harini Malothu (HariniMalothu17) wants to merge 7 commits into
mainfrom
switcher-tests-github

Conversation

@HariniMalothu17

@HariniMalothu17 Harini Malothu (HariniMalothu17) commented Aug 28, 2026

Copy link
Copy Markdown

What

Adds automated coverage for the lifted system composition switcher and runs it per-PR on a
ge_current agent, engaging the switcher through the public
Microsoft.UI.Composition.CompositionEngine API (TrySetProcessEngine(System)) — the same API
shipping controls like InkCanvas use.

Why

The switcher (lifted → system composition engine) had no automated test coverage. These tests prove the
lifted→system routing engages end-to-end and let master-backed render tests run under the switched
backend, so regressions are caught in CI.

How it works

  • Tests (SwitcherTests.cpp/.h): an engagement certifier uses the public
    CompositionEngine::GetForSystemEngine to verify the lifted compositor's system-engine equivalent is a
    real system compositor (proves routing, not a silent no-op). The backend flip is process-wide, so one
    proof certifies the whole run.
  • Opt-in (ModuleCleanup.cpp): under /p:SwitcherMode=true, ModuleSetup calls
    TrySetProcessEngine(System) before any compositor is created. CompositionEngine is a Limited Access
    Feature; ModuleSetup unlocks it via TryUnlockFeature, reading the token from the
    /p:SwitcherLafToken runtime parameter — supplied by the pipeline, never hardcoded.
  • Pipeline (WinUI-RunSwitcherTests-Stage.yml, wired into WinUI-GitHub-PR.yml): runs
    *SwitcherTests* on a ge_current agent under -HostingMode:WPF /p:SwitcherMode=true and publishes
    the generated trees for baselining. The LAF token is referenced by name from an ADO Library
    variable group.
  • Baselines (Utilities.cpp): master selection prefers .master.switcher.<ext> and falls back to
    .master.<ext>. Switcher baselines are pipeline-generated and land in a follow-up PR (none committed
    here).

Files

  • dxaml/test/native/external/foundation/graphics/rendering/SwitcherTests.cpp/.h — the tests.
  • dxaml/test/native/external/infra/ModuleCleanup.cpp — SwitcherMode opt-in + LAF unlock.
  • dxaml/test/infra/client/lib/Utilities.cpp.master.switcher.* selection with fallback.
  • build/AzurePipelinesTemplates/WinUI-RunSwitcherTests-Stage.yml — ge_current switcher stage.
  • build/WinUI-GitHub-PR.yml — wires the stage into the GitHub PR pipeline.
  • Helix/GenerateHelixWorkItems.ps1, build/AzurePipelinesTemplates/WinUI-CreateHelixProjFile-Steps.yml
    — SwitcherMode threading.
  • scripts/UpdateMasterFiles.ps1 (-switcher), test/scripts/runtests.ps1 (-SwitcherInputTests),
    test/scripts/SwitcherInputTests.txt, tools/triage-switcher-failures.ps1 — helpers/roster.

Testing

Switcher engages locally (3/3). The pipeline stage publishes results and is initially non-gating
(failOnTestFailure: false) so it can't red-gate PRs until switcher baselines are captured; it flips to
gating in the baseline follow-up.

Notes for reviewers

  • No private interfaces, no regkey, no token/seed literals — only the public CompositionEngine API.
  • Opened as a draft for the first CI run; will un-draft once the switcher stage is green.

Harini Malothu and others added 3 commits August 26, 2026 22:55
…system-composition

Adds the composition switcher test coverage and the plumbing to run it under
/p:SwitcherMode=true:

- SwitcherTests.cpp/.h: engagement certifier + lifted->system composition path test
  (CompositionEngine::TrySetProcessEngine(System)).
- ModuleCleanup.cpp: ModuleSetup engages the switcher when /p:SwitcherMode=true.
- Utilities.cpp: IsSwitcherMode() + prefer .master.switcher.<ext> baselines (falls back
  to .master.<ext> so non-switcher runs are unaffected).
- runtests.ps1: -SwitcherInputTests selection; SwitcherInputTests.txt list.
- UpdateMasterFiles.ps1: -switcher writes .master.switcher.<ext> baselines.
- GenerateHelixWorkItems.ps1 + WinUI-CreateHelixProjFile-Steps.yml: thread
  -SwitcherMode -> /p:SwitcherMode=true into the generated te.exe args.
- tools/triage-switcher-failures.ps1: classify SWITCHER_REGRESSION vs NEEDS_SWITCHER_BASELINE.

Switcher .master.switcher.* baselines are intentionally NOT included here; they are
captured from the pipeline run (authoritative for the lab environment) in a follow-up.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3497b5d2-3a6c-44a7-8bb9-0204ef42b3da
Adds WinUI-RunSwitcherTests-Stage.yml: a self-contained stage (modeled on
WinUI-PGO-Train-Stage.yml) that runs on a ge_current-vhdx_enterprise lab VM,
builds the test payload, forces the switcher on via the RenderingEngine\Switcher
GlobalOverride regkey, and runs the switcher tests with /p:SwitcherMode=true
(WPF). Publishes the generated .save.xml trees so switcher baselines can be
captured from the run. Wired into WinUI-PR.yml after RunTests.

First run targets *SwitcherTests* (engagement certifiers); flip testSelector to
"*" -TestsWithMasterFilesOnly for the full master-backed suite once green.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3497b5d2-3a6c-44a7-8bb9-0204ef42b3da
…fToken

Adds the LAF unlock (TryUnlockFeature) in ModuleSetup reading the /p:SwitcherLafToken
runtime parameter, wires the ge_current switcher stage into WinUI-GitHub-PR.yml, and
passes the token from the WinUI-InternalFeed variable group (by name; value stays in
ADO Library). No token/seed literal, no regkey, public CompositionEngine API only.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c344c3ae-e1a7-47f8-b166-d00d1cfd5548
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@microsoft-github-policy-service microsoft-github-policy-service Bot added the needs-triage Issue needs to be triaged by the area owners label Aug 28, 2026
The branch's copies of three shared files predated changes on main and
were removing unrelated, still-live code. Restore them so the PR is
purely additive switcher coverage:
- Utilities.cpp: restore SetImageCompareTolerance/GetImageCompareTolerance
  and SetDCompXmlVariable/ClearDCompXmlVariables/HasDCompXmlVariables
  (declared in Private.Infrastructure.idl + Utilities.h and called by
  TestComparisonGuards.h; removing the defs broke the build).
- runtests.ps1: restore DisableXamlGeneratedMain* appx cleanup.
- UpdateMasterFiles.ps1: restore copyright/license header (+ BOM).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c344c3ae-e1a7-47f8-b166-d00d1cfd5548
@HariniMalothu17

Copy link
Copy Markdown
Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
1 pipeline(s) were filtered out due to trigger conditions.

@HariniMalothu17

Copy link
Copy Markdown
Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
1 pipeline(s) were filtered out due to trigger conditions.

@HariniMalothu17
Harini Malothu (HariniMalothu17) marked this pull request as ready for review August 28, 2026 10:28
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@HariniMalothu17

Copy link
Copy Markdown
Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
1 pipeline(s) were filtered out due to trigger conditions.

@HariniMalothu17

Copy link
Copy Markdown
Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
1 pipeline(s) were filtered out due to trigger conditions.

Harini Malothu and others added 3 commits August 28, 2026 16:06
The self-repo template reference resolved file-relative (build/ + build/...),
producing /build/build/AzurePipelinesTemplates/WinUI-RunSwitcherTests-Stage.yml.
Qualify with @self so it resolves from repo root like the @WinUIInternal siblings.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c344c3ae-e1a7-47f8-b166-d00d1cfd5548
… prefix)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c344c3ae-e1a7-47f8-b166-d00d1cfd5548
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c344c3ae-e1a7-47f8-b166-d00d1cfd5548
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-triage Issue needs to be triaged by the area owners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant