Test harness and assorted changes for R2R testing in Wasm#128156
Merged
davidwrighton merged 5 commits intoMay 14, 2026
Conversation
Use .wasm file extension for WASM R2R output in test scripts WASM R2R images should use .wasm extension instead of .dll. Update CLRTest.CrossGen.targets to: - Set output extension to .wasm for both composite and non-composite modes in bash and batch scripts when CrossGen2OutputFormat is 'wasm' - Pass -f flag to crossgen2 in batch scripts (matching bash behavior) Also set CrossGen2OutputFormat=wasm in Directory.Build.props for browser target OS so all tests targeting wasm use the correct format. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add 'browser' and 'wasi' shorthand commands to src/tests/build.sh, matching existing support in build.cmd - Auto-set architecture to wasm when browser or wasi target is selected in both build.sh and build.cmd - Fix crossgen2 binary not being copied to Core_Root for wasm builds by copying from the cross-targeting x64/crossgen2 directory when the crossgen2-published directory does not exist - Make generated test scripts (.sh and .cmd) default RunWithNodeJS=1 for CoreCLR browser builds, matching existing Helix CI behavior - Mark readytorun tests as unsupported on wasm architecture Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…s set Move TakeLock/ReleaseLock for RunCrossGen2 outside the RunWithNodeJS guard in the wasm pre-commands section of both CLRTest.Execute.Bash.targets and CLRTest.Execute.Batch.targets. Previously, the crossgen2 lock was inside the 'if not RunWithNodeJS' block, so when RunWithNodeJS defaulted to 1 for CoreCLR builds, crossgen2 was never invoked. Only the wasm app build (WasmTestRunner.proj) should be conditional on RunWithNodeJS. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the test harness and supporting tooling to make ReadyToRun (R2R) / Crossgen2 testing work for WebAssembly targets, including handling wasm-specific output artifacts and improving the wasm test execution flow (browser/wasi) in the src/tests infrastructure and related tools.
Changes:
- Add/propagate wasm-specific Crossgen2 output handling (produce
.wasmoutputs, plumb-f/--obj-format, and default wasm execution behavior for browser). - Improve wasm test harness scripting (Node.js defaulting for CoreCLR+browser, Crossgen2 locking integration, allow precommands to compose rather than overwrite).
- Add minor usability improvements (build script
-browser/-wasishorthands; R2RTest plumbing for--targetos; extended help output for--obj-format).
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/tests/readytorun/tests/mainv2.csproj | Disable this test on wasm targets. |
| src/tests/readytorun/tests/mainv1.csproj | Disable this test on wasm targets. |
| src/tests/readytorun/determinism/crossgen2determinism.csproj | Disable determinism Crossgen2 test on wasm targets. |
| src/tests/readytorun/async-inline-thunks/async-inline-thunks.csproj | Disable async-inline-thunks R2R test on wasm targets. |
| src/tests/Directory.Build.props | Set CrossGen2OutputFormat=wasm for TargetOS=browser. |
| src/tests/Common/CoreRootArtifacts.targets | Allow copying Crossgen2 executable artifacts from cross-arch output when crossgen2-published isn’t present. |
| src/tests/Common/CLRTest.Execute.Batch.targets | Default to Node.js for CoreCLR+browser and integrate Crossgen2 lock handling in wasm/browser paths. |
| src/tests/Common/CLRTest.Execute.Bash.targets | Default to Node.js for CoreCLR+browser and integrate Crossgen2 lock handling in wasm/browser paths. |
| src/tests/Common/CLRTest.CrossGen.targets | Add .wasm output handling for Crossgen2 (composite + individual file modes) and pass -f when set. |
| src/tests/build.sh | Add -browser/-wasi shorthands that also set architecture to wasm. |
| src/tests/build.cmd | Update browser/wasi shorthand behavior to also set architecture to wasm. |
| src/coreclr/tools/r2rtest/Crossgen2Runner.cs | Pass --targetos through to Crossgen2 when provided. |
| src/coreclr/tools/r2rtest/CommandLineOptions.cs | Add --target-os option and plumb it into build options. |
| src/coreclr/tools/aot/crossgen2/Program.cs | Treat PE output format as wasm when targeting Wasm32 (to avoid producing PE .dll on wasm targets). |
| src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs | Extend --help output to include --obj-format valid values/default. |
kg
reviewed
May 13, 2026
kg
reviewed
May 13, 2026
kg
approved these changes
May 13, 2026
Member
kg
left a comment
There was a problem hiding this comment.
LGTM but a second pair of eyes would be good
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
--obj-formatswitch to crossgen2.When this PR and PR #127935 are merged, it will be straightforward enough to run tests.
The process will be something like: