Skip to content

Commit

Permalink
Appveyor: Update test dashboard
Browse files Browse the repository at this point in the history
Upload results from testing to the Appveyor test dashboard.

Signed-off-by: Devin Nakamura <devinn@ca.ibm.com>
  • Loading branch information
dnakamura committed Jun 20, 2017
1 parent 81b4b49 commit 2bb9544
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ clone_depth: 1
environment:
GTEST_FILTER: '-*dump_test_create_dump_*:*NumaSetAffinity:*NumaSetAffinitySuspended:PortSysinfoTest.sysinfo_test0'
GTEST_COLOR: '1'
TEST_RESULT_DIR: '%APPVEYOR_BUILD_FOLDER%\test_results'
GTEST_OUTPUT: 'xml:%TEST_RESULT_DIR%\'

before_build:
- del "C:\Program Files (x86)\MSBuild\14.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets"
Expand All @@ -34,4 +36,6 @@ build:
parallel: true

test_script:
- cmd: mkdir %TEST_RESULT_DIR%
- cmd: ctest -V -C Debug
- ps: scripts\Appveyor-ProcessTests.ps1
31 changes: 31 additions & 0 deletions scripts/Appveyor-ProcessTests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

#TODO we need to add the error message (if applicable) to the output
function Process-Tests {
process {
$test_status = "None"
if($_.status -eq "run") {
if($_.failure) {
$test_status = "Failed"
} else {
$test_status = "Passed"
}
} elseif ($_.status -eq "notrun"){
$test_status = "Skipped"
}
New-Object psobject -Property @{
'name' = $_.ParentNode.name + "." + $_.name;
'status' = $test_status;
'time' = [long]([float]$_.time * 1000);
'classname' = $_.classname
}
}
}

# Writes test results to appveyor dashboard
function Upload-TestResults {
process {
Add-AppveyorTest -Name $_.name -Framework "xUnit" -FileName $_.classname -Outcome $_.status -Duration $_.time
}
}

$testResults = Select-Xml -Path "$env:TEST_RESULT_DIR\*.xml" //testcase | Select-Object -ExpandProperty Node | Process-Tests | Upload-TestResults

0 comments on commit 2bb9544

Please sign in to comment.