選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

60 行
3.1KB

  1. <#
  2. .SYNOPSIS
  3. Regression suite for the toolchain, templates, projects, and examples.
  4. .DESCRIPTION
  5. Run after changing tools/, templates/, lib/, or an example:
  6. pwsh tools/regress.ps1 (or: .\c64.cmd is not needed; this calls the module)
  7. Exit code 0 when every case passes. About 2 minutes.
  8. #>
  9. $ErrorActionPreference = "Stop"
  10. Import-Module (Join-Path $PSScriptRoot "C64Tools.psm1") -Force
  11. $root = Split-Path $PSScriptRoot -Parent
  12. Push-Location $root
  13. $scratch = Join-Path ([IO.Path]::GetTempPath()) ("c64-regress-" + [Guid]::NewGuid().ToString("N").Substring(0, 8))
  14. New-Item -ItemType Directory -Path $scratch | Out-Null
  15. $blank = Join-Path $scratch "blank.d64"
  16. & (Get-C64Tool "c1541") -format "work,01" d64 $blank 2>&1 | Out-Null
  17. $cases = @(
  18. @{ Path = "$scratch\t-c"; New = "c" },
  19. @{ Path = "$scratch\t-asm"; New = "asm" },
  20. @{ Path = "$scratch\t-basic"; New = "basic" },
  21. @{ Path = "skirmish-game" },
  22. @{ Path = "samples/kernal-os-skeleton" },
  23. @{ Path = "samples/kernal-os-skeleton"; Keys = "help\n"; AfterJiffies = 700; Expect = @("ABOUT EXIT") },
  24. @{ Path = "samples/cc65-mouse-driver-demo" },
  25. @{ Path = "examples/hello-world.asm"; Until = "done"; Expect = @("HELLO, WORLD!") },
  26. @{ Path = "examples/kernal-io.asm"; Keys = "hello\n"; Until = "main_done"; Expect = @("YOU TYPED: HELLO") },
  27. @{ Path = "examples/bitmap-demo.asm"; Until = "wait_key" },
  28. @{ Path = "examples/irq-handler.asm"; AfterJiffies = 300; Expect = @("READY.") },
  29. @{ Path = "examples/moonlander.c"; AfterJiffies = 400; Expect = @("MOONLANDER", "PRESS FIRE") },
  30. @{ Path = "examples/linked-list-test.c"; AfterJiffies = 400; Expect = @("N=1000 PASS") },
  31. @{ Path = "examples/sprite-demo.bas"; AfterJiffies = 400 },
  32. @{ Path = "examples/sprite-music-demo.bas"; AfterJiffies = 400 },
  33. @{ Path = "examples/sound-demo.bas"; AfterJiffies = 400 },
  34. @{ Path = "examples/disk-access.bas"; Disk = $blank; Expect = @("READ: LAST RECORD", "BLOCKS FREE", "DONE.") }
  35. )
  36. $results = foreach ($c in $cases) {
  37. $label = if ($c.New) { "template $($c.New)" } else { $c.Path }
  38. if ($c.ContainsKey("Keys")) { $label += " (keys)" }
  39. try {
  40. if ($c.New) { [void](New-C64Project -Name (Split-Path $c.Path -Leaf) -Template $c.New -Destination $c.Path) }
  41. $testArgs = @{ Path = $c.Path }
  42. foreach ($k in "Until", "AfterJiffies", "Keys", "Disk", "Expect") { if ($c.ContainsKey($k)) { $testArgs[$k] = $c[$k] } }
  43. $r = Invoke-C64Test @testArgs 6>$null
  44. [pscustomobject]@{ Case = $label; Passed = $r.passed; Reason = $r.reason; Seconds = $r.seconds }
  45. } catch {
  46. [pscustomobject]@{ Case = $label; Passed = $false; Reason = $_.Exception.Message; Seconds = 0 }
  47. }
  48. }
  49. Pop-Location
  50. Remove-Item -LiteralPath $scratch -Recurse -Force -ErrorAction SilentlyContinue
  51. $results | Format-Table Case, Passed, Seconds, Reason -AutoSize | Out-String -Width 200 | Write-Host
  52. $failed = @($results | Where-Object { -not $_.Passed })
  53. Write-Host ("{0}/{1} passed" -f ($results.Count - $failed.Count), $results.Count) -ForegroundColor $(if ($failed) { "Red" } else { "Green" })
  54. exit $(if ($failed) { 1 } else { 0 })

Powered by TurnKey Linux.