Skip to content

Commit

Permalink
publish-test-results.yml: Added additional error messages to fail the…
Browse files Browse the repository at this point in the history
… build with
  • Loading branch information
NightOwl888 committed Apr 30, 2024
1 parent 36db76a commit 8a89fdd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions .build/azure-templates/publish-test-results.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ steps:
if ($inRunInfos -and !$crashed -and $reader.Name -eq 'Text') {
$innerXml = $reader.ReadInnerXml()
# Test for specific error messages - we may need to adjust this, as needed
if ($innerXml -and ($innerXml.Contains('Test host process crashed') -or $innerXml.Contains('Could not load file or assembly'))) {
if ($innerXml -and ($innerXml.Contains('Test host process crashed') `
-or $innerXml.Contains('Could not load file or assembly') `
-or $innerXml.Contains("Could not find `'dotnet.exe`' host") `
-or $innerXml.Contains('No test is available') `
-or $innerXml.Contains('exited with error'))) {
Write-Host "##vso[task.setvariable variable=HostCrashed;]true"
# Report all of the test projects that crashed
$crashedRuns = "$env:CRASHEDRUNS,$testProjectName".TrimStart(',')
Expand Down Expand Up @@ -104,4 +108,4 @@ steps:
testResultsFormat: ${{ parameters.testResultsFormat }}
testResultsFiles: '$(Build.ArtifactStagingDirectory)/${{ parameters.testResultsArtifactName }}/${{ parameters.osName }}/${{ parameters.framework }}/${{ parameters.vsTestPlatform }}/${{ parameters.testProjectName }}/${{ parameters.testResultsFileName }}'
testRunTitle: '${{ parameters.testProjectName }} - ${{ parameters.framework }} - ${{ parameters.vsTestPlatform }} - ${{ parameters.osName }} | $(TestResults)'
condition: and(succeeded(), eq(variables['TestResultsFileExists'], 'true'))
condition: and(succeeded(), eq(variables['TestResultsFileExists'], 'true'))

0 comments on commit 8a89fdd

Please sign in to comment.