Skip to content

Commit 3daa4c7

Browse files
Detect tests errors
1 parent 636d67a commit 3daa4c7

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

appveyor.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,38 @@ build:
2323
test_script:
2424
- ps: >-
2525
Invoke-Command -ScriptBlock {
26+
$TestsFailed = $FALSE
2627
#netFx tests
2728
If ($env:TESTS -eq 'net') {
2829
@('EnyimMemcached', 'Prevalence', 'RtMemoryCache', 'SysCache', 'SysCache2', 'CoreMemoryCache') | ForEach-Object {
2930
nunit3-console (Join-Path $env:APPVEYOR_BUILD_FOLDER "$_\NHibernate.Caches.$_.Tests\bin\$env:CONFIGURATION\$env:NETTARGETFX\NHibernate.Caches.$_.Tests.dll") "--result=$_-NetTestResult.xml;format=AppVeyor"
31+
If ($LASTEXITCODE -ne 0) {
32+
$TestsFailed = $TRUE
33+
}
3034
}
3135
}
3236
3337
#core tests
3438
If ($env:TESTS -eq 'core') {
3539
@('CoreMemoryCache') | ForEach-Object {
3640
dotnet (Join-Path $env:APPVEYOR_BUILD_FOLDER "$_\NHibernate.Caches.$_.Tests\bin\$env:CONFIGURATION\$env:CORETARGETFX\NHibernate.Caches.$_.Tests.dll") --labels=before --nocolor "--result=$_-CoreTestResult.xml"
41+
If ($LASTEXITCODE -ne 0) {
42+
$TestsFailed = $TRUE
43+
}
3744
}
3845
}
39-
}
40-
after_test:
41-
- ps: >-
42-
Invoke-Command -ScriptBlock {
46+
4347
$wc = New-Object 'System.Net.WebClient'
4448
4549
#core tests (others are real-time reported)
4650
Get-Item '*-CoreTestResult.xml' | ForEach-Object {
4751
$wc.UploadFile("https://ci.appveyor.com/api/testresults/nunit3/$($env:APPVEYOR_JOB_ID)", $_)
4852
}
53+
54+
If ($TestsFailed) {
55+
Write-Host 'Tests have failed' -foregroundcolor 'white' -backgroundcolor 'red'
56+
exit 1
57+
}
4958
}
5059
on_finish:
5160
- ps: Stop-Process -Id $MemCached.Id

0 commit comments

Comments
 (0)