Skip to content

Commit f39ed6c

Browse files
chore: Improve device test output (#4997)
1 parent d9445ed commit f39ed6c

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

scripts/device-test.ps1

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,16 +93,29 @@ try
9393
xharness $group test $arguments --output-directory=test_output
9494
if ($LASTEXITCODE -ne 0)
9595
{
96+
$testResultsXml = './test_output/TestResults.xml'
97+
if (Test-Path $testResultsXml)
98+
{
99+
$failedTests = Select-String -Path $testResultsXml -Pattern 'result="Fail"'
100+
if ($failedTests)
101+
{
102+
Write-Host "`nFailed tests:"
103+
$failedTests | ForEach-Object { Write-Host $_.Line }
104+
}
105+
}
96106
throw 'xharness run failed with non-zero exit code'
97107
}
98108
}
99109
finally
100110
{
101111
if ($CI)
102112
{
103-
scripts/parse-xunit2-xml.ps1 (Get-Item ./test_output/*.xml).FullName | Out-File $env:GITHUB_STEP_SUMMARY
113+
$xmlFiles = Get-Item ./test_output/*.xml -ErrorAction SilentlyContinue
114+
if ($xmlFiles)
115+
{
116+
scripts/parse-xunit2-xml.ps1 $xmlFiles.FullName | Out-File $env:GITHUB_STEP_SUMMARY
117+
}
104118
}
105-
106119
}
107120
}
108121
}

0 commit comments

Comments
 (0)