Skip to content

Commit

Permalink
Use Start-Process cmdlet for launching tests
Browse files Browse the repository at this point in the history
Also don't exit immediately on test failure, wait for all tests to
complete.
  • Loading branch information
PeterBowman committed May 14, 2017
1 parent 35540fc commit 0244c68
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ after_build:
- cmd: set YARP_DATA_DIRS=%APPVEYOR_BUILD_FOLDER%\install\share\rd

before_test:
- cmd: echo %PATH%
- cmd: set TEST_PATH=%APPVEYOR_BUILD_FOLDER%\build\bin\%CONFIGURATION%
- cmd: set TEST_FRAMEWORK=Google Test
- ps: Write-Host "$env:PATH"
- ps: $testPath = "$env:APPVEYOR_BUILD_FOLDER\build\bin\$env:CONFIGURATION"
- ps: $testFramework = "Google Test"
- ps: >-
$tests = @(
"testDeadState",
Expand All @@ -174,17 +174,20 @@ before_test:
)
- ps: >-
foreach ($test in $tests) {
Add-AppveyorTest -Name "$test" -Framework "$env:TEST_FRAMEWORK" -FileName "$test.exe" -Outcome None
Add-AppveyorTest -Name "$test" -Framework "$testFramework" -FileName "$test.exe" -Outcome None
}
- ps: $testsHavePassed = $true

test_script:
- ps: >-
foreach ($test in $tests) {
Update-AppveyorTest -Name "$test" -Framework "$env:TEST_FRAMEWORK" -FileName "$test.exe" -Outcome Running
$date1 = Get-Date
& "$env:TEST_PATH\$test.exe"
$date2 = Get-Date
$duration = [long](New-TimeSpan -Start $date1 -End $date2).TotalMilliseconds
$outcome = If ($LASTEXITCODE -eq 0) {"Passed"} Else {"Failed"}
Update-AppveyorTest -Name "$test" -Framework "$env:TEST_FRAMEWORK" -FileName "$test.exe" -Outcome "$outcome" -Duration $duration
Update-AppveyorTest -Name "$test" -Framework "$testFramework" -FileName "$test.exe" -Outcome Running
$process = Start-Process "$test.exe" -WorkingDirectory "$testPath" -NoNewWindow -Wait -PassThru
$duration = [long](New-TimeSpan -Start $process.StartTime -End $process.ExitTime).TotalMilliseconds
$outcome = If ($process.ExitCode -eq 0) { "Passed" } Else { "Failed" }
Update-AppveyorTest -Name "$test" -Framework "$testFramework" -FileName "$test.exe" -Outcome "$outcome" -Duration $duration
$testsHavePassed = $testsHavePassed -And ($process.ExitCode -eq 0)
}
after_test:
- ps: If (-Not $testsHavePassed) { exit 1 }

0 comments on commit 0244c68

Please sign in to comment.