@@ -50,26 +50,37 @@ $testLogs = Join-Path $ArtifactStagingFolder test_logs
5050
5151$globalJson = Get-Content $PSScriptRoot / ../ global.json | ConvertFrom-Json
5252$isMTP = $globalJson.test.runner -eq ' Microsoft.Testing.Platform'
53+ $extraArgs = @ ()
54+ $failedTests = 0
55+
5356if ($isMTP ) {
54- $extraArgs = @ ()
5557 if ($OnCI ) { $extraArgs += ' --no-progress' }
58+
59+ $dumpSwitches = @ (
60+ , ' --hangdump'
61+ , ' --hangdump-timeout' , ' 120s'
62+ , ' --crashdump'
63+ )
64+ $mtpArgs = @ (
65+ , ' --coverage'
66+ , ' --coverage-output-format' , ' cobertura'
67+ , ' --diagnostic'
68+ , ' --diagnostic-output-directory' , $testLogs
69+ , ' --diagnostic-verbosity' , ' Information'
70+ , ' --results-directory' , $testLogs
71+ , ' --report-trx'
72+ )
73+
5674 & $dotnet test -- solution $RepoRoot `
5775 -- no- build `
5876 - c $Configuration `
5977 - bl:" $testBinLog " `
6078 -- filter- not- trait ' TestCategory=FailsInCloudTest' `
61- -- coverage `
62- -- coverage- output- format cobertura `
6379 -- coverage- settings " $PSScriptRoot /test.runsettings" `
64- -- hangdump `
65- -- hangdump- timeout 60s `
66- -- crashdump `
67- -- diagnostic `
68- -- diagnostic- output- directory $testLogs `
69- -- diagnostic- verbosity Information `
70- -- results- directory $testLogs `
71- -- report- trx `
80+ @mtpArgs `
81+ @dumpSwitches `
7282 @extraArgs
83+ if ($LASTEXITCODE -ne 0 ) { $failedTests += 1 }
7384
7485 $trxFiles = Get-ChildItem - Recurse - Path $testLogs \* .trx
7586} else {
@@ -84,15 +95,17 @@ if ($isMTP) {
8495 -- blame- crash `
8596 - bl:" $testBinLog " `
8697 -- diag " $testDiagLog ;TraceLevel=info" `
87- -- logger trx
98+ -- logger trx `
99+ @extraArgs
100+ if ($LASTEXITCODE -ne 0 ) { $failedTests += 1 }
88101
89102 $trxFiles = Get-ChildItem - Recurse - Path $RepoRoot \test\* .trx
90103}
91104
92105$unknownCounter = 0
93106$trxFiles | % {
94107 New-Item $testLogs - ItemType Directory - Force | Out-Null
95- if (! ($_.FullName.StartsWith ($testLogs ))) {
108+ if (! ($_.FullName.StartsWith ($testLogs , [ StringComparison ]::OrdinalIgnoreCase ))) {
96109 Copy-Item $_ - Destination $testLogs
97110 }
98111
@@ -117,3 +130,7 @@ $trxFiles |% {
117130 Write-Host " ##vso[results.publish type=VSTest;runTitle=$runTitle ;publishRunAttachments=true;resultFiles=$_ ;failTaskOnFailedTests=true;testRunSystem=VSTS - PTR;]"
118131 }
119132}
133+
134+ if ($failedTests -ne 0 ) {
135+ exit $failedTests
136+ }
0 commit comments