Publish VCC Plus OSS source distribution for 3.6.2 build 60
This commit is contained in:
commit
c652a5276d
1192 files changed
+272368
No files matched your search
@@ -0,0 +1,65 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
"""Test the recoverable save in Book 6's return-trip lesson on each Disk BASIC storage setup."""
|
||||
import argparse
|
||||
import os
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import subprocess
|
||||
import tempfile
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("runtime", type=Path)
|
||||
parser.add_argument("core", type=Path)
|
||||
parser.add_argument("roms", type=Path)
|
||||
parser.add_argument("--capture", type=Path, help="save the completed Mars flight and a companion -retry PNG")
|
||||
args = parser.parse_args()
|
||||
runtime, core, roms = [p.resolve(strict=True) for p in (args.runtime, args.core, args.roms)]
|
||||
fixture = Path(__file__).resolve().parent
|
||||
root = fixture.parents[2]
|
||||
blank = root / "docs/manuals/software-storage-and-peripherals/media/BLANK.DSK"
|
||||
source = root / "examples/cmoc/manual/returntrip.c"
|
||||
tool = runtime / "bin/writecocofile"
|
||||
env = dict(os.environ, VCC_CMOC_COMPAT="1", PATH=str(runtime / "bin") + os.pathsep + os.environ["PATH"])
|
||||
earth = b"VISIT 1: EARTH\r"
|
||||
mars = earth + b"VISIT 2: MARS\r"
|
||||
with tempfile.TemporaryDirectory(prefix="vcc-return-trip-") as tmp:
|
||||
work = Path(tmp)
|
||||
|
||||
def run(*command, **kwargs):
|
||||
return subprocess.run(command, cwd=work, env=env, check=True, **kwargs)
|
||||
|
||||
run("xcrun", "clang++", "-std=c++17", "-O2", "-mmacosx-version-min=14.0",
|
||||
"-I", root / "src", fixture / "returntrip.cpp", core, "-o", "run")
|
||||
(work / "TRIP.LOG").write_bytes(b"ANOTHER CREW'S FLIGHT PLAN\r")
|
||||
shutil.copyfile(blank, work / "other.dsk")
|
||||
run(tool, "--binary", "other.dsk", "TRIP.LOG")
|
||||
for folder in ("card", "other"):
|
||||
(work / folder).mkdir()
|
||||
(work / folder / "startup.cfg").write_text("0=VOL.DSK\n")
|
||||
for opt in ("-O0", "-O2"):
|
||||
run(runtime / "bin/cmoc", "--coco", opt, "-Werror", "--org=2800", "-o", "TRIP.BIN",
|
||||
source, "-lvcccompat", "-ldecbfile")
|
||||
shutil.copyfile(blank, work / "launch.dsk")
|
||||
run(tool, "launch.dsk", "TRIP.BIN")
|
||||
for cpu in ("6809", "6309"):
|
||||
for profile in ("disk", "rgb-hd", "sdc"):
|
||||
shutil.copyfile(work / "launch.dsk", work / "card/VOL.DSK")
|
||||
shutil.copyfile(work / "other.dsk", work / "other/VOL.DSK")
|
||||
capture = args.capture and (cpu, opt, profile) == ("6809", "-O2", "disk")
|
||||
run("./run", roms, "TRIP.BIN", cpu, profile, "capture" if capture else "check")
|
||||
for disk, expected in (("earth.dsk", earth), ("mars.dsk", mars)):
|
||||
actual = run(tool, "--stdout", disk, "TRIP.LOG", stdout=subprocess.PIPE).stdout
|
||||
if actual != expected:
|
||||
raise AssertionError(f"{cpu} {opt} {profile} {disk}: {actual!r}")
|
||||
if capture:
|
||||
for suffix in ("", "-retry"):
|
||||
target = args.capture.with_stem(args.capture.stem + suffix)
|
||||
run("sips", "-s", "format", "png", f"trip{suffix}.ppm", "--out", target.resolve())
|
||||
print(f"PASS {cpu} {opt} {profile}: Earth, protected quit and refusal, successful flush retry, "
|
||||
"exact Earth and Mars bytes, completed trip, unrelated file, BASIC return", flush=True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in new issue
Block a user