singe/testScripts/ports/sweep.sh
2026-09-22 18:32:07 -05:00

68 lines
2.6 KiB
Bash
Executable file

#!/bin/bash
# Compares every port with its original for a while each (FORGE.md section 14.1), two pairs at
# a time, and prints one line per title: the ActionMax five, the KarisFramework games and the
# map-mode games of the library, and the Hypseus titles (Karis 3.32b, Kimmy, map-mode, and Time
# Gal HD), each through compare.sh's family for it.
#
# testScripts/ports/sweep.sh [<frames>] (default 6000; 0 for the full length)
#
# SINGE, SINGE_RUN as compare.sh takes them; the library is ~/claude/singetest.
set -u
frames=${1:-6000}
repo=$(cd "$(dirname "$0")/../.." && pwd)
library=$HOME/claude/singetest
run=${SINGE_RUN:-$(mktemp -d /tmp/forgeSweep.XXXXXX)}
export SINGE_RUN=$run
if [[ "$frames" != "0" ]]; then
export PORT_FRAMES=$frames
fi
jobs=()
# One pair: family, game, and the library it lives in.
pair() {
local family=$1 game=$2 lib=$3
local out
# Each pair runs in a directory of its own: compare.sh refreshes Forge into its run
# directory at every start, which would pull it from under a pair already running there.
out=$(SINGE_RUN=$run/${game//\//_} SINGE_LIBRARY=$lib "$repo/testScripts/ports/compare.sh" "$family" "$game" 2>&1 | grep -a -v "hwaccel\|XIO" | grep -a "plays as\|differ\|no trace\|compare.sh" | tail -1)
echo "${out:-$family $game: no result}"
}
# Two at a time: three engines have run the machine out of memory.
throttle() {
while (( $(jobs -rp | wc -l) >= 2 )); do
sleep 5
done
}
for game in 38AmbushAlley BlueThunder Hydrosub2021 PopsGhostly SonicFury; do
throttle
pair actionMax "$game" "$library/ported" &
done
for desc in "$library"/ported/*/*.forge; do
folder=$(basename "$(dirname "$desc")")
[[ "$folder" == "ActionMax" || "$folder" == "hypseus" ]] && continue
throttle
pair karis "$folder/$(basename "${desc%.forge}").singe" "$library/ported" &
done
# The map-mode games keep their script in Script/ (in ported/ once they agree, in the library
# root until then).
for lib in "$library/ported" "$library"; do
for desc in "$lib"/*/Script/*.forge; do
[[ -f "$desc" ]] || continue
folder=$(basename "$(dirname "$(dirname "$desc")")")
throttle
pair karis "$folder/Script/$(basename "${desc%.forge}").singe" "$lib" &
done
done
for title in "$library"/ported/hypseus/*/; do
title=$(basename "$title")
desc=$(find -L "$library/ported/hypseus/$title/singe" -mindepth 2 -maxdepth 2 -name "*.forge" 2>/dev/null | head -1)
[[ -n "$desc" ]] || continue
family=hypseus
if grep -a -q 'kind = "rdg"\|kind = "timegal"' "$desc"; then
family=rdg
elif grep -a -q 'kind = "alg"' "$desc"; then
family=alg
fi
throttle
pair "$family" "$title" "$library/ported/hypseus" &
done
wait