[runtime-diagnostics] Workaround for publish test results regression#124859
[runtime-diagnostics] Workaround for publish test results regression#124859max-charlamb wants to merge 1 commit intodotnet:mainfrom
Conversation
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
There was a problem hiding this comment.
Pull request overview
This PR adds a workaround for a regression in Azure Pipelines' PublishTestResults@2 task version 2.270.0 (tracked in microsoft/azure-pipelines-tasks#21770). The regression causes the task to incorrectly split xUnit test names on all dots, including those within parenthesized test parameters, resulting in garbled test names in the published results.
Changes:
- Added PowerShell script steps to preprocess xUnit XML files before publishing test results
- The script uses regex to replace dots with underscores inside parenthesized sections of test names
- Applied the workaround to both the cDAC and DAC jobs in the runtime-diagnostics pipeline
| - powershell: | | ||
| $xmlFiles = Get-ChildItem '$(Build.SourcesDirectory)/artifacts/TestResults' -Recurse -Filter *.xml -ErrorAction SilentlyContinue | ||
| foreach ($file in $xmlFiles) { | ||
| $content = Get-Content $file.FullName -Raw | ||
| $content = [regex]::Replace($content, '(?<=\bname="[^"]*?\()([^")]+)(?=\))', { | ||
| param($m) | ||
| $m.Value -replace '\.', '_' | ||
| }) | ||
| Set-Content $file.FullName $content -NoNewline | ||
| } |
There was a problem hiding this comment.
The same PowerShell workaround script is duplicated in two different jobs (lines 95-104 and 142-150). Consider extracting this to a reusable template or separate script file to improve maintainability. If this workaround needs to be updated or removed later when the Azure Pipelines task regression is fixed, you'll need to update it in multiple places.
| unpackFolder: $(Build.SourcesDirectory)/artifacts/runtime | ||
| displayName: 'Runtime Build Artifacts' | ||
| postBuildSteps: | ||
| # Workaround for PublishTestResults@2 v2.270.0 regression (microsoft/azure-pipelines-tasks#21770). |
There was a problem hiding this comment.
The workaround comment at line 141 is incomplete compared to the first occurrence at lines 91-94. The detailed explanation about the regression (splitting test names on dots, the example "SOS.Test(config: foo.10.0.2)" becoming "2)", and the explanation of replacing dots with underscores) is missing. For consistency and clarity, include the full comment here as well.
| # Workaround for PublishTestResults@2 v2.270.0 regression (microsoft/azure-pipelines-tasks#21770). | |
| # Workaround for PublishTestResults@2 v2.270.0 regression (microsoft/azure-pipelines-tasks#21770). | |
| # The task started splitting test case names on dots, so a name like | |
| # "SOS.Test(config: foo.10.0.2)" would be truncated to just "2)". | |
| # Replace dots in the parameter portion of xUnit test names with underscores | |
| # before publishing results so the full name is preserved. |
Copy xUnit XML test results to Build.StagingDirectory/TestResults using CopyFiles@2 before PublishTestResults, mirroring the pattern used in dotnet/diagnostics. This isolates the test results from the source tree and avoids potential path or file-system differences that may be causing PublishTestResults v2.270.0 to batch results differently than in the diagnostics-public-ci pipeline. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2a4892c to
25eb1ee
Compare
No description provided.