11[CmdletBinding (PositionalBinding = $false )]
22param (
3- [switch ]$RunTests
3+ [switch ]$RunTests ,
4+ [switch ]$RunTestsUntilFailure
45)
56
7+ New-Variable - Name verbose - Option Constant `
8+ - Value ($VerbosePreference -ne ' SilentlyContinue' )
9+
610$ErrorActionPreference = ' Stop'
711Set-StrictMode - Version Latest
812$PSNativeCommandUseErrorActionPreference = $true
@@ -18,17 +22,30 @@ New-Variable -Name build_csproj_file -Option Constant `
1822 - Value (Join-Path - Path $PSScriptRoot - ChildPath ' Build.csproj' )
1923
2024dotnet build $build_csproj_file
21- Write-Host " Done building." - ForegroundColor " Green"
2225
23- if ($RunTests ) {
24- Write-Host " Running tests: Build.csproj traversal (all frameworks)" - ForegroundColor " Magenta"
25- dotnet test $build_csproj_file -- no- build -- logger ' console;verbosity=detailed'
26- if ($LastExitCode -ne 0 )
26+ Write-Host " [INFO] done building." - ForegroundColor " Green"
27+
28+ if ($RunTests -or $RunTestsUntilFailure )
29+ {
30+ Do
2731 {
28- Write-Host " Error with tests, aborting build." - Foreground " Red"
29- Exit 1
30- }
31- Write-Host " Tests passed!" - ForegroundColor " Green"
32+ Write-Host " Running tests: Build.csproj traversal (all frameworks)" - ForegroundColor " Magenta"
33+ if ($verbose )
34+ {
35+ dotnet test $build_csproj_file -- environment= RABBITMQ_CLIENT_TESTS_VERBOSE= true -- no- build -- logger ' console;verbosity=detailed'
36+ }
37+ else
38+ {
39+ dotnet test $build_csproj_file -- no- build -- logger ' console;verbosity=detailed'
40+ }
41+ if ($LASTEXITCODE -ne 0 )
42+ {
43+ Write-Host " [ERROR] tests errored, exiting" - Foreground " Red"
44+ Exit 1
45+ }
46+ else
47+ {
48+ Write-Host " [INFO] tests passed" - ForegroundColor " Green"
49+ }
50+ } While ($RunTestsUntilFailure )
3251}
33-
34- Write-Host " Done."
0 commit comments