dotnet / dotnet/runtime

[wasm][coreCLR] Enable runtime tests that need relinking, and cover the call-helpers generator end to end

Open
#133,187 3 comments 0 reactions 0 assignees View on GitHub
arch-wasm area-Interop-coreclr
Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Description

Once #131877 lands, `src/tests` tests whose managed code calls their own native code can be relinked into a test-specific `corerun` on browser-wasm. Two follow-ups:

### 1. Enable the tests

264 test projects have a `CMakeProjectReference`, 102 of them under `src/tests/Interop`. Work out how many actually pass once relinking is available, enable those, and track the rest.

Note there does not appear to be a CI leg running `src/tests` on browser-wasm CoreCLR today — `CLR_R2R_Tests_browser_wasm` runs `ILCompiler.ReadyToRun.Tests`, not the runtime tests — so this may also mean adding one.

### 2. Cover the call-helpers generator end to end

#131877 initially added unit tests that asserted substrings in the generated C, and dropped them again after [this review comment](https://github.com/dotnet/runtime/pull/131877#discussion_r3925346429). Two behaviours are consequently shipping without any test:

- **floating point callback arguments** — a reverse thunk passes each argument to the interpreter in an 8-byte slot, and casting a `float`/`double` to the slot type converts it numerically instead of preserving its bits. Fixed in 23c2f386458; an `[UnmanagedCallersOnly]` callback taking a `double`, called from native code, would cover it.
- **multi-assembly input** — the generator has to accept a whole app closure, not one assembly. Any relinked test with more than one assembly exercises this incidentally.

If the enabled interop tests already cover these shapes, no new test is needed — check before adding.

> [!NOTE]
> This issue was drafted with GitHub Copilot.

Contributor guide

Open the contributing guide

Research direction

Start in src/tests and src/tests/Interop by checking which CMakeProjectReference projects can be relinked for browser-wasm CoreCLR after #131877. Inspect CLR_R2R_Tests_browser_wasm and existing interop coverage, including the call-helpers generator cases; done means enabled passing tests are tracked, remaining failures are recorded, and any needed runtime-test CI coverage is addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, csharp, wasm
Domain
ci-cd, compilers, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.