mirror of
https://github.com/eclipse-openvehicle-api/openvehicle-api.git
synced 2026-02-05 15:18:45 +00:00
36
tests/loop_test_runner_windows.ps1
Normal file
36
tests/loop_test_runner_windows.ps1
Normal file
@@ -0,0 +1,36 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
PowerShell script to loop a specific test executable multiple times to catch intermittent failures.
|
||||
|
||||
.DESCRIPTION
|
||||
Usage: .\loop_test_runner.ps1 <TestName> <NumberOfRuns>
|
||||
Example: .\loop_test_runner.ps1 UnitTest_SharedMemConnectTests.exe 1000
|
||||
#>
|
||||
|
||||
param (
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$TestName,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[int]$NumberOfRuns
|
||||
)
|
||||
|
||||
# Build the full path to the test executable
|
||||
$TargetTest = Join-Path "..\build\tests\bin" $TestName
|
||||
|
||||
# Check if the test executable exists
|
||||
if (Test-Path $TargetTest) {
|
||||
Write-Host "`nStarting looped execution of $TargetTest to catch intermittent failures..." -ForegroundColor Cyan
|
||||
|
||||
for ($i = 1; $i -le $NumberOfRuns; $i++) {
|
||||
Write-Host "`nRun #$i" -ForegroundColor Yellow
|
||||
& $TargetTest
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Host "`nTest failed on run #$i" -ForegroundColor Red
|
||||
break
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Write-Host "Target test $TargetTest not found!" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
Reference in New Issue
Block a user