Skip to content

Commit

Permalink
Update Windows github action to run test of axpbox rom
Browse files Browse the repository at this point in the history
  • Loading branch information
Remy van Elst committed May 1, 2024
1 parent f3bd6f4 commit 1ea19ae
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/build-test-and-artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ jobs:
working-directory: ${{runner.workspace}}/build
run: ${{runner.workspace}}\build\Release\axpbox.exe

- name: Run rom tests script
working-directory: ${{runner.workspace}}/build
run: ${{runner.workspace}}\axpbox\test\rom\test.ps1


- name: Upload AXPbox Binary
uses: actions/upload-artifact@v1
with:
Expand Down
55 changes: 55 additions & 0 deletions test/rom/test.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Download the firmware
Invoke-WebRequest -Uri 'http://raymii.org/s/inc/downloads/es40-srmon/cl67srmrom.exe' -OutFile 'cl67srmrom.exe'

ls

ls ..

ls ../../

ls ../../../

ls ../../../

# Start AXPbox
Start-Process '..\..\..\build\Release\axpbox' -ArgumentList 'run' -NoNewWindow -RedirectStandardOutput stdout.txt -RedirectStandardError stderr.txt

# Wait for AXPbox to start
Start-Sleep -Seconds 5


Get-Content stdout.txt
Get-Content stderr.txt

# Connect to terminal
Start-Process -FilePath 'nc' -ArgumentList '-t', '127.0.0.1', '21000' -NoNewWindow -RedirectStandardOutput 'axp.log'

# Wait for the last line of log to become P00>>>
$timeout = 600
while ($true) {
if ($timeout -eq 0) {
Write-Host "waiting for SRM prompt timed out" -ForegroundColor Red
exit 1
}

# print last line and remove null byte from it
$lastLine = Get-Content -Path 'axp.log' | Select-Object -Last 1
if ($lastLine.Replace([char]0, '') -eq "P00>>>") {
break
}

Start-Sleep -Seconds 1
$timeout--
}

Stop-Process -Name 'nc'

# Diff logs
Write-Host -NoNewline -ForegroundColor DarkRed ""
Compare-Object -ReferenceObject (Get-Content 'axp_correct.log') -DifferenceObject (Get-Content 'axp.log') | Format-Table
Write-Host -NoNewline -ForegroundColor DarkGreen "diff clean"
$result = $LASTEXITCODE
Write-Host -NoNewline -ForegroundColor White ""

Remove-Item -Path 'axp.log', 'cl67*', '*.rom'
exit $result

0 comments on commit 1ea19ae

Please sign in to comment.