Skip to content

Commit

Permalink
publish-test-results.yml: Added check for assembly binding failure to…
Browse files Browse the repository at this point in the history
… detect crashed runs. See #699.
  • Loading branch information
NightOwl888 committed Oct 18, 2022
1 parent b5802f8 commit c18b9f1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
18 changes: 11 additions & 7 deletions .build/azure-templates/publish-test-results.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Licensed to the Apache Software Foundation (ASF) under one
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
Expand Down Expand Up @@ -73,12 +73,16 @@ steps:
if ($reader.Name -eq 'RunInfos') {
$inRunInfos = $true
}
if ($inRunInfos -and !$crashed -and $reader.Name -eq 'Text' -and $reader.ReadInnerXml().Contains('Test host process crashed')) {
Write-Host "##vso[task.setvariable variable=HostCrashed;]true"
# Report all of the test projects that crashed
$crashedRuns = "$env:CRASHEDRUNS,$testProjectName".TrimStart(',')
Write-Host "##vso[task.setvariable variable=CrashedRuns;]$crashedRuns"
$crashed = $true
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'))) {
Write-Host "##vso[task.setvariable variable=HostCrashed;]true"
# Report all of the test projects that crashed
$crashedRuns = "$env:CRASHEDRUNS,$testProjectName".TrimStart(',')
Write-Host "##vso[task.setvariable variable=CrashedRuns;]$crashedRuns"
$crashed = $true
}
}
}
if ($reader.NodeType -eq [System.Xml.XmlNodeType]::EndElement -and $reader.Name -eq 'RunInfos') {
Expand Down
3 changes: 2 additions & 1 deletion .build/azure-templates/run-tests-on-os.yml
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ steps:
- pwsh: |
$failed = $false
if ($env:HOSTCRASHED -eq 'true') {
Write-Host "##vso[task.logissue type=error;]Test host process(es) crashed: $($env:CRASHEDRUNS)."
$runsExpanded = "$($env:CRASHEDRUNS)" -replace ',',"`r`n"
Write-Host "##vso[task.logissue type=error;]Test host process(es) crashed, hung, or failed to load assemblies. Review the testresults artifacts for details. (click here to view the projects that failed)`r`n$runsExpanded"
$failed = $true
}
$maximumAllowedFailures = '${{ parameters.maximumAllowedFailures }}'
Expand Down

0 comments on commit c18b9f1

Please sign in to comment.