11# Script to simplify AppVeyor configuration and resolve path to tools
22
3+ $stopwatch = [Diagnostics.Stopwatch ]::StartNew()
4+ [array ]$timings = @ ()
5+
36# Test Runner framework being used for embedded tests
47$CS_RUNNER = " nunit3-console"
58
@@ -25,6 +28,17 @@ $PY = Get-Command python
2528$CS_TESTS = " .\src\embed_tests\bin\Python.EmbeddingTest.dll"
2629$RUNTIME_DIR = " .\src\runtime\bin\"
2730
31+ function ReportTime {
32+ param ([string ] $action )
33+
34+ $timeSpent = $stopwatch.Elapsed
35+ $timings += [pscustomobject ]@ {action = $action ; timeSpent = $timeSpent }
36+ Write-Host $action " in " $timeSpent - ForegroundColor " Green"
37+ $stopwatch.Restart ()
38+ }
39+
40+ ReportTime " Preparation done"
41+
2842# Run python tests with C# coverage
2943Write-Host (" Starting Python tests" ) - ForegroundColor " Green"
3044.$OPENCOVER - register:user - searchdirs:" $RUNTIME_DIR " - output:py.coverage `
@@ -33,6 +47,9 @@ Write-Host ("Starting Python tests") -ForegroundColor "Green"
3347$PYTHON_STATUS = $LastExitCode
3448if ($PYTHON_STATUS -ne 0 ) {
3549 Write-Host " Python tests failed, continuing to embedded tests" - ForegroundColor " Red"
50+ ReportTime " "
51+ } else {
52+ ReportTime " Python tests completed"
3653}
3754
3855# Run Embedded tests with C# coverage
@@ -44,7 +61,10 @@ Write-Host ("Starting embedded tests") -ForegroundColor "Green"
4461$CS_STATUS = $LastExitCode
4562if ($CS_STATUS -ne 0 ) {
4663 Write-Host " Embedded tests failed" - ForegroundColor " Red"
64+ ReportTime " "
4765} else {
66+ ReportTime " Embedded tests completed"
67+
4868 # NuGet for pythonnet-2.3 only has 64-bit binary for Python 3.5
4969 # the test is only built using modern stack
5070 if (($env: PLATFORM -eq " x64" ) -and ($XPLAT ) -and ($env: PYTHON_VERSION -eq " 3.5" )) {
@@ -60,6 +80,9 @@ if ($CS_STATUS -ne 0) {
6080 $CS_PERF_STATUS = $LastExitCode
6181 if ($CS_PERF_STATUS -ne 0 ) {
6282 Write-Host " Performance tests (C#) failed" - ForegroundColor " Red"
83+ ReportTime " "
84+ } else {
85+ ReportTime " Performance tests (C#) completed"
6386 }
6487 } else {
6588 Write-Host (" Skipping performance tests for " , $env: PYTHON_VERSION ) - ForegroundColor " Yellow"
@@ -82,9 +105,14 @@ if ($XPLAT){
82105 $CS_STATUS = $LastExitCode
83106 if ($CS_STATUS -ne 0 ) {
84107 Write-Host " Embedded tests for netcoreapp2.0 failed" - ForegroundColor " Red"
108+ ReportTime " "
109+ } else {
110+ ReportTime " .NET Core 2.0 tests completed"
85111 }
86112}
87113
114+ Write-Host " Timings:" ($timings | Format-Table | Out-String ) - ForegroundColor " Green"
115+
88116# Set exit code to fail if either Python or Embedded tests failed
89117if ($PYTHON_STATUS -ne 0 -or $CS_STATUS -ne 0 -or $CS_PERF_STATUS -ne 0 ) {
90118 Write-Host " Tests failed" - ForegroundColor " Red"
0 commit comments