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,94 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
"""Build the complete Mission Recorder project and fly it using real guest ROMs."""
|
||||
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, help="staged ToolchainBundle")
|
||||
parser.add_argument("core", type=Path, help="libVCCCore.a for the host architecture")
|
||||
parser.add_argument("roms", type=Path, help="CoCo 3, Disk BASIC and both Speech/Sound ROMs")
|
||||
parser.add_argument("--capture", type=Path, help="save the optimized 6809's live flight as a 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]
|
||||
env = dict(os.environ, PATH=str(runtime / "bin") + os.pathsep + os.environ["PATH"])
|
||||
with tempfile.TemporaryDirectory(prefix="vcc-mission-recorder-") as folder:
|
||||
work = Path(folder)
|
||||
runner = work / "run"
|
||||
subprocess.run(["xcrun", "clang++", "-std=c++17", "-O2", "-mmacosx-version-min=14.0",
|
||||
"-I", root / "src", fixture / "run.cpp", core, "-o", runner], check=True)
|
||||
tool = runtime / "bin/writecocofile"
|
||||
note = b"EARLIER CREW\rDO NOT OVERWRITE\r"
|
||||
blank = root / "platforms/macos/Resources/StarterMedia/Blank Disk.dsk"
|
||||
draft = b"PART OF A PREVIOUS FLIGHT\r"
|
||||
for config in ("Debug", "Release"):
|
||||
project = work / config
|
||||
shutil.copytree(root / "examples/cmoc/MissionRecorder", project)
|
||||
subprocess.run([runtime / "bin/make", "-j3", "disk", "VCC_CONFIGURATION=" + config],
|
||||
cwd=project, env=env, check=True)
|
||||
binary, disk = project / "RECORDER.bin", project / "RECORDER.dsk"
|
||||
occupied = project / "occupied.dsk"
|
||||
shutil.copyfile(disk, occupied)
|
||||
(project / "LOG01.TXT").write_bytes(note)
|
||||
subprocess.run([tool, "--binary", occupied, "LOG01.TXT"], cwd=project, check=True)
|
||||
(project / "LOG02.TMP").write_bytes(draft)
|
||||
subprocess.run([tool, "--binary", occupied, "LOG02.TMP"], cwd=project, check=True)
|
||||
for cpu in ("6809", "6309"):
|
||||
for path in ("direct", "disk", "quiet", "speech", "stereo", "missing", "discard"):
|
||||
media = occupied if path == "disk" else blank
|
||||
original = media.read_bytes()
|
||||
capture = args.capture and (cpu, config, path) == ("6809", "Release", "direct")
|
||||
subprocess.run([runner, roms, cpu, path, binary, media, *(["capture"] if capture else [])],
|
||||
cwd=project, check=True)
|
||||
result = project / "returned.dsk"
|
||||
if path == "discard":
|
||||
if result.read_bytes() != original:
|
||||
raise AssertionError("Discarding a flight changed its disk")
|
||||
else:
|
||||
log = "LOG03.TXT" if path == "disk" else "LOG01.TXT"
|
||||
def extract(name):
|
||||
return subprocess.check_output([tool, "--stdout", result, name], cwd=project)
|
||||
if extract(log) != (project / "printed.bin").read_bytes():
|
||||
raise AssertionError("The saved and printed reports differ")
|
||||
if path == "disk" and extract("LOG01.TXT") != note:
|
||||
raise AssertionError("The earlier report changed")
|
||||
if path == "disk" and extract("LOG02.TMP") != draft:
|
||||
raise AssertionError("An earlier unfinished flight was overwritten")
|
||||
if path == "disk" and extract("RECORDER.BIN") != binary.read_bytes():
|
||||
raise AssertionError("The guest damaged its program disk")
|
||||
if media.read_bytes() != original:
|
||||
raise AssertionError("The test modified its input image")
|
||||
if capture:
|
||||
subprocess.run(["sips", "-s", "format", "png", project / "flight.ppm",
|
||||
"--out", args.capture.resolve()], check=True)
|
||||
print(f"PASS {config}, {binary.stat().st_size} program bytes, {disk.stat().st_size} disk bytes",
|
||||
flush=True)
|
||||
|
||||
# Boot the optimized project disk on the two other BASIC storage profiles.
|
||||
# Read the result from the backing volume used by the guest.
|
||||
profile_runner = work / "profiles"
|
||||
subprocess.run(["xcrun", "clang++", "-std=c++17", "-O2", "-mmacosx-version-min=14.0",
|
||||
"-I", root / "src", fixture / "profiles.cpp", core, "-o", profile_runner], check=True)
|
||||
card = work / "practice card"
|
||||
card.mkdir()
|
||||
(card / "startup.cfg").write_text("0=VOL.DSK\n", encoding="ascii")
|
||||
for cpu in ("6809", "6309"):
|
||||
for profile in ("rgb-hd", "sdc"):
|
||||
volume = card / "VOL.DSK"
|
||||
shutil.copyfile(work / "Release/RECORDER.dsk", volume)
|
||||
subprocess.run([profile_runner, roms, cpu, profile, volume], cwd=work, check=True)
|
||||
report = subprocess.check_output([tool, "--stdout", work / "returned.dsk", "LOG01.TXT"])
|
||||
if report != b"MISSION RECORDER\rSECTOR 07\r":
|
||||
raise AssertionError(f"{cpu} {profile}: unexpected report {report!r}")
|
||||
print(f"PASS {cpu} {profile}: saved starting sector and returned to BASIC", flush=True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in new issue
Block a user