Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

41 rinda
2.0KB

  1. # E02-S03: run the name-table test in x128 and require its dump to equal the
  2. # host-computed build/names-test/expected.bin byte for byte.
  3. [CmdletBinding()]
  4. param([int]$Port = 6533, [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-names-test.ps1")
  9. $out = Join-Path $project "build\names-test"
  10. $disk = Join-Path $out "names-test.d81"
  11. $screenshot = Join-Path $out "names-test-vicii.png"
  12. $expected = [IO.File]::ReadAllBytes((Join-Path $out "expected.bin"))
  13. $session = Start-Nova128X128 -Autostart $disk -Drive8Image $disk -Port $Port -Screenshot $screenshot
  14. try {
  15. $mb = Wait-Nova128Mailbox $session -TimeoutSeconds $TimeoutSeconds
  16. $dump = Read-Nova128Memory $session ($mb[8] + 256 * $mb[9]) ($mb[10] + 256 * $mb[11])
  17. } finally {
  18. Stop-Nova128X128 $session
  19. }
  20. [IO.File]::WriteAllBytes((Join-Path $out "names-dump.bin"), $dump)
  21. if ($mb[3] -ne 0xA5) { throw ("C128 reported FAIL (code `${0:X2})" -f $mb[4]) }
  22. $limit = [Math]::Min($dump.Length, $expected.Length)
  23. $first = 0
  24. while ($first -lt $limit -and $dump[$first] -eq $expected[$first]) { $first++ }
  25. if ($first -lt $limit -or $dump.Length -ne $expected.Length) {
  26. $from = [Math]::Max(0, $first - 8)
  27. $show = { param($b) ($b[$from..([Math]::Min($b.Length - 1, $first + 8))] | ForEach-Object { $_.ToString("X2") }) -join ' ' }
  28. throw ("dump differs at byte {0} (C128 {1} bytes, expected {2}):`n expected {3}`n C128 {4}" -f
  29. $first, $dump.Length, $expected.Length, (& $show $expected), (& $show $dump))
  30. }
  31. $summary = Get-Content -Raw (Join-Path $out "expected-summary.json") | ConvertFrom-Json
  32. foreach ($s in $summary) {
  33. Write-Host (" {0,-11} {1,3} names, {2} table-full errors" -f $s.Fixture, $s.Names, $s.FullErrors)
  34. }
  35. Write-Host ("verified name table: {0}-byte dump matches the host model exactly, guards intact" -f $dump.Length)
  36. Write-Host "screenshot: $screenshot"

Powered by TurnKey Linux.