Skip to content

Convert WasiPlayground sample into MTP acceptance tests - #9828

Merged
Amaury Levé (Evangelink) merged 3 commits into
mainfrom
dev/amauryleve/wasi-acceptance-test
Jul 11, 2026
Merged

Amaury Levé (Evangelink) merged 3 commits into
mainfrom
dev/amauryleve/wasi-acceptance-test

Conversation

@Evangelink

@Evangelink Amaury Levé (Evangelink) commented Jul 10, 2026 •

Copy link
Copy Markdown
Member

What

  • Converts samples/WasiPlayground (raw Microsoft.Testing.Platform on wasi-wasm) into acceptance tests and deletes the sample.
  • Adds the MSTest wasm acceptance test as its product-specific counterpart, and installs the wasm-tools workload in CI so the publish step works.

Structure (product separation)

  • Raw platform → Microsoft.Testing.Platform.Acceptance.IntegrationTests/WasmExecutionTests.cs: RawPlatform_BuildsForWasi (always-on) + RawPlatform_RunsUnderWasmtime (gated). Generates a project referencing the Microsoft.Testing.Platform package with a DummyFramework (one passing test).
  • MSTest adapter → MSTest.Acceptance.IntegrationTests/WasmExecutionTests.cs: WasmBuild_GeneratesTestingPlatformEntryPoint (always-on) + WasmExecution_RunsTestsUnderWasmtime (gated). Real MSTest project (two passing + one failing test) on MTP via the generated entry point.
  • Shared wasmtime/publish/ICU-staging plumbing extracted into WasmRuntime in Microsoft.Testing.TestInfrastructure so the two projects don't duplicate it.

Build / CI

  • eng/restore-toolset.ps1 + .sh now install wasm-tools-net10 in addition to wasi-experimental-net10, so dotnet publish -r wasi-wasm works in CI (needed by the gated execution tests).
  • Still required to actually run the execution tests: wasmtime on PATH. Without it the two execution tests mark themselves inconclusive (self-skip). Wiring a pinned wasmtime install into the pipeline legs is intentionally left out of this PR as a separate decision — happy to add it if we want the execution tests to run green in CI.

Note on MSTest support

MSTest-on-wasi already works (shipped in #9781 / issue #2196). The original blocker was single-threaded wasm (no thread pool); the platform and adapter detect it (RuntimeFeatureHelper.IsMultiThreaded / RuntimeContext.IsMultiThreaded) and fall back to inline execution. Remaining gaps are extension-specific and unrelated to MSTest: HangDump (System.Diagnostics.Process, #8557) and AzureDevOpsReport (HttpClient AutomaticDecompression).

Verification

Both Microsoft.Testing.Platform.Acceptance.IntegrationTests and MSTest.Acceptance.IntegrationTests build clean (0 warnings, 0 errors). The wasm-tools-net10 workload install was exercised locally via restore-toolset.

Promote the raw-platform wasi-wasm scenario from samples/WasiPlayground into acceptance tests (RawPlatform_BuildsForWasi + RawPlatform_RunsUnderWasmtime) alongside the existing MSTest wasm tests, sharing the wasmtime/publish/ICU helpers. Delete the sample and update solution files and restore-toolset comments accordingly.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 10, 2026 15:38

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 promotes the former samples/WasiPlayground scenario (hosting raw Microsoft.Testing.Platform on wasi-wasm) into Microsoft.Testing.Platform.Acceptance.IntegrationTests acceptance coverage, and removes the now-redundant sample from the repo/solutions. This helps ensure WASI build/execution behaviors stay regression-tested alongside the existing MSTest-on-MTP WASI acceptance test.

Changes:

  • Add new “raw MTP” WASI acceptance tests and refactor shared WASI helpers (LocateWasmtime, StageIcuData, publish/run helpers) in WasmExecutionTests.cs.
  • Remove samples/WasiPlayground and drop it from TestFx.slnx and Microsoft.Testing.Platform.slnf.
  • Update restore-toolset script comments to point to the new acceptance test coverage as the wasi-experimental-net10 workload consumer.
Show a summary per file
File Description
TestFx.slnx Removes the deleted WASI playground sample from the full solution.
test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/WasmExecutionTests.cs Adds raw-MTP WASI build/run acceptance tests and refactors shared WASI helpers.
samples/WasiPlayground/WasiPlayground.csproj Deleted (sample promoted into acceptance tests).
samples/WasiPlayground/README.md Deleted (documentation folded into test XML docs / comments).
samples/WasiPlayground/Program.cs Deleted (raw platform host logic now generated in acceptance test asset).
Microsoft.Testing.Platform.slnf Removes the deleted WASI playground sample from the platform solution filter.
eng/restore-toolset.sh Updates comments to reference acceptance tests as the workload consumer.
eng/restore-toolset.ps1 Updates comments to reference acceptance tests as the workload consumer.

Review details

  • Files reviewed: 8/8 changed files
  • Comments generated: 2
  • Review effort level: Low

@github-actions

This comment has been minimized.

@github-actions github-actions Bot 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.

Note

🤖 Automated review by GitHub Copilot. Generated by the Expert Code Review workflow. To request a follow-up action, reply by tagging @copilot directly.

✅ 22/22 dimensions clean — no findings.

Summary: Clean promotion of the samples/WasiPlayground into acceptance tests with good refactoring discipline:

  • Shared helpers (LocateWasmtime, StageIcuData, TryPublishForWasiAsync, RunUnderWasmtimeAsync) properly extracted and reused across both raw-platform and MSTest test methods.
  • Proper using on TestAsset (disposable management).
  • Graceful inconclusive skipping when toolchain is unavailable — no flakiness risk.
  • No duration assertions, no shared mutable state, no timing-dependent logic.
  • eng/ script changes are comment-only (no behavioral change).
  • Solution filter updates are consistent with the sample deletion.

@github-actions

This comment has been minimized.

Split the wasi-wasm acceptance coverage per product: the raw-platform tests stay in Microsoft.Testing.Platform.Acceptance.IntegrationTests and the MSTest-adapter tests move to MSTest.Acceptance.IntegrationTests. Shared wasmtime/publish/ICU plumbing is extracted into a WasmRuntime helper in Microsoft.Testing.TestInfrastructure to avoid duplication across the two projects. Also add the wasm-tools-net10 workload to eng/restore-toolset so 'dotnet publish -r wasi-wasm' works in CI (execution still self-skips unless wasmtime is on PATH).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 10, 2026 15:59

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.

Review details

  • Files reviewed: 10/10 changed files
  • Comments generated: 7
  • Review effort level: Medium

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions github-actions Bot 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.

🤖 Automated content by GitHub Copilot. Generated by the Build Failure Analysis workflow. · 48.5 AIC · ⌖ 5.81 AIC · ⊞ 7.3K · ◷

…es, add BOM

- Reorder both execution tests to publish for wasi-wasm first (so the publish path is exercised in CI where wasm-tools is installed but wasmtime is not), then gate only the wasmtime invocation.
- Add WasmRuntime.IsMissingWasmToolsWorkload so only the known NETSDK1147/'wasm-tools' missing-workload signature is an inconclusive skip; any other publish failure now fails the test.
- Check the combined STDOUT+STDERR for PlatformNotSupportedException and drop the unused stderr local.
- Fix the MSTest asset comment (two passing + one failing test).
- Add the UTF-8 BOM required by .editorconfig to the three new/rewritten C# files.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 11, 2026 12:06

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.

Review details

  • Files reviewed: 10/10 changed files
  • Comments generated: 0 new
  • Review effort level: Low

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Test quality grade — PR #9828

4 new test methods graded across 2 files. Three tests earn an A with strong multi-assertion coverage of exit codes, output content, and artifact existence. RawPlatform_BuildsForWasi lands at B because it asserts only that the build exits cleanly, with no artifact check — its MSTest counterpart (WasmBuild_GeneratesTestingPlatformEntryPoint) sets the higher bar by also verifying the generated entry-point file exists.

GradeTestNotes
B (80–89) new WasmExecutionTests.
RawPlatform_
BuildsForWasi
Single exit-code assertion covers build success but no artifact check — consider verifying a key output file (e.g. dotnet.wasm) to guard against silent no-op builds. (MTP project)
A (90–100) new WasmExecutionTests.
RawPlatform_
RunsUnderWasmtime
Clear AAA with skip guards; asserts absence of PlatformNotSupportedException, expected pass/fail counts, and zero exit code. (MTP project)
A (90–100) new WasmExecutionTests.
WasmBuild_
GeneratesTestingPlatformEntryPoint
Asserts both exit code and physical presence of the generated entry-point file — strong build-plumbing guard. (MSTest project)
A (90–100) new WasmExecutionTests.
WasmExecution_
RunsTestsUnderWasmtime
Multi-assertion end-to-end coverage: no unexpected exception, correct pass/fail counts, non-zero exit on failure. (MSTest project)

This advisory comment was generated automatically. Grades are heuristic
and informational — they do not block merging. Re-run with
/grade-tests.

🤖 Automated content by GitHub Copilot. Generated by the Grade Tests on PR (on open / sync) workflow. · 50 AIC · ⌖ 5.6 AIC · ⊞ 9.5K · [◷]( · ◷)

@github-actions

Copy link
Copy Markdown
Contributor

🔍 Build Failure Analysis

Summary — The build fails with 4 × CA1416 errors in FileLoggerTests.cs because the unit test project now declares <SupportedPlatform Include="browser" />, which flags calls to ITask.RunLongRunning (marked [UnsupportedOSPlatform("browser")]) as platform-incompatible.

Root cause: SupportedPlatform "browser" added to unit test project

Commit c66515a ("RFC 018: Artifact post-processing for dotnet test (MTP)") added a <SupportedPlatform Include="browser" /> item to test/UnitTests/Microsoft.Testing.Platform.UnitTests/Microsoft.Testing.Platform.UnitTests.csproj. This tells the CA1416 analyzer that code in the project may run on the "browser" platform.

ITask.RunLongRunning is annotated with [UnsupportedOSPlatform("browser")] (in ITask.cs:16-17), so the two test-helper classes in FileLoggerTests.cs that delegate to it now trigger CA1416 (promoted to error by WarnAsError).

Affected files / errors

Proposed fix

The unit test project will never run on the browser platform. The cleanest fix is to add [UnsupportedOSPlatform("browser")] to the two inner-class RunLongRunning methods (matching the interface declaration), or suppress CA1416 at the call sites:

  // In LoopStartedTrackingTask (line ~464)
+ [System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
  public Task RunLongRunning(Func<Task> action, string name, CancellationToken cancellationToken)
      => _inner.RunLongRunning(action, name, cancellationToken);

  // In NeverCompletingTask (line ~489)
+ [System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
  public Task RunLongRunning(Func<Task> action, string name, CancellationToken cancellationToken)
      => _inner.RunLongRunning(action, name, cancellationToken);

Alternatively, if the <SupportedPlatform Include="browser" /> item in the .csproj was added unintentionally to this unit test project, removing it would also fix the issue without any test code changes.


Build overview
  • Result: FAILED
  • Duration: 246.5s
  • MSBuild: 18.10.0-preview-26359-110+d4d78458a
  • Projects: 49 total, 3 failed
  • Errors: 5 (4 × CA1416 + 1 "Build failed")
  • Failed projects: Build.proj, NonWindowsTests.slnf, Microsoft.Testing.Platform.UnitTests.csproj
All MSBuild errors (5)
Code Project File:Line Message
CA1416 Microsoft.Testing.Platform.UnitTests FileLoggerTests.cs:465 ITask.RunLongRunning(...) is unsupported on: 'browser'
CA1416 Microsoft.Testing.Platform.UnitTests FileLoggerTests.cs:490 ITask.RunLongRunning(...) is unsupported on: 'browser'
CA1416 Microsoft.Testing.Platform.UnitTests FileLoggerTests.cs:465 (duplicate, second TFM)
CA1416 Microsoft.Testing.Platform.UnitTests FileLoggerTests.cs:490 (duplicate, second TFM)
— — — Build failed.

🤖 Generated by the Build Failure Analysis workflow using (a href="(dev.azure.com/redacted) · commit 1f66751

🤖 Automated content by GitHub Copilot. Generated by the Build Failure Analysis workflow. · 143.7 AIC · ⌖ 5.98 AIC · ⊞ 7.3K · [◷]( · ◷)

@Evangelink
Amaury Levé (Evangelink) merged commit 64017f7 into main Jul 11, 2026
64 of 71 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the dev/amauryleve/wasi-acceptance-test branch July 11, 2026 12:30
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.

2 participants