1
1
# Script to simplify AppVeyor configuration and resolve path to tools
2
2
3
+ $stopwatch = [Diagnostics.Stopwatch ]::StartNew()
4
+ [array ]$timings = @ ()
5
+
3
6
# Test Runner framework being used for embedded tests
4
7
$CS_RUNNER = " nunit3-console"
5
8
@@ -25,6 +28,17 @@ $PY = Get-Command python
25
28
$CS_TESTS = " .\src\embed_tests\bin\Python.EmbeddingTest.dll"
26
29
$RUNTIME_DIR = " .\src\runtime\bin\"
27
30
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
+
28
42
# Run python tests with C# coverage
29
43
Write-Host (" Starting Python tests" ) - ForegroundColor " Green"
30
44
.$OPENCOVER - register:user - searchdirs:" $RUNTIME_DIR " - output:py.coverage `
@@ -33,6 +47,9 @@ Write-Host ("Starting Python tests") -ForegroundColor "Green"
33
47
$PYTHON_STATUS = $LastExitCode
34
48
if ($PYTHON_STATUS -ne 0 ) {
35
49
Write-Host " Python tests failed, continuing to embedded tests" - ForegroundColor " Red"
50
+ ReportTime " "
51
+ } else {
52
+ ReportTime " Python tests completed"
36
53
}
37
54
38
55
# Run Embedded tests with C# coverage
@@ -44,7 +61,10 @@ Write-Host ("Starting embedded tests") -ForegroundColor "Green"
44
61
$CS_STATUS = $LastExitCode
45
62
if ($CS_STATUS -ne 0 ) {
46
63
Write-Host " Embedded tests failed" - ForegroundColor " Red"
64
+ ReportTime " "
47
65
} else {
66
+ ReportTime " Embedded tests completed"
67
+
48
68
# NuGet for pythonnet-2.3 only has 64-bit binary for Python 3.5
49
69
# the test is only built using modern stack
50
70
if (($env: PLATFORM -eq " x64" ) -and ($XPLAT ) -and ($env: PYTHON_VERSION -eq " 3.5" )) {
@@ -60,6 +80,9 @@ if ($CS_STATUS -ne 0) {
60
80
$CS_PERF_STATUS = $LastExitCode
61
81
if ($CS_PERF_STATUS -ne 0 ) {
62
82
Write-Host " Performance tests (C#) failed" - ForegroundColor " Red"
83
+ ReportTime " "
84
+ } else {
85
+ ReportTime " Performance tests (C#) completed"
63
86
}
64
87
} else {
65
88
Write-Host (" Skipping performance tests for " , $env: PYTHON_VERSION ) - ForegroundColor " Yellow"
@@ -82,9 +105,14 @@ if ($XPLAT){
82
105
$CS_STATUS = $LastExitCode
83
106
if ($CS_STATUS -ne 0 ) {
84
107
Write-Host " Embedded tests for netcoreapp2.0 failed" - ForegroundColor " Red"
108
+ ReportTime " "
109
+ } else {
110
+ ReportTime " .NET Core 2.0 tests completed"
85
111
}
86
112
}
87
113
114
+ Write-Host ($timings | Format-Table | Out-String )
115
+
88
116
# Set exit code to fail if either Python or Embedded tests failed
89
117
if ($PYTHON_STATUS -ne 0 -or $CS_STATUS -ne 0 -or $CS_PERF_STATUS -ne 0 ) {
90
118
Write-Host " Tests failed" - ForegroundColor " Red"
0 commit comments