#!/bin/bash # SPDX-License-Identifier: GPL-3.0-or-later # Opt-in: requires a legally supplied CoCo 3 ROM and a real Mac audio output. set -euo pipefail if [[ $# -lt 3 || $# -gt 4 ]]; then echo 'Usage: run-sustained-check.sh ROM seconds 6809|6309 [silent]' >&2 exit 2 fi repo_dir="$(cd "$(dirname "$0")/../.." && pwd)" build_dir="${VCC_CHECK_BUILD_DIR:-${TMPDIR:-/tmp}/vcc-sustained-build}" check_arch="${VCC_CHECK_ARCH:-$(uname -m)}" case "$check_arch" in arm64|x86_64) ;; *) echo 'VCC_CHECK_ARCH must be arm64 or x86_64' >&2; exit 2 ;; esac # Resolve a relative ROM before changing to the repository directory. rom_path="$1" if [[ "$rom_path" != /* ]]; then rom_path="$PWD/$rom_path"; fi shift mkdir -p "$build_dir" build_dir="$(cd "$build_dir" && pwd)" cd "$repo_dir" xcodebuild -project platforms/macos/VCC.xcodeproj -scheme VCCCoreChecks \ -configuration Release -derivedDataPath "$build_dir" \ SDK_STAT_CACHE_ENABLE=NO build > "$build_dir/build.log" 2>&1 || { tail -60 "$build_dir/build.log" >&2; exit 1; } xcrun clang++ -std=c++17 -O2 -fobjc-arc -arch arm64 -arch x86_64 \ -mmacosx-version-min=14.0 -Isrc/core -Isrc -Iplatforms/windows/libcommon -Iplatforms/macos/Bridge \ tests/macos/SustainedChecks.mm platforms/macos/Bridge/VCCMachineController.mm \ platforms/macos/Bridge/MacAudioOutput.mm "$build_dir/Build/Products/Release/libVCCCore.a" \ -framework Foundation -framework AVFoundation -framework AudioToolbox \ -o "$build_dir/SustainedChecks" exec caffeinate -i arch "-$check_arch" "$build_dir/SustainedChecks" "$rom_path" "$@"