From 39892a028d164053d99e11955f0fb5f21528acfc Mon Sep 17 00:00:00 2001 From: Gator96100 Date: Thu, 17 Sep 2020 23:27:20 +0200 Subject: [PATCH] Appveyor add WSL support --- appveyor.yml | 159 ++++++++++++++++++++++++++++++++++----------------- 1 file changed, 106 insertions(+), 53 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 328796653..4eecb27f7 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -35,7 +35,7 @@ clone_script: Function ExecUpdate($Text, $firstStart) { Write-Host "$Text" -NoNewLine - Start-Process "cmd.exe" "/c ""cd /D $env:proxspace_path && call msys2\ps\setup.cmd && msys2\msys2_shell.cmd -mingw64 -defterm -no-start -c ""exit""""" + Start-Process "cmd.exe" "/c ""cd /D $env:proxspace_path && runme64.bat -c ""exit""""" $StartTime=[System.Environment]::TickCount Start-Sleep -s 10 while($true) { @@ -64,9 +64,15 @@ clone_script: } } + Function WSLExec($Text, $Cmd) { + Write-Host "$Text" -NoNewLine + wsl -- bash -c $Cmd + Write-Host "[ OK ]" -ForegroundColor Green + } + Write-Host "Removing ProxSpace..." -NoNewLine - $CloneTime=[System.Environment]::TickCount + $PSInstallTime=[System.Environment]::TickCount cd \ @@ -105,6 +111,22 @@ clone_script: Write-Host "ProxSpace version: $psversion" -ForegroundColor Yellow + Add-AppveyorMessage -Message "ProxSpace download and update took $(([System.Environment]::TickCount-$PSInstallTime) / 1000) sec" -Category Information + + $WSLInstallTime=[System.Environment]::TickCount + + WSLExec "WSL update..." "sudo apt-get update 1>/dev/null" + + WSLExec "WSL upgrade..." "sudo apt-get upgrade -y 1>/dev/null" + + WSLExec "WSL cleanup..." "sudo apt-get auto-remove -y 1>/dev/null" + + WSLExec "WSL install..." "sudo apt-get -y install --reinstall --no-install-recommends git ca-certificates build-essential pkg-config libreadline-dev gcc-arm-none-eabi libnewlib-dev libbz2-dev qtbase5-dev cmake 1>/dev/null" + + WSLExec "WSL QT fix..." "sudo strip --remove-section=.note.ABI-tag /usr/lib/x86_64-linux-gnu/libQt5Core.so.5" + + Add-AppveyorMessage -Message "WSL setup took $(([System.Environment]::TickCount-$WSLInstallTime) / 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) { @@ -118,9 +140,7 @@ clone_script: git checkout -qf FETCH_HEAD } - Write-Host "[ OK ]" -ForegroundColor Green - - Add-AppveyorMessage -Message "ProxSpace download and update took $(([System.Environment]::TickCount-$CloneTime) / 1000) sec" -Category Information + Write-Host "[ OK ]" -ForegroundColor Green install: @@ -131,91 +151,124 @@ build_script: Function ExecMinGWCmd($Cmd) { cd $env:proxspace_path - msys2\msys2_shell.cmd -mingw64 -defterm -no-start -c "cd $pmfolder && $Cmd" + ./runme64.bat -c "cd $pmfolder && $Cmd" } - - Write-Host "---------- make ----------" -ForegroundColor Yellow + 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." + } + } + + #ProxSpace + + Write-Host "---------- PS make ----------" -ForegroundColor Yellow $TestTime=[System.Environment]::TickCount - #make - - cd $env:proxspace_path - - msys2\ps\setup.cmd - ExecMinGWCmd "make clean;make V=1" - #some checks - if(!(Test-Path "$env:proxspace_home_path\$pmfolder\client\proxmark3.exe")){ - throw "Main file proxmark3.exe not exists." + throw "Main file proxmark3.exe not exists." } ExecMinGWCmd 'make check' - $testspass = ($LASTEXITCODE -eq 0) + ExecCheck "PS make Tests" - $global:TestsPassed=$testspass - - if ($testspass) { - Add-AppveyorTest -Name "make Tests" -Framework NUnit -Filename "make check" -Outcome Passed -Duration "$([System.Environment]::TickCount-$TestTime)" - Write-Host "make Tests [ OK ]" -ForegroundColor Green - } else { - Add-AppveyorTest -Name "make Tests" -Framework NUnit -Filename "make check" -Outcome Failed -Duration "$([System.Environment]::TickCount-$TestTime)" - Write-Host "make Tests [ ERROR ]" -ForegroundColor Red - throw "Tests error." - } - - Write-Host "---------- btaddon ----------" -ForegroundColor Yellow + Write-Host "---------- PS btaddon ----------" -ForegroundColor Yellow $TestTime=[System.Environment]::TickCount ExecMinGWCmd 'make clean;make V=1 PLATFORM_EXTRAS=BTADDON' ExecMinGWCmd 'make check' - - $testspass = ($LASTEXITCODE -eq 0) - - $global:TestsPassed=(($global:TestsPassed) -and ($testspass)) - if ($testspass) { - Add-AppveyorTest -Name "BTaddon Tests" -Framework NUnit -Filename "make check" -Outcome Passed -Duration "$([System.Environment]::TickCount-$TestTime)" - Write-Host "BTaddon Tests [ OK ]" -ForegroundColor Green - } else { - Add-AppveyorTest -Name "BTaddon Tests" -Framework NUnit -Filename "make check" -Outcome Failed -Duration "$([System.Environment]::TickCount-$TestTime)" - Write-Host "BTaddon Tests [ ERROR ]" -ForegroundColor Red - } + ExecCheck "PS BTaddon Tests" - Write-Host "---------- make clean ----------" -ForegroundColor Yellow + Write-Host "---------- PS make clean ----------" -ForegroundColor Yellow ExecMinGWCmd 'make clean' - Write-Host "---------- cmake ----------" -ForegroundColor Yellow + Write-Host "---------- PS cmake ----------" -ForegroundColor Yellow $TestTime=[System.Environment]::TickCount ExecMinGWCmd 'mkdir -p client/build; cd client/build; cmake -G""MSYS Makefiles"" ..; make VERBOSE=1;' - Write-Host "---------- cmake tests ----------" -ForegroundColor Yellow + Write-Host "---------- PS cmake tests ----------" -ForegroundColor Yellow ExecMinGWCmd './tools/pm3_tests.sh --clientbin client/build/proxmark3.exe client' - $testspass = ($LASTEXITCODE -eq 0) - - $global:TestsPassed=(($global:TestsPassed) -and ($testspass)) + ExecCheck "PS cmake Tests" - if ($testspass) { - Add-AppveyorTest -Name "cmake Tests" -Framework NUnit -Filename "make client/check" -Outcome Passed -Duration "$([System.Environment]::TickCount-$TestTime)" - Write-Host "cmake Tests [ OK ]" -ForegroundColor Green - } else { - Add-AppveyorTest -Name "cmake Tests" -Framework NUnit -Filename "make client/check" -Outcome Failed -Duration "$([System.Environment]::TickCount-$TestTime)" - Write-Host "cmake Tests [ ERROR ]" -ForegroundColor Red + #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" + test_script: - ps: >- if ($global:TestsPassed) {