-
Notifications
You must be signed in to change notification settings - Fork 573
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Misc changes from lukebakken/amqp-string
* Add `RunTestsUntilFailure` to `build.ps1`
- Loading branch information
1 parent
7057fd5
commit 83d37a6
Showing
1 changed file
with
22 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,45 @@ | ||
[CmdletBinding(PositionalBinding=$false)] | ||
param( | ||
[switch]$RunTests | ||
[switch]$RunTests, | ||
[switch]$RunTestsUntilFailure | ||
) | ||
|
||
$ErrorActionPreference = 'Stop' | ||
Set-StrictMode -Version Latest | ||
$PSNativeCommandUseErrorActionPreference = $true | ||
|
||
Write-Host "Run Parameters:" -ForegroundColor Cyan | ||
Write-Host "`tPSScriptRoot: $PSScriptRoot" | ||
Write-Host "`tRunTests: $RunTests" | ||
Write-Host "`tRunTestsUntilFailure: $RunTestsUntilFailure" | ||
Write-Host "`tdotnet --version: $(dotnet --version)" | ||
|
||
Write-Host "[INFO] building all projects (Build.csproj traversal)..." -ForegroundColor "Magenta" | ||
dotnet build "$PSScriptRoot\Build.csproj" | ||
Write-Host "[INFO] done building." -ForegroundColor "Green" | ||
|
||
if ($RunTests) | ||
if ($RunTests -or $RunTestsUntilFailure) | ||
{ | ||
$tests_dir = Join-Path -Path $PSScriptRoot -ChildPath 'projects' | Join-Path -ChildPath 'Test' | ||
$unit_csproj_file = Resolve-Path -LiteralPath (Join-Path -Path $tests_dir -ChildPath 'Unit' | Join-Path -ChildPath 'Unit.csproj') | ||
$integration_csproj_file = Resolve-Path -LiteralPath (Join-Path -Path $tests_dir -ChildPath 'Integration' | Join-Path -ChildPath 'Integration.csproj') | ||
$sequential_integration_csproj_file = Resolve-Path -LiteralPath (Join-Path -Path $tests_dir -ChildPath 'SequentialIntegration' | Join-Path -ChildPath 'SequentialIntegration.csproj') | ||
|
||
foreach ($csproj_file in $unit_csproj_file, $integration_csproj_file, $sequential_integration_csproj_file) | ||
Do | ||
{ | ||
Write-Host "[INFO] running Unit / Integration tests from '$csproj_file' (all frameworks)" -ForegroundColor "Magenta" | ||
dotnet test $csproj_file --environment 'RABBITMQ_LONG_RUNNING_TESTS=true' --no-restore --no-build --logger "console;verbosity=detailed" | ||
if ($LASTEXITCODE -ne 0) | ||
{ | ||
Write-Host "[ERROR] tests errored, exiting" -Foreground "Red" | ||
Exit 1 | ||
} | ||
else | ||
foreach ($csproj_file in $unit_csproj_file, $integration_csproj_file, $sequential_integration_csproj_file) | ||
{ | ||
Write-Host "[INFO] tests passed" -ForegroundColor "Green" | ||
Write-Host "[INFO] running Unit / Integration tests from '$csproj_file' (all frameworks)" -ForegroundColor "Magenta" | ||
& dotnet test $csproj_file --environment 'RABBITMQ_LONG_RUNNING_TESTS=true' --no-restore --no-build --logger "console;verbosity=detailed" | ||
if ($LASTEXITCODE -ne 0) | ||
{ | ||
Write-Host "[ERROR] tests errored, exiting" -Foreground "Red" | ||
Exit 1 | ||
} | ||
else | ||
{ | ||
Write-Host "[INFO] tests passed" -ForegroundColor "Green" | ||
} | ||
} | ||
} | ||
} While ($RunTestsUntilFailure) | ||
} |