Skip to content

Ignore MTP exit code 8 (zero tests ran) for Helix work items - #54965

Merged
Evangelink merged 1 commit into
mainfrom
evangelink-turbo-fiesta
Jun 24, 2026
Merged

Evangelink merged 1 commit into
mainfrom
evangelink-turbo-fiesta

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Problem

Some Helix work items fail with exit code 8 even though the test results tab shows everything green, which is confusing and has led to PRs being merged in a falsely-failing state (see #54963, #54788).

Exit code 8 in Microsoft.Testing.Platform (MTP) means "the test session ran zero tests".

Root cause

The affected assemblies (dotnet-aot.Tests, Microsoft.Win32.Msi.Tests, …) are all MSTest.Sdk → MTP projects. They run through the isMTPProject branch in SDKCustomCreateXUnitWorkItemsWithTestExclusion, invoked as dotnet exec <dll> --filter ....

A work item ends up running zero tests when:

  • class-based sharding (--filter) isolates a partition containing only skipped tests, or
  • a project legitimately runs no tests on a platform (e.g. Windows-only Msi tests on Linux/macOS).

MTP then returns exit code 8 and Helix treats the nonzero exit as a failure.

Fix

Add --ignore-exit-code 8 to the MTP work-item command so "zero tests ran" reports success instead of failing the work item. This is the mitigation called out in the issue.

  • Scoped to the MTP branch only — the VSTest dotnet test path doesn't use MTP exit codes and is untouched.
  • Real failures (exit 2, crashes, setup errors, etc.) still surface.

The stricter long-term fix (relaxing exit 8 on the test-platform side when tests exist but are all skipped) is tracked separately.

Fixes #54963

MSTest.Sdk-based (MTP) test projects fail Helix work items with exit code 8
when a shard runs zero tests -- either because class-based sharding isolates
only skipped tests, or because a project legitimately runs no tests on a given
platform (e.g. Windows-only Msi tests on Linux/macOS). Helix treats the nonzero
exit as a failure even though the test results report green, which is confusing
and has led to PRs being merged in a falsely-failing state.

Add --ignore-exit-code 8 to the MTP work-item command so these runs report
success. Real failures (exit 2, crashes, etc.) still surface.

Fixes #54963

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings June 24, 2026 18:20

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

Updates the Helix work item command line for Microsoft.Testing.Platform (MTP) / MSTest.Sdk test assemblies so that MTP’s “zero tests ran” exit code (8) is treated as success, avoiding false-negative Helix failures when sharding or platform-specific skips result in zero executed tests.

Changes:

  • Add --ignore-exit-code 8 to the MTP work item invocation.
  • Document the rationale and link to the tracking issue (#54963) inline in the task.
Show a summary per file
File Description
test/HelixTasks/SDKCustomCreateXUnitWorkItemsWithTestExclusion.cs Adds --ignore-exit-code 8 to MTP work item commands to prevent Helix failures when a shard runs zero tests.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

@Evangelink
Evangelink merged commit ef4d63f into main Jun 24, 2026
27 checks passed
@Evangelink
Evangelink deleted the evangelink-turbo-fiesta branch June 24, 2026 20:31
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview7 milestone Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Some Helix work items are failing with exit code 8 (zero tests run) when all tests skipped.

3 participants