Skip to content

Commit 1081dd0

Browse files
Use vstest to test in parallel (#2390)
1 parent 102beae commit 1081dd0

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,5 @@ build/
2727

2828
# Temporary files
2929
exercises/**/*.tmp
30+
31+
msbuild.log

bin/test.ps1

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,16 @@ function Restore-Exercises($Exercises) {
7676
}
7777
}
7878

79+
function Parse-Test-Dlls {
80+
Select-String -Path "msbuild.log" -Pattern " -> (.+)" -AllMatches
81+
| Select-Object -ExpandProperty Matches
82+
| ForEach-Object { $_.Groups[1].Value }
83+
}
84+
7985
function Run-Tests($Path) {
80-
& dotnet restore --locked-mode $Path
81-
& dotnet test --no-restore $Path
86+
& dotnet restore --verbosity quiet --locked-mode $Path
87+
& dotnet build --verbosity quiet --no-restore $Path /flp:v=minimal
88+
& dotnet vstest --logger:"console;verbosity=quiet" --parallel $(Parse-Test-Dlls)
8289
}
8390

8491
function Find-Exercise-Path($Exercise, $Exercises) {
@@ -126,13 +133,13 @@ function Parse-Exercises {
126133

127134
function Build-Generators {
128135
Write-Output "Build generators"
129-
& dotnet restore --locked-mode generators
130-
& dotnet build --no-restore generators
136+
& dotnet restore --verbosity quiet --locked-mode generators
137+
& dotnet build --verbosity quiet --no-restore generators
131138
}
132139

133140
function Test-Refactoring-Exercise-Default-Implementations {
134141
Write-Output "Testing refactoring exercises"
135-
& dotnet test (Join-Path "exercises" "Refactoring.sln")
142+
Run-Tests (Join-Path "exercises" "Refactoring.sln")
136143
}
137144

138145
function Test-Exercise-Example-Implementations($Exercise) {
@@ -149,6 +156,6 @@ function Test-Exercise-Example-Implementations($Exercise) {
149156
Test-Exercise-Example-Implementations $Exercise
150157

151158
if (!$Exercise) {
152-
Build-Generators
153159
Test-Refactoring-Exercise-Default-Implementations
160+
Build-Generators
154161
}

0 commit comments

Comments
 (0)