Fix SkipOnCoreClr generating unreachable test code in standalone runner#126517
Fix SkipOnCoreClr generating unreachable test code in standalone runner#126517MichalStrehovsky merged 4 commits intodotnet:mainfrom
Conversation
SkipOnCoreClrAttribute handling in XUnitWrapperGenerator initialized skippedTestPlatforms, skippedConfigurations, and skippedTestModes to their respective .Any values. When the attribute only specified one dimension (e.g., RuntimeTestModes.InterpreterActive), the others remained at Any. This caused DecorateWithSkipOnCoreClrConfiguration to compute targetPlatform & ~Any = 0, which produced a literal (false) platform condition, making the test body unreachable dead code. The standalone runner would return 100 (pass) without ever executing the test. Fix by initializing the defaults to 0 (meaning 'not specified'), and updating the 'no args given' check accordingly. Now unspecified dimensions correctly mean 'don't skip'. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
/azp run runtime-nativeaot-outerloop, runtime-coreclr outerloop |
|
Azure Pipelines successfully started running 2 pipeline(s). |
There was a problem hiding this comment.
Pull request overview
Fixes SkipOnCoreClrAttribute handling in the XUnit wrapper source generator so that specifying only one skip “dimension” (e.g., RuntimeTestModes.InterpreterActive) no longer results in a false platform condition that makes the generated test body unreachable in the standalone runner.
Changes:
- Initialize
skippedTestPlatforms,skippedConfigurations, andskippedTestModesto0(meaning “unspecified”) instead ofAny. - Update the “no args given” check to detect the new
0-initialized state and preserve the intended “skip all CoreCLR” behavior only when no dimensions are provided.
Mark test as active issue due to dependency on marshalled calli.
|
/azp run runtime-nativeaot-outerloop, runtime-coreclr outerloop |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
/azp run runtime-nativeaot-outerloop, runtime-coreclr outerloop |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
/azp run runtime-nativeaot-outerloop, runtime-coreclr outerloop |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
/ba-g failure building DNNE that looks like an infra hiccup, networking test, and #122345, all unrelated |
Oh, okay, the DNNE issue is not an infra hiccup, here it is in some jitstress run too. Not sure why we're not seeing this more widely: https://github.com/dotnet/runtime/runs/70515032230 Logged #126673 |
Noticed this when my agent started marking ActiveIssue'd native AOT tests as working. The tests clearly shouldn't pass but they did. See #126499 that makes a test fail and we get a green CI without this commit (and fail with this commit).
SkipOnCoreClrAttribute handling in XUnitWrapperGenerator initialized skippedTestPlatforms, skippedConfigurations, and skippedTestModes to their respective .Any values. When the attribute only specified one dimension (e.g., RuntimeTestModes.InterpreterActive), the others remained at Any. This caused DecorateWithSkipOnCoreClrConfiguration to compute targetPlatform & ~Any = 0, which produced a literal (false) platform condition, making the test body unreachable dead code. The standalone runner would return 100 (pass) without ever executing the test.
Fix by initializing the defaults to 0 (meaning 'not specified'), and updating the 'no args given' check accordingly. Now unspecified dimensions correctly mean 'don't skip'.