Skip to content
Merged
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
42 changes: 42 additions & 0 deletions eng/pipelines/templates/BuildAndTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,48 @@ steps:
"${{ parameters.buildScript }} -test -configuration ${{ parameters.buildConfig }} /bl:${{ parameters.repoLogPath }}/tests.binlog $(_OfficialBuildIdArgs)"
displayName: Run tests

- pwsh: |
$SourcesDirectory = '$(Build.SourcesDirectory)';

$destinationPath = "${{ parameters.repoLogPath }}/FailedAssertions"
if (-not (Test-Path -Path $destinationPath)) {
New-Item -Path $destinationPath -ItemType Directory -Force | Out-Null
}

Get-ChildItem $SourcesDirectory -Filter "*.received.*" -Recurse | `
ForEach-Object {
# Exclude files that are already in the test results path
if ($_.FullName -like "*FailedAssertions*") {
return
}

if ($_.PSIsContainer) {
# Delete the folder if it exists
$dest = Join-Path -Path $destinationPath -ChildPath $_.Name
if (Test-Path -Path $dest) {
Remove-Item -Path $dest -Recurse -Force
}
# Copy folder to logs
Copy-Item -Path $_.FullName -Destination $destinationPath -Recurse -Force
}
else {
# Calculates the relative path of the file with respect to `$SourcesDirectory`.
$relativePath = [System.IO.Path]::GetRelativePath($SourcesDirectory, $_.FullName)
# Constructs the full destination path for the file, preserving the relative directory structure.
$destinationFile = Join-Path -Path $destinationPath -ChildPath $relativePath
$destinationDirectory = [System.IO.Path]::GetDirectoryName($destinationFile)
# Ensures the destination directory exists (creates it if necessary).
if (-not (Test-Path -Path $destinationDirectory)) {
New-Item -Path $destinationDirectory -ItemType Directory -Force | Out-Null
}
# Copies the file to the destination path.
Copy-Item -Path $_.FullName -Destination $destinationFile -Force
}
}
displayName: Copy failed assertions results to logs
condition: always()
continueOnError: true

- pwsh: |
Get-ChildItem ${{ parameters.repoTestResultsPath }} -Include "*_hangdump.dmp","Sequence_*.xml" -Recurse | `
ForEach-Object {
Expand Down
Loading