From: merlokk Date: Sun, 22 Oct 2017 18:47:19 +0000 (+0300) Subject: added testing timeout 40 sec to avoid hang VM X-Git-Tag: v3.1.0~145^2~2 X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/commitdiff_plain/da36bed90d815171a54456c693f2fea8c12e66b3?hp=--cc added testing timeout 40 sec to avoid hang VM --- da36bed90d815171a54456c693f2fea8c12e66b3 diff --git a/appveyor.yml b/appveyor.yml index a4a70f7a..daf883f2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -63,80 +63,10 @@ install: build_script: - ps: "$env:Path = \"C:\\ProxSpace\\msys\\bin;$env:Path\"\n\n#make\nbash -lc -i \"pwd;make all\"\n\n#some checks\nif(!(Test-Path C:\\ProxSpace\\pm3\\client\\proxmark3.exe)){\nthrow \"Main file proxmark3.exe not exists.\"\n}\nif(!(Test-Path C:\\ProxSpace\\pm3\\armsrc\\obj\\fullimage.elf)){\nthrow \"ARM file fullimage.elf not exists.\"\n}\nif(!(Test-Path C:\\ProxSpace\\pm3\\client\\hardnested\\tables\\*.bin.z)){\nthrow \"Files in hardnested\\tables not exists.\"\n}\n\n#copy\nWrite-Host \"Copy release files...\" -NoNewLine -ForegroundColor Yellow\nNew-Item -ItemType Directory -Force -Path C:\\ProxSpace\\Release\nCopy-Item C:\\ProxSpace\\pm3\\client\\*.exe C:\\ProxSpace\\Release\nNew-Item -ItemType Directory -Force -Path C:\\ProxSpace\\Release\\arm\nCopy-Item C:\\ProxSpace\\pm3\\armsrc\\obj\\*.elf C:\\ProxSpace\\Release\\arm\nCopy-Item C:\\ProxSpace\\pm3\\bootrom\\obj\\*.elf C:\\ProxSpace\\Release\\arm\nNew-Item -ItemType Directory -Force -Path C:\\ProxSpace\\Release\\scripts\nCopy-Item C:\\ProxSpace\\pm3\\client\\scripts\\*.lua C:\\ProxSpace\\Release\\scripts\nNew-Item -ItemType Directory -Force -Path C:\\ProxSpace\\Release\\hardnested\\tables\nCopy-Item C:\\ProxSpace\\pm3\\client\\hardnested\\*.bin C:\\ProxSpace\\Release\\hardnested\nCopy-Item C:\\ProxSpace\\pm3\\client\\hardnested\\tables\\*.bin.z C:\\ProxSpace\\Release\\hardnested\\tables\nWrite-Host \"[ OK ]\" -ForegroundColor Green\n\n#archive and push\n$releasename=\"\"\nif ($env:appveyor_repo_tag -match \"true\"){\n$releasename=$env:APPVEYOR_REPO_TAG_NAME + \"/\"\n}\n$releasename+=$env:APPVEYOR_BUILD_VERSION + \" [\" + $env:APPVEYOR_REPO_COMMIT.Substring(0, 7) + \"]\" \n\nWrite-Host \"Archive and publish release files ($releasename)...\" -NoNewLine -ForegroundColor Yellow\ncd C:\\ProxSpace\n7z a release.zip C:\\ProxSpace\\Release\nPush-AppveyorArtifact release.zip -DeploymentName \"$releasename\"\nWrite-Host \"[ OK ]\" -ForegroundColor Green\n\nWrite-Host \"Builded...\" -ForegroundColor Yellow" test_script: -- ps: >- - $env:Path = "C:\ProxSpace\msys\bin;$env:Path" - - cd c:\ProxSpace\pm3 - - - $global:TestsPassed=$true - - $global:TestTime=[System.Environment]::TickCount - - - Function ExecTest($Name, $File, $Cond) { - [bool]$res=$false; - if ($Cond -eq $null){ - } Else { - If (!($Cond -is [bool] -or $Cond -is [byte] -or $Cond -is [int16] -or $Cond -is [int32] -or $Cond -is [int64] -or $Cond -is [float])){ - if ($Cond -is "String" -and $Cond -like "*passed*"){ - $res= $true - } - if ($Cond -is "String" -and $Cond -like "*true*"){ - $res= $true - } - } Else { - $res=$Cond; - } - } - - If ($res) { - Add-AppveyorTest -Name "$Name" -Framework NUnit -Filename "$File" -Outcome Passed -Duration "$([System.Environment]::TickCount-$global:TestTime)" - }Else { - Add-AppveyorTest -Name "$Name" -Framework NUnit -Filename "$File" -Outcome Failed -Duration "$([System.Environment]::TickCount-$global:TestTime)" - $global:TestsPassed=$false - } - $global:TestTime=[System.Environment]::TickCount - } - - - Write-Host "Running tests..." -ForegroundColor Yellow - - - #file test - - ExecTest "proxmark3 exists" "proxmark3.exe" $(Test-Path C:\ProxSpace\Release\proxmark3.exe) - - ExecTest "arm image exists" "\arm\fullimage1.elf" $(Test-Path C:\ProxSpace\Release\arm\fullimage.elf) - - ExecTest "bootrom exists" "bootrom.elf" $(Test-Path C:\ProxSpace\Release\arm\bootrom.elf) - - ExecTest "hardnested tables exists" "hardnested" $(Test-Path C:\ProxSpace\Release\hardnested\tables\*.z) - - ExecTest "release exists" "release.zip" $(Test-Path C:\ProxSpace\release.zip) - - - #proxmark logic tests - - ExecTest "proxmark help" "proxmark3 -h" $(bash -lc 'cd ~/client;proxmark3 -h | grep -q Execute && echo Passed || echo Failed') - - ExecTest "proxmark help hardnested" "proxmark3 -h" $(bash -lc 'cd ~/client;proxmark3 -h | grep -q hardnested && echo Passed || echo Failed') - - - ExecTest "hf mf offline text" "hf mf" $(bash -lc "cd ~/client;proxmark3 comx -c 'hf mf' | grep -q at_enc && echo Passed || echo Failed") - - ExecTest "hf mf hardnested" "hf mf hardnested" $(bash -lc "cd ~/client;proxmark3 comx -c 'hf mf hardnested t 1 000000000000' | grep -q 'found:' && echo Passed || echo Failed") - - - if ($global:TestsPassed) { - Write-Host "Tests [ OK ]" -ForegroundColor Green - } else { - Write-Host "Tests [ ERROR ]" -ForegroundColor Red - throw "Tests error." - } +- ps: "$env:Path = \"C:\\ProxSpace\\msys\\bin;$env:Path\"\ncd c:\\ProxSpace\\pm3\n\n$global:TestsPassed=$true\n\nFunction ExecTest($Name, $File, $Cmd) {\n#--- begin Job \n$Job = Start-Job -ScriptBlock { \n [bool]$res=$false;\n $TestTime=[System.Environment]::TickCount\n $env:Path = \"C:\\ProxSpace\\msys\\bin;$env:Path\"\n Set-Location $using:PWD\n\n $sb=[scriptblock]::Create(\"$using:Cmd\")\n #execute scriptblock\n $Cond=&$sb\n\n if ($Cond -eq $null){\n } Else {\n If (!($Cond -is [bool] -or $Cond -is [byte] -or $Cond -is [int16] -or $Cond -is [int32] -or $Cond -is [int64] -or $Cond -is [float])){\n if ($Cond -is \"String\" -and $Cond -like \"*passed*\"){\n $res= $true\n }\n if ($Cond -is \"String\" -and $Cond -like \"*true*\"){\n $res= $true\n }\n } Else {\n $res=$Cond;\n }\n }\n\n If ($res) {\n Add-AppveyorTest -Name \"$using:Name\" -Framework NUnit -Filename \"$using:File\" -Outcome Passed -Duration \"$([System.Environment]::TickCount-$TestTime)\"\n }Else {\n Add-AppveyorTest -Name \"$using:Name\" -Framework NUnit -Filename \"$using:File\" -Outcome Failed -Duration \"$([System.Environment]::TickCount-$TestTime)\" -ErrorMessage \"command:$using:Cmd`nresult:$Cond\"\n }\n return $res\n}\n#--- end Job\n\n [bool]$res=$false\n # Wait 40 sec timeout for Job\n if(Wait-Job $Job -Timeout 40){\n $Results = $Job | Receive-Job \n if($Results -like \"true\"){\n $res=$true\n }\n } else {\n Add-AppveyorTest -Name \"$Name\" -Framework NUnit -Filename \"$File\" -Outcome Failed -Duration 40000 -ErrorMessage \"timeout\"\n }\n Remove-Job -Force $Job\n\n if(!$res){\n $global:TestsPassed=$false\n }\n}\n\nWrite-Host \"Running tests...\" -ForegroundColor Yellow\n\n#file test\nExecTest \"proxmark3 exists\" \"proxmark3.exe\" {Test-Path C:\\ProxSpace\\Release\\proxmark3.exe}\nExecTest \"arm image exists\" \"\\arm\\fullimage1.elf\" {Test-Path C:\\ProxSpace\\Release\\arm\\fullimage.elf}\nExecTest \"bootrom exists\" \"bootrom.elf\" {Test-Path C:\\ProxSpace\\Release\\arm\\bootrom.elf}\nExecTest \"hardnested tables exists\" \"hardnested\" {Test-Path C:\\ProxSpace\\Release\\hardnested\\tables\\*.z}\nExecTest \"release exists\" \"release.zip\" {Test-Path C:\\ProxSpace\\release.zip}\n\n#proxmark logic tests\nExecTest \"proxmark help\" \"proxmark3 -h\" {bash -lc 'cd ~/client;proxmark3 -h | grep -q Execute && echo Passed || echo Failed'}\nExecTest \"proxmark help hardnested\" \"proxmark3 -h\" {bash -lc 'cd ~/client;proxmark3 -h | grep -q hardnested && echo Passed || echo Failed'}\n\nExecTest \"hf mf offline text\" \"hf mf\" {bash -lc \"cd ~/client;proxmark3 comx -c 'hf mf' | grep -q at_enc && echo Passed || echo Failed\"}\nExecTest \"hf mf hardnested\" \"hf mf hardnested\" {bash -lc \"cd ~/client;proxmark3 comx -c 'hf mf hardnested t 1 000000000000' | grep -q 'found:' && echo Passed || echo Failed\"}\n\nif ($global:TestsPassed) {\n Write-Host \"Tests [ OK ]\" -ForegroundColor Green\n} else {\n Write-Host \"Tests [ ERROR ]\" -ForegroundColor Red\n throw \"Tests error.\"\n}" on_success: - ps: Write-Host "Build success..." -ForegroundColor Green on_failure: - ps: Write-Host "Build error." -ForegroundColor Red on_finish: -- ps: $blockRdp = $false; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) \ No newline at end of file +- ps: $blockRdp = $false; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))