diff --git a/appveyor.yml b/appveyor.yml index 131ac10d8..3ac706140 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,6 +7,7 @@ environment: proxspace_zip_folder_name: ProxSpace-* proxspace_path: \ProxSpace proxspace_home_path: \ProxSpace\pm3 + wsl_git_path: C:\wslgit init: - ps: >- @@ -85,7 +86,22 @@ clone_script: Add-AppveyorMessage -Message "WSL setup took $(([System.Environment]::TickCount-$WSLInstallTime) / 1000) sec" -Category Information } - Write-Host "Removing ProxSpace..." -NoNewLine + Function GitClone($Text, $Folder) { + Write-Host "$Text" -NoNewLine + if(-not $env:appveyor_pull_request_number) { + git clone -q --branch=$env:appveyor_repo_branch https://github.com/$env:appveyor_repo_name.git $Folder + cd $Folder + git checkout -qf $env:appveyor_repo_commit + } else { + git clone -q https://github.com/$env:appveyor_repo_name.git $Folder + cd $Folder + git fetch -q origin +refs/pull/$env:appveyor_pull_request_number/merge: + git checkout -qf FETCH_HEAD + } + Write-Host "[ OK ]" -ForegroundColor Green + } + + Write-Host "ProxSpace: Removing folder..." -NoNewLine $PSInstallTime=[System.Environment]::TickCount @@ -97,7 +113,7 @@ clone_script: Receive-Job -Job $WSLjob - Write-Host "Download ProxSpace..." -NoNewLine + Write-Host "ProxSpace: downloading..." -NoNewLine [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 @@ -107,7 +123,7 @@ clone_script: Receive-Job -Job $WSLjob - Write-Host "Extracting ProxSpace..." -NoNewLine + Write-Host "ProxSpace: extracting..." -NoNewLine Expand-Archive -LiteralPath "$env:proxspace_zip_file" -DestinationPath "\" @@ -117,15 +133,15 @@ clone_script: Receive-Job -Job $WSLjob - Write-Host "Renaming ProxSpace folder..." -NoNewLine + Write-Host "ProxSpace: renaming folder..." -NoNewLine Get-ChildItem -Path "\$env:proxspace_zip_folder_name" | Rename-Item -NewName (Split-Path $env:proxspace_path -Leaf) Write-Host "[ OK ]" -ForegroundColor Gree - ExecUpdate "Initial msys2 startup..." $true + ExecUpdate "ProxSpace: initial msys2 startup..." $true - ExecUpdate "Installing required packages..." $false + ExecUpdate "ProxSpace: installing required packages..." $false $psversion = (Select-String -Pattern 'PSVERSION=' -SimpleMatch -Path "$env:proxspace_path\msys2\ps\09-proxspace_setup.post").Line.Split("""")[1] @@ -134,23 +150,12 @@ clone_script: Add-AppveyorMessage -Message "ProxSpace download and update took $(([System.Environment]::TickCount-$PSInstallTime) / 1000) sec" -Category Information - Write-Host "Cloning repository <$env:appveyor_repo_name> to $env:appveyor_build_folder ..." -NoNewLine - - if(-not $env:appveyor_pull_request_number) { - git clone -q --branch=$env:appveyor_repo_branch https://github.com/$env:appveyor_repo_name.git $env:appveyor_build_folder - cd $env:appveyor_build_folder - git checkout -qf $env:appveyor_repo_commit - } else { - git clone -q https://github.com/$env:appveyor_repo_name.git $env:appveyor_build_folder - cd $env:appveyor_build_folder - git fetch -q origin +refs/pull/$env:appveyor_pull_request_number/merge: - git checkout -qf FETCH_HEAD - } - - Write-Host "[ OK ]" -ForegroundColor Green + GitClone "ProxSpace: Cloning repository <$env:appveyor_repo_name> to $env:appveyor_build_folder ..." $env:appveyor_build_folder Receive-Job -Wait -Job $WSLjob + GitClone "WSL: Cloning repository <$env:appveyor_repo_name> to $env:wsl_git_path ..." $env:wsl_git_path + install: build_script: @@ -163,10 +168,6 @@ build_script: ./runme64.bat -c "cd $pmfolder && $Cmd" } - Function ExecWSLCmd($Cmd) { - wsl -- bash -c $Cmd - } - Function ExecCheck($Name) { $testspass = ($LASTEXITCODE -eq 0) @@ -182,6 +183,55 @@ build_script: } } + $WSLjob = Start-Job -Name WSLCompile -ScriptBlock { + Function ExecWSLCmd($Cmd) { + wsl -- bash -c $Cmd + } + + Function ExecCheck($Name) { + $testspass = ($LASTEXITCODE -eq 0) + + $global:TestsPassed=$testspass + + if ($testspass) { + Add-AppveyorTest -Name $Name -Framework NUnit -Filename $Name -Outcome Passed -Duration "$([System.Environment]::TickCount-$TestTime)" + Write-Host "$Name [ OK ]" -ForegroundColor Green + } else { + Add-AppveyorTest -Name $Name -Framework NUnit -Filename $Name -Outcome Failed -Duration "$([System.Environment]::TickCount-$TestTime)" + Write-Host "$Name [ ERROR ]" -ForegroundColor Red + throw "Tests error." + } + } + + #Windows Subsystem for Linux (WSL) + Write-Host "---------- WSL make ----------" -ForegroundColor Yellow + cd $env:appveyor_build_folder + $TestTime=[System.Environment]::TickCount + ExecWSLCmd "make clean;make V=1" + #some checks + if(!(Test-Path "$env:proxspace_home_path\$pmfolder\client\proxmark3")){ + throw "Main file proxmark3 not exists." + } + + ExecWSLCmd "make check" + ExecCheck "WSL make Tests" + Start-Sleep -s 2 + Write-Host "---------- WSL btaddon ----------" -ForegroundColor Yellow + $TestTime=[System.Environment]::TickCount + ExecWSLCmd "make clean;make V=1 PLATFORM_EXTRAS=BTADDON" + ExecWSLCmd "make check" + ExecCheck "WSL BTaddon Tests" + Start-Sleep -s 2 + Write-Host "---------- WSL make clean ----------" -ForegroundColor Yellow + ExecWSLCmd 'make clean' + Write-Host "---------- WSL cmake ----------" -ForegroundColor Yellow + $TestTime=[System.Environment]::TickCount + ExecWSLCmd 'rm -rf client/build;mkdir -p client/build; cd client/build; cmake ..; make VERBOSE=1;' + Write-Host "---------- WSL cmake tests ----------" -ForegroundColor Yellow + ExecWSLCmd './tools/pm3_tests.sh --clientbin client/build/proxmark3 client' + ExecCheck "WSL cmake Tests" + } + #ProxSpace Write-Host "---------- PS make ----------" -ForegroundColor Yellow @@ -226,57 +276,8 @@ build_script: ExecCheck "PS cmake Tests" - #Windows Subsystem for Linux (WSL) - - Write-Host "---------- WSL make ----------" -ForegroundColor Yellow - - cd $env:appveyor_build_folder - - $TestTime=[System.Environment]::TickCount - - ExecWSLCmd "make clean;make V=1" - - #some checks + Receive-Job -Wait -Job $WSLjob -ErrorAction Stop - if(!(Test-Path "$env:proxspace_home_path\$pmfolder\client\proxmark3")){ - - throw "Main file proxmark3 not exists." - - } - - ExecWSLCmd "make check" - - ExecCheck "WSL make Tests" - - Start-Sleep -s 2 - - Write-Host "---------- WSL btaddon ----------" -ForegroundColor Yellow - - $TestTime=[System.Environment]::TickCount - - ExecWSLCmd "make clean;make V=1 PLATFORM_EXTRAS=BTADDON" - - ExecWSLCmd "make check" - - ExecCheck "WSL BTaddon Tests" - - Start-Sleep -s 2 - - Write-Host "---------- WSL make clean ----------" -ForegroundColor Yellow - - ExecWSLCmd 'make clean' - - Write-Host "---------- WSL cmake ----------" -ForegroundColor Yellow - - $TestTime=[System.Environment]::TickCount - - ExecWSLCmd 'rm -rf client/build;mkdir -p client/build; cd client/build; cmake ..; make VERBOSE=1;' - - Write-Host "---------- WSL cmake tests ----------" -ForegroundColor Yellow - - ExecWSLCmd './tools/pm3_tests.sh --clientbin client/build/proxmark3 client' - - ExecCheck "WSL cmake Tests" test_script: - ps: >-