PT
games/alis / tools / compiled / check.sh · commit 9c722cf
#!/usr/bin/env bash# The scripts compiled to PHP must behave exactly like the VM: a recorded session replayed by both, the checksums of# the VM's memory and registers compared picture by picture (tools/run.php --memcrc).#   games/alis/tools/compiled/check.sh <tag> [inputs.jsonl] [edition: hd|source|original] [groups: Flow,Expressions,... | from:<dir>]# (from:<dir> = the scripts in PHP of that folder, games/alis-relative: tools/compiled/readable.php, edited or not)# from the repository root; prints "same N pictures" or the first picture that differs.set -euo pipefailtag="${1:-check}"; inputs="${2:-var/trace/20261114-183050/inputs.jsonl}"; edition="${3:-hd}"; groups="${4:-}"case "$edition" in hd) flags="--source --hd --hd3d" ;; source) flags="--source" ;; *) flags="" ;; esaccd "$(dirname "$0")/../../../.."run() { local name="$1"; shift; bin/jumphp php games/alis tools/run.php data/robinson 1 0 "" $flags --memcrc "$@" --replay="$inputs" 1 "cmp-$tag-$name" >/dev/null 2>&1 || true; }run vm; case "$groups" in from:*) run php --compiled-from="${groups#from:}"; groups="" ;; "") run php --compiled ;; *) run php --compiled-only="$groups" ;; esac# how much is compiled (with these groups)bin/jumphp php games/alis tools/run.php data/robinson 1 0 "" $flags ${groups:+--compiled-only=$groups} --compiled --replay="$inputs" 1 "cmp-$tag-stats" 2>/dev/null | grep "compiled scripts" || truerm -f games/alis/var/trace.ona="games/alis/var/cmp-$tag-vm/memcrc.txt"; b="games/alis/var/cmp-$tag-php/memcrc.txt"if cmp -s "$a" "$b"; then echo "same $(wc -l < "$a") pictures"; exit 0; fiecho "DIFFERENT: first difference (picture checksum D7 D6 strings):"diff "$a" "$b" | head -6exit 1