25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
2.1KB

  1. # E04-S06: parse STMTS.N8 in x128, run the emitted body, and check the locals
  2. # and the bytes the generated print calls asked for.
  3. [CmdletBinding()]
  4. param([int]$Port = 6560, [int]$TimeoutSeconds = 180)
  5. $ErrorActionPreference = "Stop"
  6. $project = Split-Path $PSScriptRoot -Parent
  7. Import-Module (Join-Path $PSScriptRoot "lib\Nova128Test.psm1") -Force
  8. & (Join-Path $PSScriptRoot "build-statements-test.ps1")
  9. $out = Join-Path $project "build\statements-test"
  10. $disk = Join-Path $out "statements-test.d81"
  11. $failures = @()
  12. $lbl = Get-Content -Raw -LiteralPath (Join-Path $out "statements-test.lbl")
  13. if ($lbl -notmatch "([0-9A-Fa-f]{6})\s+\.rec_buf\b") { throw "rec_buf not in the label file" }
  14. $recBuf = [Convert]::ToInt32($matches[1], 16)
  15. $session = Start-Nova128X128 -Autostart $disk -Drive8Image $disk -Port $Port `
  16. -Screenshot (Join-Path $out "statements-vicii.png")
  17. try {
  18. $mb = Wait-Nova128Mailbox $session -TimeoutSeconds $TimeoutSeconds
  19. $log = Read-Nova128Memory $session $recBuf 16
  20. } finally {
  21. Stop-Nova128X128 $session
  22. }
  23. Write-Host ("mailbox: " + (($mb | ForEach-Object { $_.ToString('X2') }) -join ' '))
  24. Write-Host ("recorded: " + (($log | ForEach-Object { $_.ToString('X2') }) -join ' '))
  25. if ($mb[2] -ne 0x02) { $failures += ("producer $($mb[2]) expected 2 (compiler)") }
  26. if ($mb[3] -ne 0xA5) {
  27. $failures += ("fixture status {0:X2} failed at stage {1}" -f $mb[3], $mb[4])
  28. }
  29. if ($mb[8] -ne 0) { $failures += "diagnostics present: $($mb[8])" }
  30. if ($mb[9] -ne 0) { $failures += "emitter error $($mb[9])" }
  31. if ($mb[10] -ne 2) { $failures += ("a = {0}, expected 2 (loop variable past end)" -f $mb[10]) }
  32. if ($mb[11] -ne 3) { $failures += ("b = {0}, expected 3" -f $mb[11]) }
  33. if ($mb[12] -lt 60) { $failures += "emitted only $($mb[12]) bytes" }
  34. if ($mb[13] -ne 0) { $failures += "codegen error $($mb[13])" }
  35. if ($mb[14] -ne 0) { $failures += ("recorded {0} bytes, expected none" -f $mb[14]) }
  36. if ($failures) { throw ("statements verification failed:`n " + ($failures -join "`n ")) }
  37. Write-Host ("emitted {0} bytes; a=2, b=3" -f $mb[12])
  38. Write-Host "verified parser pass-2 statement emission executes in x128"

Powered by TurnKey Linux.