Skip to content

Commit 3a33612

Browse files
committed
Temporary
1 parent 875471c commit 3a33612

File tree

4 files changed

+62
-1
lines changed

4 files changed

+62
-1
lines changed
148 KB
Binary file not shown.

StartDumpAsync.ps1

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
param($Delay = 30)
2+
3+
Import-Module "$PSScriptRoot/Microsoft.Diagnostics.NETCore.Client.dll"
4+
5+
6+
$dir = "$PSScriptRoot/dumps"
7+
8+
9+
$processes = Get-Process -Name "dotnet" -ErrorAction Ignore
10+
11+
if (-not $processes) {
12+
Set-Content -Path "$dir/output.txt" -Value "No dotnet processes found".
13+
}
14+
15+
Start-Sleep -Duration ([TimeSpan]::FromMinutes($Delay))
16+
17+
New-Item -ItemType Directory -Path $dir -Force -ErrorAction Ignore
18+
foreach ($process in $processes) {
19+
$name = "$($process.Id)_$($process.Name)"
20+
21+
Set-Content -Path "$dir/$name.txt" -Value "Dumping $name"
22+
23+
try {
24+
$client = [Microsoft.Diagnostics.NETCore.Client.DiagnosticsClient]::new($process.Id);
25+
$fullPath = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("$dir/$name.dmp")
26+
$client.WriteDump("Normal", $fullPath);
27+
28+
try {
29+
$process.Kill()
30+
}
31+
catch {
32+
Add-Content -Path "$dir/$name.txt" -Value "$_"
33+
}
34+
}
35+
catch {
36+
Add-Content -Path "$dir/$name.txt" -Value "$_"
37+
}
38+
}
39+
40+
41+
42+

azure-pipelines.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,14 @@ stages:
266266
# Because the build step is using -ci flag, restore is done in a local .packages directory.
267267
# We need to pass NUGET_PACKAGES so that when dotnet test is doing evaluation phase on the projects, it can resolve .props/.targets from packages and import them.
268268
# Otherwise, props/targets are not imported. It's important that they are imported so that IsTestingPlatformApplication ends up being set.
269-
- script: dotnet test --solution NonWindowsTests.slnf -c $(_BuildConfig) --no-build -bl:$(BUILD.SOURCESDIRECTORY)/artifacts/TestResults/$(_BuildConfig)/TestStep.binlog --no-progress -p:UsingDotNetTest=true
269+
- task: PowerShell@2
270270
name: Test
271271
displayName: Test
272+
inputs:
273+
targetType: filePath
274+
filePath: './run.ps1'
275+
failOnStderr: true
276+
showWarnings: true
272277
env:
273278
DOTNET_ROOT: $(Build.SourcesDirectory)/.dotnet
274279
NUGET_PACKAGES: $(Build.SourcesDirectory)/.packages
@@ -281,6 +286,13 @@ stages:
281286
ArtifactName: TestResults_MacOs_$(_BuildConfig)_Attempt$(System.JobAttempt)
282287
condition: always()
283288

289+
- task: PublishBuildArtifacts@1
290+
displayName: 'Publish Dumps'
291+
inputs:
292+
PathtoPublish: '$(Build.SourcesDirectory)/dumps'
293+
ArtifactName: TestResults_MacOs_$(_BuildConfig)_Attempt$(System.JobAttempt)_Dumps
294+
condition: always()
295+
284296
- task: CopyFiles@2
285297
displayName: 'Copy binlogs'
286298
inputs:

run.ps1

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
$delay = 0.1 # 6 seconds
2+
3+
$j = Start-Job { $global:PSScriptRoot = $using:PSScriptRoot; . $PSScriptRoot/StartDumpAsync.ps1 -Delay $using:Delay }
4+
5+
dotnet test --solution NonWindowsTests.slnf --no-build -bl:$PSScriptRoot/artifacts/TestResults/Debug/TestStep.binlog --no-progress -p:UsingDotNetTest=true
6+
7+
$j | Receive-Job

0 commit comments

Comments
 (0)