Skip to content

[runtime tests] Make 5 tests conditional on multithreading support#126357

Merged
radekdoulik merged 1 commit intodotnet:mainfrom
radekdoulik:runtime-tests-conditional-mt
Apr 1, 2026
Merged

[runtime tests] Make 5 tests conditional on multithreading support#126357
radekdoulik merged 1 commit intodotnet:mainfrom
radekdoulik:runtime-tests-conditional-mt

Conversation

@radekdoulik
Copy link
Copy Markdown
Member

Note

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

Disable tests that call Thread.Start() on single-threaded platforms (e.g., browser WASM) by using ConditionalFact with PlatformDetection.IsMultithreadingSupported.

These tests unconditionally create and start new threads, which fails on single-threaded WASM where Thread.Start() is not supported.

Tests changed

  • finally_SEH (baseservices/exceptions) — spawns thread in finally block
  • rethrow (baseservices/exceptions) — spawns threads for exception rethrow testing
  • Polyrec (Loader/regressions) — spawns 4 threads for polymorphic recursion
  • test1 (Loader/TypeInitialization/backpatching) — spawns threads for static constructor race
  • InterlockExchange (Regressions) — spawns 99 threads for interlocked ops

Changes

  • [Fact][ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsMultithreadingSupported))]
  • Added using TestLibrary; and <ProjectReference Include="$(TestLibraryProjectPath)" /> where not already present

@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke, @dotnet/runtime-infrastructure
See info in area-owners.md if you want to be subscribed.

@radekdoulik radekdoulik marked this pull request as draft March 31, 2026 15:01
Disable tests that call Thread.Start() on single-threaded platforms
(e.g., browser WASM) by using ConditionalFact with
PlatformDetection.IsMultithreadingSupported.

Tests changed:
- finally_SEH (baseservices/exceptions)
- rethrow (baseservices/exceptions)
- Polyrec (Loader/regressions)
- test1 (Loader/TypeInitialization/backpatching)
- InterlockExchange (Regressions)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@radekdoulik radekdoulik force-pushed the runtime-tests-conditional-mt branch from c67b6c2 to a9a776a Compare March 31, 2026 15:02
@radekdoulik radekdoulik marked this pull request as ready for review March 31, 2026 15:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 aims to avoid failures on single-threaded platforms (e.g., browser WASM) by skipping a small set of tests that unconditionally call Thread.Start(). In addition, the PR includes CoreCLR VM changes related to portable entrypoints/interpreter behavior and interpreter frame allocation alignment.

Changes:

  • Convert 5 thread-spawning tests from [Fact] to [ConditionalFact(...IsMultithreadingSupported)] and add TestLibrary references where needed.
  • Add $(TestLibraryProjectPath) project references to affected test projects.
  • Update CoreCLR VM interpreter/portable-entrypoint logic and adjust interpreter frame allocation to use aligned allocation.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/tests/Regressions/coreclr/1514/interlockexchange.cs Skip thread-heavy regression test when multithreading isn’t supported.
src/tests/Loader/regressions/polyrec/Polyrec.csproj Add TestLibrary project reference for PlatformDetection usage.
src/tests/Loader/regressions/polyrec/polyrec.cs Gate polymorphic recursion multithreaded test behind multithreading support.
src/tests/Loader/classloader/TypeInitialization/backpatching/test1.cs Skip type-init race test on single-threaded platforms.
src/tests/baseservices/exceptions/regressions/V1/SEH/COOL/rethrow.csproj Add TestLibrary project reference for PlatformDetection usage.
src/tests/baseservices/exceptions/regressions/V1/SEH/COOL/rethrow.cs Gate thread-based rethrow test behind multithreading support.
src/tests/baseservices/exceptions/regressions/V1/SEH/COOL/finally.cs Gate thread-based finally/SEH regression test behind multithreading support.
src/tests/baseservices/exceptions/regressions/V1/SEH/COOL/finally_SEH.csproj Add TestLibrary project reference for PlatformDetection usage.
src/coreclr/vm/method.cpp Adjust ShouldCallPrestub entrypoint selection for MethodImpl/.override + portable entrypoints.
src/coreclr/vm/interpframeallocator.cpp Use aligned allocation/free and align interpreter allocations to INTERP_STACK_ALIGNMENT.
src/coreclr/vm/interpexec.cpp Add interpreter code-prep fallback for MethodImpl/.override vtable-slot remapping scenarios.

@radekdoulik radekdoulik merged commit 70dc35c into dotnet:main Apr 1, 2026
88 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators May 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants