Merge pull request #962 from Gator96100/master

Appveyor add WSL support
This commit is contained in:
Iceman 2020-09-18 00:09:31 +02:00 committed by GitHub
commit 30f9e2d2b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -35,7 +35,7 @@ clone_script:
Function ExecUpdate($Text, $firstStart) { Function ExecUpdate($Text, $firstStart) {
Write-Host "$Text" -NoNewLine 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 $StartTime=[System.Environment]::TickCount
Start-Sleep -s 10 Start-Sleep -s 10
while($true) { 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 Write-Host "Removing ProxSpace..." -NoNewLine
$CloneTime=[System.Environment]::TickCount $PSInstallTime=[System.Environment]::TickCount
cd \ cd \
@ -105,6 +111,22 @@ clone_script:
Write-Host "ProxSpace version: $psversion" -ForegroundColor Yellow 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 Write-Host "Cloning repository <$env:appveyor_repo_name> to $env:appveyor_build_folder ..." -NoNewLine
if(-not $env:appveyor_pull_request_number) { if(-not $env:appveyor_pull_request_number) {
@ -118,9 +140,7 @@ clone_script:
git checkout -qf FETCH_HEAD git checkout -qf FETCH_HEAD
} }
Write-Host "[ OK ]" -ForegroundColor Green Write-Host "[ OK ]" -ForegroundColor Green
Add-AppveyorMessage -Message "ProxSpace download and update took $(([System.Environment]::TickCount-$CloneTime) / 1000) sec" -Category Information
install: install:
@ -131,91 +151,124 @@ build_script:
Function ExecMinGWCmd($Cmd) { Function ExecMinGWCmd($Cmd) {
cd $env:proxspace_path 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 $TestTime=[System.Environment]::TickCount
#make
cd $env:proxspace_path
msys2\ps\setup.cmd
ExecMinGWCmd "make clean;make V=1" ExecMinGWCmd "make clean;make V=1"
#some checks
if(!(Test-Path "$env:proxspace_home_path\$pmfolder\client\proxmark3.exe")){ 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' ExecMinGWCmd 'make check'
$testspass = ($LASTEXITCODE -eq 0) ExecCheck "PS make Tests"
$global:TestsPassed=$testspass Write-Host "---------- PS btaddon ----------" -ForegroundColor Yellow
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
$TestTime=[System.Environment]::TickCount $TestTime=[System.Environment]::TickCount
ExecMinGWCmd 'make clean;make V=1 PLATFORM_EXTRAS=BTADDON' ExecMinGWCmd 'make clean;make V=1 PLATFORM_EXTRAS=BTADDON'
ExecMinGWCmd 'make check' ExecMinGWCmd 'make check'
$testspass = ($LASTEXITCODE -eq 0)
$global:TestsPassed=(($global:TestsPassed) -and ($testspass))
if ($testspass) { ExecCheck "PS BTaddon Tests"
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
}
Write-Host "---------- make clean ----------" -ForegroundColor Yellow Write-Host "---------- PS make clean ----------" -ForegroundColor Yellow
ExecMinGWCmd 'make clean' ExecMinGWCmd 'make clean'
Write-Host "---------- cmake ----------" -ForegroundColor Yellow Write-Host "---------- PS cmake ----------" -ForegroundColor Yellow
$TestTime=[System.Environment]::TickCount $TestTime=[System.Environment]::TickCount
ExecMinGWCmd 'mkdir -p client/build; cd client/build; cmake -G""MSYS Makefiles"" ..; make VERBOSE=1;' 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' ExecMinGWCmd './tools/pm3_tests.sh --clientbin client/build/proxmark3.exe client'
$testspass = ($LASTEXITCODE -eq 0) ExecCheck "PS cmake Tests"
$global:TestsPassed=(($global:TestsPassed) -and ($testspass))
if ($testspass) { #Windows Subsystem for Linux (WSL)
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 Write-Host "---------- WSL make ----------" -ForegroundColor Yellow
} else {
Add-AppveyorTest -Name "cmake Tests" -Framework NUnit -Filename "make client/check" -Outcome Failed -Duration "$([System.Environment]::TickCount-$TestTime)" cd $env:appveyor_build_folder
Write-Host "cmake Tests [ ERROR ]" -ForegroundColor Red
$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: test_script:
- ps: >- - ps: >-
if ($global:TestsPassed) { if ($global:TestsPassed) {