Skip to content

Add basic test for crossgen2 WebCIL#128609

Merged
jtschuster merged 6 commits into
dotnet:mainfrom
jtschuster:jtschuster/webcil-r2r-test
May 30, 2026
Merged

Add basic test for crossgen2 WebCIL#128609
jtschuster merged 6 commits into
dotnet:mainfrom
jtschuster:jtschuster/webcil-r2r-test

Conversation

@jtschuster

Copy link
Copy Markdown
Member

Adds a super basic test to run a crossgen2 compilation and emit a WASM WebCIL payload.

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 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.OutputFileExtension and use it when computing crossgen2 output paths.
  • Remove unused Crossgen2Option enum values and their argument mappings.
  • Add a new WebCIL test case source file plus a new xUnit test (WasmWebcilModule) that compiles/validates a .wasm WebCIL 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 adamperlin 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.

This looks good to me!

jtschuster and others added 3 commits May 27, 2026 11:49
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>
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>
Copilot AI review requested due to automatic review settings May 28, 2026 17:10

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

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

@jtschuster jtschuster enabled auto-merge (squash) May 29, 2026 18:16
@jtschuster jtschuster merged commit b280560 into dotnet:main May 30, 2026
107 of 111 checks passed
@github-project-automation github-project-automation Bot moved this to Done in AppModel May 30, 2026
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview6 milestone May 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-crossgen2-coreclr only use for closed issues

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants