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,57 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
"""Build Planet Expedition from source and fly its real disks under SDC-DOS."""
|
||||
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 guest's Mars landing 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-planet-expedition-") as tmp:
|
||||
work = Path(tmp)
|
||||
run = work / "run"
|
||||
subprocess.run(["xcrun", "clang++", "-std=c++17", "-O2", "-mmacosx-version-min=14.0",
|
||||
"-I", root / "src", fixture / "run.cpp", core, "-o", run], check=True)
|
||||
for config in ("Debug", "Release"):
|
||||
project = work / config
|
||||
shutil.copytree(root / "examples/cmoc/PlanetExpedition", project)
|
||||
subprocess.run([runtime / "bin/make", "-j3", "VCC_CONFIGURATION=" + config],
|
||||
cwd=project, env=env, check=True)
|
||||
card = project / "EXPED"
|
||||
if {p.name for p in card.iterdir()} != {"EXPLORE.DSK", "EARTH.DSK", "MARS.DSK"}:
|
||||
raise AssertionError("Expected the three practice images in EXPED")
|
||||
originals = {p.name: p.read_bytes() for p in card.iterdir()}
|
||||
capture = bool(args.capture) and config == "Release"
|
||||
subprocess.run([run, roms, card, project / "EXPLORE.BIN", "capture" if capture else "check"],
|
||||
cwd=work, check=True)
|
||||
if {p.name: p.read_bytes() for p in card.iterdir()} != originals:
|
||||
raise AssertionError("The guest changed the practice card or the starter disk")
|
||||
if capture:
|
||||
subprocess.run(["sips", "-s", "format", "png", work / "expedition.ppm",
|
||||
"--out", args.capture.resolve()], check=True)
|
||||
if config == "Release":
|
||||
(project / "assets/mars.txt").write_text("MARS: ICE CAP\nLAND NEAR THE POLE.\n")
|
||||
subprocess.run([runtime / "bin/make", "VCC_CONFIGURATION=Release"], cwd=project, env=env, check=True)
|
||||
if (card / "MARS.DSK").read_bytes() == originals["MARS.DSK"]:
|
||||
raise AssertionError("Editing the Mars landing instructions did not rebuild the data disk")
|
||||
for name in ("EARTH.DSK", "EXPLORE.DSK"):
|
||||
if (card / name).read_bytes() != originals[name]:
|
||||
raise AssertionError(f"Unrelated image {name} changed")
|
||||
subprocess.run([run, roms, card, project / "EXPLORE.BIN", "edited"], cwd=work, check=True)
|
||||
print(f"PASS {config}: directory, disk load, two destinations, missing disk, direct Run and read-only media")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in new issue
Block a user