Changeset 16614 for branches/2929_PrioritizedGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.PGE/3.3/TestResults.ps1
- Timestamp:
- 02/19/19 05:05:24 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2929_PrioritizedGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.PGE/3.3/TestResults.ps1
r16533 r16614 1 param( 2 [switch] $GenerateNew = $true, 3 [int] $WaitToStep = 200 1 [cmdletbinding()] 2 param( 3 [int] $WaitToStep = 200, 4 [string] $BenchName = "Pagie_1", 5 [int] $PeelCnt = 3, 6 [int] $EvalCnt = 3, 7 [ValidateSet("method1","method2", "method3")][string] $InitMethod = "method1", 8 [ValidateSet("method1","method2", "method3")][string] $GrowMethod = "method1", 9 [bool] $Clear 4 10 ) 5 11 12 $GenerateNew = $true 6 13 7 $CLog = Join-Path -Path $(Resolve-Path $PSScriptRoot) -ChildPath 'CGen.log'8 $GoLog = Join-Path -Path $(Resolve-Path $PSScriptRoot) -ChildPath 'GoOut.log'14 $CLog = Join-Path -Path $(Resolve-Path $PSScriptRoot) -ChildPath "CGen_$($BenchName).log" 15 $GoLog = Join-Path -Path $(Resolve-Path $PSScriptRoot) -ChildPath "GoOut_$($BenchName).log" 9 16 10 $CExecutable = Join-Path -Path $(Resolve-Path $PSScriptRoot) -ChildPath 'a.exe' 17 $CLogError = Join-Path -Path $(Resolve-Path $PSScriptRoot) -ChildPath "CGen_$($BenchName).err" 18 $GoLogError = Join-Path -Path $(Resolve-Path $PSScriptRoot) -ChildPath "GoOut_$($BenchName).err" 19 20 $CExecutable = Join-Path -Path $(Resolve-Path $PSScriptRoot) -ChildPath 'testmulti.exe' 11 21 $GoExecutable = Join-Path -Path $(Resolve-Path $PSScriptRoot) -ChildPath 'go-code\go-pge\go-pge.exe' 12 22 13 14 23 if($GenerateNew) { 15 $CGenProc = Start-Process -FilePath $CExecutable -RedirectStandardOutput $CLog -WorkingDirectory $PSScriptRoot -PassThru 24 if(Test-Path $GoLog -Type Leaf) { 25 Remove-Item -Path $GoLog 26 } 27 if(Test-Path $CLog -Type Leaf) { 28 Remove-Item -Path $CLog 29 } 30 if(Test-Path $GoLogError -Type Leaf) { 31 Remove-Item -Path $GoLogError 32 } 33 if(Test-Path $CLogError -Type Leaf) { 34 Remove-Item -Path $CLogError 35 } 36 37 $CGenProc = Start-Process -FilePath $CExecutable -ArgumentList "$BenchName -evals=$($EvalCnt) -peel=$($PeelCnt) -iter=$($WaitToStep) -init=$($InitMethod) -grow=$($GrowMethod)" -RedirectStandardOutput $CLog -RedirectStandardError $CLogError -WorkingDirectory $PSScriptRoot -PassThru 16 38 $StepReached = $false 17 39 while(-not $StepReached) { … … 25 47 $CGenProc | Stop-Process -ErrorAction SilentlyContinue 26 48 27 28 $GoGenProc = Start-Process -FilePath $GoExecutable -ArgumentList "-pcfg=prob/bench/Pagie_1.cfg -evals=3 -peel=3 -iter=$WaitToStep -init=method1 -grow=method1" -RedirectStandardOutput $GoLog -WorkingDirectory $(Join-Path -Path $PSScriptRoot -ChildPath 'go-code\go-pge') -PassThru 49 $env:GOGC="off" 50 $env:GODEBUG="cgocheck=0" 51 $env:CGO_ENABLED=1 52 $GoGenProc = Start-Process -FilePath $GoExecutable -ArgumentList "-pcfg=prob/bench/$($BenchName).cfg -evals=$($EvalCnt) -peel=$($PeelCnt) -iter=$($WaitToStep) -init=$($InitMethod) -grow=$($GrowMethod)" -RedirectStandardOutput $GoLog -RedirectStandardError $GoLogError -WorkingDirectory $(Split-Path -Path $GoExecutable -Parent) -PassThru 29 53 $StepReached = $false 30 54 while(-not $StepReached) { … … 48 72 [int]$CurrentStep = $Matches[1] 49 73 $ValueList[$CurrentStep] = $(New-Object -TypeName System.Collections.ArrayList) 50 } elseif($Line -match "push\/pop \(\d+\,\d+\) \((.+)\)") {51 $ValueList[$CurrentStep].Add($Matches[1].Trim().Replace(' ', '')) | Out-Null74 } elseif($Line -match "push\/pop \(\d+\,\d+\) (.+)") { 75 $ValueList[$CurrentStep].Add($Matches[1].Trim().Replace('(', '').Replace(')', '').Replace(' ', '')) | Out-Null 52 76 } 53 77 } … … 64 88 $ValueList[$CurrentStep] = $(New-Object -TypeName System.Collections.ArrayList) 65 89 } elseif($Line -match "pop\/push\(\d+\,\d+\)\: (.+)") { 66 $ValueList[$CurrentStep].Add($Matches[1].Trim(). Trim('(').Trim(')').Replace(' ', '')) | Out-Null90 $ValueList[$CurrentStep].Add($Matches[1].Trim().Replace('(', '').Replace(')', '').Replace(' ', '')) | Out-Null 67 91 } 68 92 } … … 75 99 [string]$Second 76 100 ) 77 $FirstChars = $First.Trim().ToUpper().ToCharArray() | Sort 78 $SecondChars = $Second.Trim().ToUpper().ToCharArray() | Sort 101 $FirstChars = $First.Trim().ToUpper().ToCharArray() | Sort-Object 102 $SecondChars = $Second.Trim().ToUpper().ToCharArray() | Sort-Object 79 103 80 104 [System.Collections.ArrayList]$LeftChars = $SecondChars.Clone() … … 98 122 $ParseGo = Get-GoSteps -Content $GoContent 99 123 100 foreach($StepNr in $($ParseGo.Keys | Sort )) {124 foreach($StepNr in $($ParseGo.Keys | Sort-Object | Where-Object { $_ -ne 0 -and $_ -le $WaitToStep})) { 101 125 $GoResult = $ParseGo[$StepNr] 102 [System.Collections.ArrayList]$CResult = $ParseC[$StepNr + 1]126 [System.Collections.ArrayList]$CResult = $ParseC[$StepNr] 103 127 104 if($ CResult -eq $null-or $CResult.Count -lt 1) {105 Write- Information"Missing CStep nr. $StepNr"128 if($null -eq $CResult -or $CResult.Count -lt 1) { 129 Write-Warning "Missing CStep nr. $StepNr" 106 130 continue 107 131 } 108 if($ GoResult -eq $null-or $GoResult.Count -lt 1) {109 Write- Information"Missing GoStep nr. $StepNr"132 if($null -eq $GoResult -or $GoResult.Count -lt 1) { 133 Write-Warning "Missing GoStep nr. $StepNr" 110 134 continue 111 135 } … … 115 139 $State = $false 116 140 foreach($CRes in $CResult.Clone()) { # Compare every Result with every Step Result 117 Write- Debug"$($GoRes) with $($CRes)"141 Write-Output "$($GoRes) with $($CRes)" 118 142 if(Compare-Results -First $GoRes -Second $CRes) { 119 143 $State = $true … … 128 152 129 153 if($StepResult) { 130 Write- Host "$StepNr OK"154 Write-Output "$StepNr OK" 131 155 } else { 132 156 Write-Warning "$StepNr failed!" 133 157 } 134 158 } 159 160 if($Clear) { 161 if(Test-Path $GoLog -Type Leaf) { 162 Remove-Item -Path $GoLog 163 } 164 if(Test-Path $CLog -Type Leaf) { 165 Remove-Item -Path $CLog 166 } 167 if(Test-Path $GoLogError -Type Leaf) { 168 Remove-Item -Path $GoLogError 169 } 170 if(Test-Path $CLogError -Type Leaf) { 171 Remove-Item -Path $CLogError 172 } 173 }
Note: See TracChangeset
for help on using the changeset viewer.