[16614] | 1 | [cmdletbinding()]
|
---|
| 2 | param(
|
---|
[16618] | 3 | [int] $WaitToStep = 200,
|
---|
[16614] | 4 | [int] $PeelCnt = 3,
|
---|
| 5 | [int] $EvalCnt = 3,
|
---|
| 6 | [ValidateSet("method1","method2", "method3")][string] $InitMethod = "method1",
|
---|
| 7 | [ValidateSet("method1","method2", "method3")][string] $GrowMethod = "method1",
|
---|
[16618] | 8 | [int] $MaxJobs = 3,
|
---|
[16617] | 9 | [switch] $NoClear,
|
---|
| 10 | [switch] $UseExisting
|
---|
[16614] | 11 | )
|
---|
| 12 |
|
---|
[16620] | 13 | $BenchmarksPath = Resolve-Path -Relative "src\go-pge\data\benchmark"
|
---|
[16614] | 14 |
|
---|
[16618] | 15 | $env:GOGC="off"
|
---|
| 16 | $env:GODEBUG="cgocheck=0"
|
---|
| 17 | $env:CGO_ENABLED=1
|
---|
| 18 |
|
---|
[16614] | 19 | $BenchFiles = Get-ChildItem -Path $BenchmarksPath -File
|
---|
| 20 | $ActiveJobs = @{}
|
---|
| 21 | foreach($BenchName in $($BenchFiles | Select-Object -ExpandProperty BaseName -Unique)) {
|
---|
| 22 | $RunningCnt = ($ActiveJobs.Values | Where-Object { $_.State -eq "Running" }).Count
|
---|
| 23 | while ($RunningCnt -gt $MaxJobs) {
|
---|
| 24 | Start-Sleep -Seconds 1
|
---|
| 25 | $RunningCnt = ($ActiveJobs.Values | Where-Object { $_.State -eq "Running" }).Count
|
---|
| 26 | }
|
---|
| 27 | $ActiveJobs[$BenchName] = Start-Job -ScriptBlock {
|
---|
[16617] | 28 | param($PSPath, $WaitToStep, $BenchName, $PeelCnt, $EvalCnt, $InitMethod, $GrowMethod, $NoClear, $UseExisting)
|
---|
[16614] | 29 | Set-Location -Path $PSPath
|
---|
[16617] | 30 | ./TestResults -WaitToStep $WaitToStep -BenchName $BenchName -PeelCnt $PeelCnt -EvalCnt $EvalCnt -InitMethod $InitMethod -GrowMethod $GrowMethod -NoClear:$NoClear -UseExisting:$UseExisting *>&1
|
---|
| 31 | Write-Output "Gen-Return: $LASTEXITCODE"
|
---|
| 32 | } -ArgumentList $(Resolve-Path $PSScriptRoot), $WaitToStep, $BenchName, $PeelCnt, $EvalCnt, $InitMethod, $GrowMethod, $NoClear.IsPresent, $UseExisting.IsPresent
|
---|
[16614] | 33 | Write-Host "Started job for $BenchName"
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | $ActiveJobs.Values | Wait-Job | Out-Null
|
---|
[16618] | 37 | foreach($BenchName in $ActiveJobs.Keys | Sort-Object) {
|
---|
[16614] | 38 | $Job = $ActiveJobs[$BenchName]
|
---|
| 39 | $Res = $Job | Receive-Job
|
---|
[16617] | 40 | $ReturnLine = $Res | Select-String -SimpleMatch "Gen-Return: "
|
---|
| 41 | if($ReturnLine -match "Gen-Return: (\d+)") {
|
---|
| 42 | if($Matches[0] -ne 0) {
|
---|
| 43 | Write-Error "$($BenchName): An error occurred! Return-Code $($Matches[0])"
|
---|
| 44 | continue
|
---|
| 45 | }
|
---|
| 46 | }
|
---|
[16614] | 47 | $Succeeded = ($Res | Select-String -Pattern "^[0-9]+\sOK").Count
|
---|
| 48 | $Failed = ($Res | Select-String -Pattern "^[0-9]+\sfailed!").Count
|
---|
| 49 | if($($Succeeded + $Failed) -ne $WaitToStep ) {
|
---|
[16617] | 50 | $Missing = $WaitToStep - ($Succeeded + $Failed)
|
---|
| 51 | Write-Error "$($BenchName): $Missing steps missing, or something went wrong!? Please check manuelly"
|
---|
[16614] | 52 | }
|
---|
| 53 | if($Succeeded -eq $WaitToStep) {
|
---|
[16617] | 54 | Write-Host "$($BenchName): $Succeeded / $WaitToStep `ttests succeeded"
|
---|
[16614] | 55 | } else {
|
---|
[16617] | 56 | Write-Warning "$($BenchName): $Failed / $WaitToStep `ttests failed!"
|
---|
[16614] | 57 | }
|
---|
| 58 | }
|
---|
| 59 | Get-Job | Remove-Job -Force | Out-Null |
---|