Skip to content

Run out-of-process runtime tests on WASI - #136047

Merged
lewing merged 4 commits into
dotnet:mainfrom
lewing:lewing-wasi-out-of-process-runtime-tests
Oct 26, 2026
Merged

lewing merged 4 commits into
dotnet:mainfrom
lewing:lewing-wasi-out-of-process-runtime-tests

Conversation

@lewing

@lewing lewing commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

On WASI, merged runtime-test runners reported their out-of-process (RequiresProcessIsolation) tests as passed without running them. This makes them run in both WASI lanes (interpreter and composite R2R) by reusing browser's host-side orchestration from #131110. The pieces are coupled: tests with native code only run out-of-process with a relinked corerun.wasm, and enabling the tests surfaces the classifications below.

  • Orchestration: the out-of-process loop in CLRTest.Execute.Bash.targets becomes a shared function for browser and WASI. WASI results go to the runner's preopened directory, and a WASI runner started without orchestration now fails instead of passing.
  • Native relink on WASI: testkit.cmake exports the corerun link kit for WASI, CLRTest.WasmCorerun.targets drives wasi-sdk clang++, and native test libraries build for WASI CoreCLR. gen-buildsys.sh now uses WASI_SDK_PATH only when it is the expected wasi-sdk version, like AcquireWasiSdk.targets; this affects every WASI native build, not just tests.
  • Infrastructure fixes: test environment variables now reach the wasmtime guest (they were dropped), the R2R composer no longer inherits test settings like DOTNET_GCStress, and R2RIncompatible reports Skip instead of Pass.
  • Classification: WebAssembly capability gaps are TargetArchitecture == wasm conditions ([wasi][coreCLR] Track out-of-process runtime tests disabled on WASI #136046, [browser][coreCLR] Track disabled OOP runtime tests pending browser support #131321); composite-R2R-only uninitialized element traps are quarantined under [wasi][R2R] Runtime test failures: prestub assert in self_override5, uninitialized element in overflow01_div #134949. Loader/TrustedPlatformAssembliesProperty now skips itself in R2R, where its own APP_ASSEMBLIES setting was overriding the R2R host.

All 206 out-of-process tests now run in each lane; the interpreter lane skips 13, the composite R2R lane 40. Browser behavior should be unchanged but needs browser CI, and the CI provisioning of wasi-sdk for the relink hasn't been exercised yet.

Note

This PR description was drafted with the help of GitHub Copilot.

Merged runners on WASI reported their RequiresProcessIsolation tests as
passed without running them. Reuse the browser host orchestration: the
runner writes a plan, the wrapper runs each test's own wrapper, and the
runner imports the results. A WASI guest only sees the runner's
directory, so results are collected there and located through
__TestOutOfProcessResultDirectory.

Also:
- Forward the test environment, DOTNET_*/COMPlus_* settings and the
  protocol variables into the wasmtime guest, which inherits nothing.
- Keep the test's runtime configuration away from the WASI R2R composer.
- Report R2RIncompatible as a skip to the orchestrating runner.
- Export the corerun link kit for WASI and build test-specific hosts for
  tests with native code, as on browser; build native test libraries for
  WASI CoreCLR.
- Gate tests that need capabilities WebAssembly lacks, and quarantine the
  WASI composite ReadyToRun failures against dotnet#134949.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3416bffe-1925-4a9b-93a7-200f93ec7be8
@github-actions github-actions Bot added the area-Infrastructure-coreclr Only use for closed issues label Oct 19, 2026
@lewing lewing added the os-wasi Related to WASI variant of arch-wasm label Oct 19, 2026
@lewing
lewing requested a review from radekdoulik October 19, 2026 01:47
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 4 pipeline(s).
12 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@lewing
lewing requested a review from jkoritzinsky October 19, 2026 01:47
@lewing
lewing requested a review from akoeplinger October 19, 2026 01:48
@lewing lewing added the arch-wasm WebAssembly architecture label Oct 19, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara
See info in area-owners.md if you want to be subscribed.

The WASI runtime-test build failed in CI because WASI_SDK_PATH pointed at
the container's wasi-sdk, which differs from the version the runtime is
built with: the test-specific corerun relink and the native test
libraries used it, and its linker did not accept the component options
the kit carries. Resolve the SDK the way eng/AcquireWasiSdk.targets does
in both places: honor WASI_SDK_PATH only when it is the expected version,
otherwise use the shared tool cache.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3416bffe-1925-4a9b-93a7-200f93ec7be8
On Linux, init-compiler.sh adds -fuse-ld=lld to LDFLAGS, which CMake
folds into CMAKE_EXE_LINKER_FLAGS. The corerun link kit copied it into
corerun-link.rsp, where it came after the consumer's
-fuse-ld=wasm-component-ld and won, so wasm-ld rejected
--component-type. Leave linker selection out of the kit, and pass the
consumer's linker after the response file.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3416bffe-1925-4a9b-93a7-200f93ec7be8

@radekdoulik radekdoulik left a comment

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.

Suggestions for the two WASI test-infrastructure fixes. The upload-path suggestions need to be applied together.

Note

These suggestions were drafted with GitHub Copilot.

@lewing
lewing enabled auto-merge (squash) October 23, 2026 14:18
The WASI guest could not write the merged runner's results to
HELIX_WORKITEM_UPLOAD_ROOT: the variable was not forwarded and the
directory was not preopened, so Helix published no WASI runtime-test
results. Preopen it and pass its guest path, building the launcher as an
array so an upload path with spaces stays one argument.

A planned out-of-process test whose directory is absent was recorded as
passing, because its skip reason could not be written there. Record the
skip directly.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3416bffe-1925-4a9b-93a7-200f93ec7be8
@lewing

lewing commented Oct 26, 2026

Copy link
Copy Markdown
Member Author

/ba-g windows failure is unrelated

@lewing
lewing merged commit e32a71b into dotnet:main Oct 26, 2026
157 of 160 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch-wasm WebAssembly architecture area-Infrastructure-coreclr Only use for closed issues os-wasi Related to WASI variant of arch-wasm

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants