# SPDX-License-Identifier: GPL-3.0-or-later """Run the Speech/Sound C API fixture on both guest CPUs with private local ROMs.""" import argparse from pathlib import Path import subprocess import tempfile def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("runtime", type=Path, help="staged Toolchain directory containing libssc.a") parser.add_argument("core", type=Path, help="current libVCCCore.a") parser.add_argument("roms", type=Path, help="directory with CoCo 3, Disk BASIC, PIC and speech ROMs") parser.add_argument("--lander", type=Path, help="also run LANDER.bin and LANDER.dsk from this directory") parser.add_argument("--captures", type=Path, help="directory for the Lander stereo WAVs (requires --lander)") args = parser.parse_args() if bool(args.lander) != bool(args.captures): parser.error("--lander and --captures must be supplied together") fixture = Path(__file__).resolve().parent roms = args.roms.resolve() with tempfile.TemporaryDirectory(prefix="vcc-ssc-") as work: subprocess.run([args.runtime.resolve() / "bin/cmoc", "--coco", "-O2", "-Werror", "-o", "QUAL.BIN", fixture / "qualification.c", "-lssc"], cwd=work, check=True) subprocess.run(["xcrun", "clang++", "-std=c++17", "-O2", "-mmacosx-version-min=14.0", fixture / "run.cpp", args.core.resolve(), "-o", "run-ssc"], cwd=work, check=True) command = ["./run-ssc", roms / "coco3.rom", roms / "disk11.rom", roms / "pic-7040-510.bin", roms / "sp0256-al2.bin", "QUAL.BIN"] if args.lander: project = args.lander.resolve() command.extend([project / "LANDER.bin", project / "LANDER.dsk", args.captures.resolve()]) subprocess.run(command, cwd=work, check=True) if __name__ == "__main__": main()