Add basic test for crossgen2 WebCIL#128609
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the ILCompiler.ReadyToRun test harness to support non-.dll crossgen2 outputs and adds a minimal xUnit test case that runs crossgen2 targeting wasm/browser to produce a WASM-wrapped WebCIL payload and validates it via WebcilImageReader.
Changes:
- Add
CrossgenCompilation.OutputFileExtensionand use it when computing crossgen2 output paths. - Remove unused
Crossgen2Optionenum values and their argument mappings. - Add a new WebCIL test case source file plus a new xUnit test (
WasmWebcilModule) that compiles/validates a.wasmWebCIL output.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/TestCasesRunner/R2RTestRunner.cs | Adds configurable output extension for crossgen2 output path generation (enables .wasm outputs). |
| src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/TestCasesRunner/R2RDriver.cs | Removes unused crossgen2 option enum entries/mappings. |
| src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/TestCases/Webcil/WasmWebcilModule.cs | New embedded-source test input used to produce a WebCIL payload. |
| src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/TestCases/R2RTestSuites.cs | Adds an xUnit test that invokes crossgen2 for wasm/browser and validates WebCIL-in-WASM output. |
adamperlin
approved these changes
May 26, 2026
adamperlin
left a comment
Contributor
There was a problem hiding this comment.
This looks good to me!
This was referenced May 27, 2026
Drives src/coreclr/runtime.proj with ClrAllJitsSubset=true;ClrWasmJitSubset=true from a BeforeTargets='ResolveProjectReferences' target so the wasm JIT is present in the CoreCLR artifacts directory before crossgen2_inbuild publishes its layout. This makes the WebCIL R2R test in this project able to find a wasm JIT. The dependency lives on the test project (not on crossgen2_inbuild) because crossgen2_inbuild is also referenced from crossgen-corelib.proj and the shipping Microsoft.NETCore.App.Crossgen2.Host.sfxproj; adding the wasm JIT dep upstream would slow every CoreCLR build and pull clrjit_universal_wasm_* into the shipping crossgen2 publish layout via the existing clrjit_*_<host> glob. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…2r-test # Conflicts: # src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/TestCases/R2RTestSuites.cs # src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/TestCasesRunner/R2RDriver.cs
In a cross build (e.g., CI's clr.toolstests in Checked), crossgen2_inbuild copies JITs from $(CoreCLRArtifactsPath)/$(CrossHostArch)/ (i.e. .../<config>/<host>/), but the previous BeforeTargets call invoked runtime.proj without the cross-host properties, so the wasm JIT was installed to .../<config>/ (no /<host>/ subdir) and crossgen2_inbuild's publish never picked it up. Mirror the cross-tool stanza in eng/Subsets.props (HostArchitecture, BuildSubdirectory, CrossBuild=false, -DCLR_CROSS_COMPONENTS_BUILD=1) when _BuildJitsCrossArch is true, so the wasm/alljits install lands at the same path crossgen2_inbuild reads from. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
davidwrighton
approved these changes
May 27, 2026
The Content glob in crossgen2_inbuild is evaluated at project-load time (before BuildAllJitsForReadyToRunTests runs), so a clean tree misses the freshly built wasm JIT. Its Publish is also skipped on incremental rebuilds. Add a direct Copy task to the existing target so WasmWebcilModule has the wasm JIT in both fresh and incremental builds. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
3 tasks
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.
Adds a super basic test to run a crossgen2 compilation and emit a WASM WebCIL payload.