Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions eng/pipelines/cdac/prepare-cdac-stress-helix-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# prepare-cdac-stress-helix-steps.yml - Steps for preparing cDAC stress test Helix payloads.
#
# Used by CdacDumpTests stage in runtime-diagnostics.yml.
# Handles: building stress test debuggees, preparing Helix payload, finding testhost.

steps:
- script: $(Build.SourcesDirectory)$(dir).dotnet$(dir)dotnet$(exeExt) msbuild
$(Build.SourcesDirectory)/src/native/managed/cdac/tests/StressTests/Microsoft.Diagnostics.DataContractReader.StressTests.csproj
/t:BuildDebuggeesOnly
/p:Configuration=$(_BuildConfig)
/p:TargetArchitecture=$(archType)
-bl:$(Build.SourcesDirectory)/artifacts/log/BuildStressDebuggees.binlog
displayName: 'Build Stress Debuggees'

- script: $(Build.SourcesDirectory)$(dir).dotnet$(dir)dotnet$(exeExt) build
$(Build.SourcesDirectory)/src/native/managed/cdac/tests/StressTests/Microsoft.Diagnostics.DataContractReader.StressTests.csproj
/p:PrepareHelixPayload=true
/p:Configuration=$(_BuildConfig)
/p:HelixPayloadDir=$(Build.SourcesDirectory)/artifacts/helixPayload/cdac-stress
-bl:$(Build.SourcesDirectory)/artifacts/log/StressTestPayload.binlog
displayName: 'Prepare Stress Test Helix Payload'

- pwsh: |
$testhostDir = Get-ChildItem -Directory -Path "$(Build.SourcesDirectory)/artifacts/bin/testhost/net*-$(osGroup)-*-$(archType)" | Select-Object -First 1 -ExpandProperty FullName
if (-not $testhostDir) {
Write-Error "No testhost directory found"
exit 1
}
Write-Host "TestHost root: $testhostDir"
Write-Host "##vso[task.setvariable variable=StressTestHostRootDir]$testhostDir"

$queue = switch ("$(osGroup)_$(archType)") {
"windows_x64" { "$(helix_windows_x64)" }
"windows_x86" { "$(helix_windows_x64)" }
"windows_arm64" { "$(helix_windows_arm64)" }
"linux_x64" { "$(helix_linux_x64_oldest)" }
"linux_arm64" { "$(helix_linux_arm64_oldest)" }
"linux_arm" { "$(helix_linux_arm32_oldest)" }
"osx_x64" { "$(helix_macos_x64)" }
"osx_arm64" { "$(helix_macos_arm64)" }
default { Write-Error "Unsupported platform: $(osGroup)_$(archType)"; exit 1 }
}
Write-Host "Helix queue: $queue"
Write-Host "##vso[task.setvariable variable=CdacStressHelixQueue]$queue"
displayName: 'Find Stress TestHost and Helix Queue'
12 changes: 11 additions & 1 deletion eng/pipelines/runtime-diagnostics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ extends:
shouldContinueOnError: true
jobParameters:
nameSuffix: CdacDumpTest
buildArgs: -s clr+libs+tools.cdac+tools.cdacdumptests -c $(_BuildConfig) -rc checked -lc $(_BuildConfig) /p:SkipDumpVersions=net10.0
buildArgs: -s clr+libs+tools.cdac+tools.cdacdumptests+tools.cdacstresstests -c $(_BuildConfig) -rc checked -lc $(_BuildConfig) /p:SkipDumpVersions=net10.0
timeoutInMinutes: 180
postBuildSteps:
- template: /eng/pipelines/cdac/prepare-cdac-helix-steps.yml
Expand All @@ -286,6 +286,16 @@ extends:
displayName: 'Publish Dump Artifacts'
condition: and(always(), ne(variables['Agent.JobStatus'], 'Succeeded'))
continueOnError: true
# cDAC Stress Tests — run GC stress verification on the same Checked build
- template: /eng/pipelines/cdac/prepare-cdac-stress-helix-steps.yml
- template: /eng/pipelines/common/templates/runtimes/send-to-helix-inner-step.yml
parameters:
displayName: 'Send cDAC Stress Tests to Helix'
sendParams: $(Build.SourcesDirectory)/src/native/managed/cdac/tests/StressTests/cdac-stress-helix.proj /t:Test /p:TargetOS=$(osGroup) /p:TargetArchitecture=$(archType) /p:HelixTargetQueues="$(CdacStressHelixQueue)" /p:TestHostPayload=$(StressTestHostRootDir) /p:StressTestsPayload=$(Build.SourcesDirectory)/artifacts/helixPayload/cdac-stress /bl:$(Build.SourcesDirectory)/artifacts/log/SendStressToHelix.binlog
environment:
_Creator: dotnet-bot
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
NUGET_PACKAGES: $(Build.SourcesDirectory)$(dir).packages
- pwsh: |
if ("$(Agent.JobStatus)" -ne "Succeeded") {
Write-Error "One or more cDAC dump test failures were detected. Failing the job."
Expand Down

This file was deleted.

63 changes: 63 additions & 0 deletions src/native/managed/cdac/tests/StressTests/BasicCdacStressTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Generic;
using System.Runtime.InteropServices;
using Microsoft.DotNet.XUnitExtensions;
using Xunit;
using Xunit.Abstractions;

namespace Microsoft.Diagnostics.DataContractReader.Tests.GCStress;

/// <summary>
/// Runs each debuggee app under corerun with DOTNET_CdacStress=0x51 and asserts
/// that the cDAC stack reference verification achieves 100% pass rate.
/// </summary>
/// <remarks>
/// Prerequisites:
/// - Build CoreCLR native + cDAC: build.cmd -subset clr.native+tools.cdac -c Debug -rc Checked -lc Release
/// - Generate core_root: src\tests\build.cmd Checked generatelayoutonly /p:LibrariesConfiguration=Release
/// - Build debuggees: dotnet build this test project
///
/// The tests use CORE_ROOT env var if set, otherwise default to the standard artifacts path.
/// </remarks>
public class BasicStressTests : CdacStressTestBase
{
public BasicStressTests(ITestOutputHelper output) : base(output) { }

public static IEnumerable<object[]> Debuggees =>
[
["BasicAlloc"],
["DeepStack"],
["Generics"],
["MultiThread"],
["Comprehensive"],
["ExceptionHandling"],
["StructScenarios"],
["DynamicMethods"],
];

public static IEnumerable<object[]> WindowsOnlyDebuggees =>
[
["PInvoke"],
];

[Theory]
[MemberData(nameof(Debuggees))]
public void GCStress_AllVerificationsPass(string debuggeeName)
{
CdacStressResults results = RunGCStress(debuggeeName);
AssertAllPassed(results, debuggeeName);
}

[Theory]
[MemberData(nameof(WindowsOnlyDebuggees))]
public void GCStress_WindowsOnly_AllVerificationsPass(string debuggeeName)
{
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
throw new SkipTestException("P/Invoke debuggee uses kernel32.dll (Windows only)");

CdacStressResults results = RunGCStress(debuggeeName);
AssertAllPassed(results, debuggeeName);
}
}
Loading
Loading