Skip to content

[cDAC] Publish cDAC stress test logs as an ADO pipeline artifact#129759

Closed
max-charlamb wants to merge 1 commit into
dotnet:mainfrom
max-charlamb:cdac-stress-publish-logs
Closed

[cDAC] Publish cDAC stress test logs as an ADO pipeline artifact#129759
max-charlamb wants to merge 1 commit into
dotnet:mainfrom
max-charlamb:cdac-stress-publish-logs

Conversation

@max-charlamb

Copy link
Copy Markdown
Member

Summary

The cDAC GC stress tests in the runtime-diagnostics pipeline write rich per-debuggee verification logs (cDAC GetStackReferences vs the runtime GC-root oracle) to HELIX_WORKITEM_UPLOAD_ROOT. That location only uploads to Helix blob storage, so the ADO build UI only surfaced the xUnit pass/fail plus the assert text -- the full comparison output was effectively invisible, making failing runs hard to triage.

Helix and ADO are separate systems; the only automatic bridge is the test-results reporter (testResults.xml -> ADO Tests tab). Getting arbitrary files into ADO requires explicitly pulling them back to the agent (DownloadFilesFromResults) and publishing them (PublishPipelineArtifact) -- which the stress leg omitted but the sibling dump leg already does.

Changes

  • CdacStressTestBase.cs -- write per-debuggee logs into a dedicated cdac-stress-logs subdirectory of the upload root, so the work item can archive a clean directory without self-including the tarball or testResults.xml.
  • cdac-stress-helix.proj -- convert the work item command to a command-file (matching cdac-dump-helix.proj): run xUnit, capture the exit code, tar the logs into a known-named cdac-stress-logs.tar.gz, then re-apply the test exit code (archive failures stay non-fatal). Declare the tarball via DownloadFilesFromResults (exact names only -- no wildcard support -- hence a single archive).
  • runtime-diagnostics.yml (CdacStressTest leg) -- publish artifacts/helixresults (the default HelixResultsDestinationDir) as a pipeline artifact, condition: always().

Validation

  • StressTests project compiles (0 warnings / 0 errors).
  • cdac-stress-helix.proj XML and runtime-diagnostics.yml parse cleanly.
  • Local run confirms the harness writes logs into the new cdac-stress-logs subdirectory.
  • The tar/download/publish path runs only on Helix, but is a direct copy of the proven dump-leg mechanism. CI on this PR exercises it end-to-end.

Note

This PR description and the code changes were generated with the assistance of GitHub Copilot.

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

This PR improves diagnosability of cDAC GC stress runs by making the rich per-debuggee verification logs visible in Azure DevOps: logs are written into a dedicated Helix upload subdirectory, archived into a single tarball for DownloadFilesFromResults, and then published as an ADO pipeline artifact.

Changes:

  • Write stress verification logs to $(HELIX_WORKITEM_UPLOAD_ROOT)/cdac-stress-logs (or local temp fallback) and ensure the directory exists.
  • Update the Helix work item command to run xUnit, tar the log directory into cdac-stress-logs.tar.gz, and download that tarball from Helix results.
  • Publish artifacts/helixresults as a pipeline artifact in the CdacStressTest leg with condition: always().

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/native/managed/cdac/tests/StressTests/CdacStressTestBase.cs Routes stress logs into a dedicated cdac-stress-logs directory and creates it up front.
src/native/managed/cdac/tests/StressTests/cdac-stress-helix.proj Switches to a command-file-style work item command, archives logs into a known tarball name, and declares it for DownloadFilesFromResults.
eng/pipelines/runtime-diagnostics.yml Publishes artifacts/helixresults as an ADO pipeline artifact for the stress leg on all outcomes.

Comment on lines +44 to +46
string logRoot = Environment.GetEnvironmentVariable("HELIX_WORKITEM_UPLOAD_ROOT")
?? Path.GetTempPath();
string logDir = Path.Combine(logRoot, "cdac-stress-logs");
Comment on lines +62 to +65
The command is built as a list of lines written to a command file (following
cdac-dump-helix.proj). xUnit runs first; its exit code is captured before the
archive step (which always succeeds) and re-applied afterwards so a tar failure
can't mask — or fabricate — a test failure.
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag
See info in area-owners.md if you want to be subscribed.

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

Comment on lines +91 to +100
function Add-Attachment([string]$uri, [string]$fileName, [string]$filePath) {
$bytes = [System.IO.File]::ReadAllBytes($filePath)
$body = @{
stream = [System.Convert]::ToBase64String($bytes)
fileName = $fileName
attachmentType = 'GeneralAttachment'
comment = 'cDAC GC stress verification log'
} | ConvertTo-Json
Invoke-RestMethod -Headers ($headers + @{ 'Content-Type' = 'application/json' }) -Uri $uri -Method Post -Body $body | Out-Null
}
Comment on lines +48 to +50
function Write-Info($msg) { Write-Host "[attach-cdac-stress-logs] $msg" }
function Write-Warn($msg) { Write-Host "##[warning][attach-cdac-stress-logs] $msg" }

Comment thread eng/pipelines/runtime-diagnostics.yml Outdated
Comment on lines +286 to +292
& $(Build.SourcesDirectory)/eng/pipelines/cdac/attach-cdac-stress-logs.ps1 `
-CollectionUri "$(System.CollectionUri)" `
-TeamProject "$(System.TeamProject)" `
-BuildId "$(Build.BuildId)" `
-AccessToken "$(System.AccessToken)" `
-RunNamePrefix "cDAC Stress $(osGroup) $(archType) - " `
-HelixResultsDir "$(Build.SourcesDirectory)/artifacts/helixresults"
Comment on lines 66 to 69
Testhost layout: dotnet.exe at the root, CoreCLR + corerun + mscordaccore_universal
under shared/Microsoft.NETCore.App/<version>/. CORE_ROOT must point at the inner
version directory so the test harness finds corerun.exe as a sibling of coreclr.dll
(matches what CdacStressTestBase.GetCoreRunPath expects).
Comment on lines +71 to +74
The command is built as a list of lines written to a command file (following
cdac-dump-helix.proj). xUnit runs first; its exit code is captured before the
archive step (which always succeeds) and re-applied afterwards so a tar failure
can't mask — or fabricate — a test failure.
@max-charlamb max-charlamb force-pushed the cdac-stress-publish-logs branch from 9343d2a to 7b2cd86 Compare June 24, 2026 18:28
When the cDAC GC stress work item fails, echo the per-debuggee verification logs to
the work item's console log so the cDAC-vs-runtime comparison is readable from the
test's Helix console-log link -- the same channel the other runtime-diagnostics legs
use for diagnostics. The harness already uploads the logs to
HELIX_WORKITEM_UPLOAD_ROOT; this just surfaces them inline on a failing run without
adding any pipeline code.

xUnit's exit code is captured before the (always-succeeding) log dump and re-applied
afterwards, so dumping logs cannot mask or fabricate a test result.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 24, 2026 18:50
@max-charlamb max-charlamb force-pushed the cdac-stress-publish-logs branch from 7b2cd86 to 9f357f7 Compare June 24, 2026 18:50

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.

Comment on lines +95 to +96
<_HelixCommandLines Condition="'$(TargetOS)' == 'windows'"
Include="if %25test_exit_code%25 NEQ 0 type %25HELIX_WORKITEM_UPLOAD_ROOT%25\cdac-gcstress-*.txt" />
Comment on lines +97 to +98
<_HelixCommandLines Condition="'$(TargetOS)' != 'windows'"
Include="if [ %24test_exit_code -ne 0 ]%3B then echo '===== cDAC stress verification logs ====='%3B for f in %24HELIX_WORKITEM_UPLOAD_ROOT/cdac-gcstress-*.txt%3B do echo &quot;--- %24f ---&quot;%3B cat &quot;%24f&quot;%3B done%3B fi" />
Comment on lines 113 to 117
<HelixWorkItem Include="CdacStressTests">
<PayloadDirectory>$(StressTestsPayload)</PayloadDirectory>
<Command>$(_StressTestCommand)</Command>
<Command>$([System.IO.File]::ReadAllText('$(_HelixCommandFile)'))</Command>
<Timeout>$(WorkItemTimeout)</Timeout>
</HelixWorkItem>
@max-charlamb

Copy link
Copy Markdown
Member Author

Abandoning this approach; superseding with a focused change.

@max-charlamb max-charlamb deleted the cdac-stress-publish-logs branch June 24, 2026 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants