]> git.zerfleddert.de Git - proxmark3-svn/blame - appveyor.yml
added write-host for tests
[proxmark3-svn] / appveyor.yml
CommitLineData
ef9746cb
OM
1version: 3.0.1.{build}
2image: Visual Studio 2017
3clone_folder: C:\ProxSpace\pm3
4init:
9764d3ea 5- ps: >-
6 $psversiontable
7
8 #Get-ChildItem Env:
9
10
11 $releasename=""
12
13 $env:APPVEYOR_REPO_COMMIT_SHORT = $env:APPVEYOR_REPO_COMMIT.Substring(0, 8)
14
15 if ($env:appveyor_repo_tag -match "true"){
16 $releasename=$env:APPVEYOR_REPO_TAG_NAME + "/"
17 }
18
19 $releasename+=$env:APPVEYOR_BUILD_VERSION + " [" + $env:APPVEYOR_REPO_COMMIT_SHORT + "]"
20
21
22 Write-Host "repository: $env:appveyor_repo_name branch:$env:APPVEYOR_REPO_BRANCH release: $releasename" -ForegroundColor Yellow
23
24 Add-AppveyorMessage -Message "[$env:APPVEYOR_REPO_COMMIT_SHORT]$env:appveyor_repo_name($env:APPVEYOR_REPO_BRANCH)" -Category Information -Details "repository: $env:appveyor_repo_name branch: $env:APPVEYOR_REPO_BRANCH release: $releasename"
25
26
27 iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
ef9746cb
OM
28clone_script:
29- ps: >-
30 Write-Host "Removing ProxSpace..." -NoNewLine
31
32 cd \
33
34 Remove-Item -Recurse -Force -Path c:\ProxSpace\*
35
36 Write-Host "[ OK ]" -ForegroundColor Green
37
38
39 Write-Host "Git clone ProxSpace..." -NoNewLine
40
41 git clone -q https://github.com/Gator96100/ProxSpace c:\ProxSpace
42
43 Write-Host "[ OK ]" -ForegroundColor Green
44
45
46 Write-Host "Removing pm3 dir..." -NoNewLine
47
48 Remove-Item -Recurse -Force -Path c:\ProxSpace\pm3\*
49
50 Write-Host "[ OK ]" -ForegroundColor Green
51
52
53 Write-Host "Cloning repository <$env:appveyor_repo_name> to $env:appveyor_build_folder ..." -NoNewLine
54
55 if(-not $env:appveyor_pull_request_number) {
56 git clone -q --branch=$env:appveyor_repo_branch https://github.com/$env:appveyor_repo_name.git $env:appveyor_build_folder
57 cd $env:appveyor_build_folder
58 git checkout -qf $env:appveyor_repo_commit
59 } else {
60 git clone -q https://github.com/$env:appveyor_repo_name.git $env:appveyor_build_folder
61 cd $env:appveyor_build_folder
62 git fetch -q origin +refs/pull/$env:appveyor_pull_request_number/merge:
63 git checkout -qf FETCH_HEAD
64 }
65
66 Write-Host "[ OK ]" -ForegroundColor Green
67
68
69 Write-Host "Fill msys\etc\fstab file..." -NoNewLine
70
71 New-Item c:\ProxSpace\msys\etc\fstab -type file -force -value "#Win32_Path Mount_Point`nc:\ProxSpace\devkitARM /devkitARM`nc:\ProxSpace\Qt\5.6 /qt `nc:\ProxSpace\pm3 /pm3`n"
72
73 Write-Host "[ OK ]" -ForegroundColor Green
74install:
75- ps: >-
76 function Exec-External {
77 param(
78 [Parameter(Position=0,Mandatory=1)][scriptblock] $command
79 )
80 & $command
81 if ($LASTEXITCODE -ne 0) {
82 throw ("Command returned non-zero error-code ${LASTEXITCODE}: $command")
83 }
84 }
85build_script:
9764d3ea 86- ps: >-
87 $env:Path = "C:\ProxSpace\msys\bin;$env:Path"
88
89
90 #make
91
92 bash -lc -i "pwd;make all"
93
94
95 #some checks
96
97 if(!(Test-Path C:\ProxSpace\pm3\client\proxmark3.exe)){
98
99 throw "Main file proxmark3.exe not exists."
100
101 }
102
103 if(!(Test-Path C:\ProxSpace\pm3\armsrc\obj\fullimage.elf)){
104
105 throw "ARM file fullimage.elf not exists."
106
107 }
108
109 if(!(Test-Path C:\ProxSpace\pm3\client\hardnested\tables\*.bin.z)){
110
111 throw "Files in hardnested\tables not exists."
112
113 }
114
115
116 #copy
117
118 Write-Host "Copy release files..." -NoNewLine -ForegroundColor Yellow
119
120 New-Item -ItemType Directory -Force -Path C:\ProxSpace\Release
121
122 Copy-Item C:\ProxSpace\pm3\client\*.exe C:\ProxSpace\Release
123
124 New-Item -ItemType Directory -Force -Path C:\ProxSpace\Release\arm
125
126 Copy-Item C:\ProxSpace\pm3\armsrc\obj\*.elf C:\ProxSpace\Release\arm
127
128 Copy-Item C:\ProxSpace\pm3\bootrom\obj\*.elf C:\ProxSpace\Release\arm
129
130 New-Item -ItemType Directory -Force -Path C:\ProxSpace\Release\scripts
131
132 Copy-Item C:\ProxSpace\pm3\client\scripts\*.lua C:\ProxSpace\Release\scripts
133
134 New-Item -ItemType Directory -Force -Path C:\ProxSpace\Release\hardnested\tables
135
136 Copy-Item C:\ProxSpace\pm3\client\hardnested\*.bin C:\ProxSpace\Release\hardnested
137
138 Copy-Item C:\ProxSpace\pm3\client\hardnested\tables\*.bin.z C:\ProxSpace\Release\hardnested\tables
139
140 Write-Host "[ OK ]" -ForegroundColor Green
141
142
143 #archive and push
144
145 $releasename=""
146
147 if ($env:appveyor_repo_tag -match "true"){
148
149 $releasename=$env:APPVEYOR_REPO_TAG_NAME + "/"
150
151 }
152
153 $releasename+=$env:APPVEYOR_BUILD_VERSION + " [" + $env:APPVEYOR_REPO_COMMIT.Substring(0, 7) + "]"
154
155
156 Write-Host "Archive and publish release files ($releasename)..." -NoNewLine -ForegroundColor Yellow
157
158 cd C:\ProxSpace
159
160 7z a release.zip C:\ProxSpace\Release
161
162 Push-AppveyorArtifact release.zip -DeploymentName "$releasename"
163
164 Write-Host "[ OK ]" -ForegroundColor Green
165
166
167 Write-Host "Builded..." -ForegroundColor Yellow
ef9746cb 168test_script:
9764d3ea 169- ps: >-
170 $env:Path = "C:\ProxSpace\msys\bin;$env:Path"
171
172 cd c:\ProxSpace\pm3
173
174
175 $global:TestsPassed=$true
176
177
178 Function ExecTest($Name, $File, $Cmd) {
179
180 #--- begin Job
181
182 $Job = Start-Job -ScriptBlock {
183 [bool]$res=$false
184 $TestTime=[System.Environment]::TickCount
185 $env:Path = "C:\ProxSpace\msys\bin;$env:Path"
186 Set-Location $using:PWD
187
188 $sb=[scriptblock]::Create("$using:Cmd")
189 #execute scriptblock
b5381d70 190 Write-host "Test [$using:Name] job: $using:Cmd"
9764d3ea 191 $Cond=&$sb
b5381d70 192 Write-host "Result[$using:Name]: $Cond"
9764d3ea 193
194 if ($Cond -eq $null){
195 } Else {
196 If (!($Cond -is [bool] -or $Cond -is [byte] -or $Cond -is [int16] -or $Cond -is [int32] -or $Cond -is [int64] -or $Cond -is [float])){
197 if ($Cond -is "String" -and $Cond -like "*passed*"){
198 $res= $true
199 }
200 if ($Cond -is "String" -and $Cond -like "*true*"){
201 $res= $true
202 }
203 } Else {
204 $res=$Cond
205 }
206 }
207
208 If ($res) {
209 Add-AppveyorTest -Name "$using:Name" -Framework NUnit -Filename "$using:File" -Outcome Passed -Duration "$([System.Environment]::TickCount-$TestTime)"
210 }Else {
211 Add-AppveyorTest -Name "$using:Name" -Framework NUnit -Filename "$using:File" -Outcome Failed -Duration "$([System.Environment]::TickCount-$TestTime)" -ErrorMessage "command:$using:Cmd`nresult:$Cond"
212 }
213 return $res
214 }
215
216 #--- end Job
217
218 [bool]$res=$false
219 # Wait 40 sec timeout for Job
220 if(Wait-Job $Job -Timeout 40){
221 $Results = $Job | Receive-Job
222 if($Results -like "true"){
223 $res=$true
224 }
225 } else {
b5381d70 226 Write-host "Test [$Name] timeout" -ForegroundColor Red
9764d3ea 227 Add-AppveyorTest -Name "$Name" -Framework NUnit -Filename "$File" -Outcome Failed -Duration 40000 -ErrorMessage "timeout"
228 }
229 Remove-Job -Force $Job
230
231 if(!$res){
232 $global:TestsPassed=$false
233 }
234 }
235
236
237 Write-Host "Running tests..." -ForegroundColor Yellow
238
239
240 #file test
241
242 ExecTest "proxmark3 exists" "proxmark3.exe" {Test-Path C:\ProxSpace\Release\proxmark3.exe}
243
244 ExecTest "arm image exists" "\arm\fullimage1.elf" {Test-Path C:\ProxSpace\Release\arm\fullimage.elf}
245
246 ExecTest "bootrom exists" "bootrom.elf" {Test-Path C:\ProxSpace\Release\arm\bootrom.elf}
247
248 ExecTest "hardnested tables exists" "hardnested" {Test-Path C:\ProxSpace\Release\hardnested\tables\*.z}
249
250 ExecTest "release exists" "release.zip" {Test-Path C:\ProxSpace\release.zip}
251
252
253 #proxmark logic tests
254
255 ExecTest "proxmark help" "proxmark3 -h" {bash -lc 'cd ~/client;proxmark3 -h | grep -q Execute && echo Passed || echo Failed'}
256
257 ExecTest "proxmark help hardnested" "proxmark3 -h" {bash -lc 'cd ~/client;proxmark3 -h | grep -q hardnested && echo Passed || echo Failed'}
258
259
260 ExecTest "hf mf offline text" "hf mf" {bash -lc "cd ~/client;proxmark3 comx -c 'hf mf' | grep -q at_enc && echo Passed || echo Failed"}
261
262 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"}
263
264
265 if ($global:TestsPassed) {
266 Write-Host "Tests [ OK ]" -ForegroundColor Green
267 } else {
268 Write-Host "Tests [ ERROR ]" -ForegroundColor Red
269 throw "Tests error."
270 }
ef9746cb
OM
271on_success:
272- ps: Write-Host "Build success..." -ForegroundColor Green
273on_failure:
274- ps: Write-Host "Build error." -ForegroundColor Red
275on_finish:
da36bed9 276- ps: $blockRdp = $false; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
Impressum, Datenschutz