mirror of
https://github.com/bryanthaboi/gen1recomp
synced 2026-10-05 08:57:49 -04:00
clean up
This commit is contained in:
+57
-143
@@ -23,19 +23,6 @@
|
||||
# POKEPORT_IDENTITY=pokeport-test-caches POKEPORT_VERSION=<version> \
|
||||
# POKEPORT_IMPORT_ONLY=1 POKEPORT_IMPORT_ROM="<rom>" love .
|
||||
# An explicit RED_CACHE/GOLD_CACHE/... in the environment always wins.
|
||||
#
|
||||
# T6 runs every top-level tests/game3_*.lua suite (the game3 scenario
|
||||
# coverage: battle, capture, menus, overworld, script specials, save).
|
||||
# Suites self-skip with exit 0 when an artifact they need is absent, so
|
||||
# the tier runs anywhere; nothing is ever skipped by name. Failures not
|
||||
# in KNOWN_GAME3_FAILURES (the docs/game3/game3-suite-sweep-v113.md
|
||||
# baseline) fail the gate; listed ones print as known. GAME3_JOBS sets
|
||||
# suite parallelism (default 8; GAME3_JOBS=1 serializes).
|
||||
#
|
||||
# A failing suite prints its first [FAIL] line (or first crash/error line,
|
||||
# or a dead-worker notice when it produced no output at all) so the cause
|
||||
# is on the terminal, and the per-suite logs are KEPT (path printed) for
|
||||
# triage instead of deleted. No retries anywhere: every failure stands.
|
||||
|
||||
set -uo pipefail
|
||||
|
||||
@@ -146,72 +133,25 @@ run_tier "T1/T2 engine invariants + parity gates" "$LUA" tests/run_engine.lua
|
||||
run_tier "T2 Gen 2 / Crystal suites" "$LUA" tests/run_gen2.lua
|
||||
run_tier "T4 mod-SDK" "$LUA" tests/run_modkit.lua
|
||||
|
||||
# ------- T6: every top-level tests/game3_*.lua suite (273 files)
|
||||
#
|
||||
# Discovery is the tests/game3_*.lua glob -- the same convention the sweep
|
||||
# docs use -- run as standalone "$LUA" <suite> processes. Suites self-skip
|
||||
# with exit 0 when an artifact they need (imported cache, ../pokefirered,
|
||||
# a ROM path, an anim pack) is absent, so a missing artifact never fails
|
||||
# the tier and no suite is ever skipped by name here. A non-zero exit is a
|
||||
# failure: it prints below and fails the tier UNLESS the suite is listed in
|
||||
# KNOWN_GAME3_FAILURES. GAME3_JOBS (default 8) batches the processes.
|
||||
#
|
||||
# KNOWN_GAME3_FAILURES is the frozen 25-failure baseline from
|
||||
# docs/game3/game3-suite-sweep-v113.md minus the two stale G1-contract stubs
|
||||
# fixed this pass (game3_link_session, game3_save_trainer_card) = 23 names,
|
||||
# as a CEILING: a listed suite may fail without failing the gate while the
|
||||
# fix wave burns the list down, and a failure in any suite NOT listed always
|
||||
# fails the gate. Delete a name the moment its suite goes green so a later
|
||||
# regression there fails again.
|
||||
KNOWN_GAME3_FAILURES='game3_battle_ai_test
|
||||
game3_special_events_test
|
||||
game3_special_trade_test
|
||||
game3_cerulean_block_exits_test
|
||||
game3_cerulean_policeman_bill_test
|
||||
game3_collision_npc_dir_test
|
||||
game3_emote_movement_test
|
||||
game3_item_use_and_parcel_test
|
||||
game3_map_onload_test
|
||||
game3_mapscripts_test
|
||||
game3_npc_player_collision_test
|
||||
game3_objects_perm_reset_test
|
||||
game3_runtime_camera_object_test
|
||||
game3_static_encounter_test
|
||||
game3_stitchcoll_escape_warp_test
|
||||
game3_stitchcoll_ghost_ctx_test
|
||||
game3_stitchcoll_move_kinds_test
|
||||
game3_stitchcoll_run_speed_test
|
||||
game3_stitchfield_ground_test
|
||||
game3_vermilion_trash_cans_test
|
||||
game3_viridian_gym_door_test
|
||||
game3_oaks_lab_save_reload_test
|
||||
game3_trainer_sight_test'
|
||||
|
||||
# T6's data-driven suites read imported game3 data (data/generated, packs,
|
||||
# caches) out of the LOVE identity the runner uses: POKEPORT_IDENTITY when
|
||||
# set, otherwise the default pokemon-love2d. A fresh CI checkout has none of
|
||||
# it, and those suites fail while reading it instead of self-skipping -- an
|
||||
# environment gap, not a regression. With the data present (any machine that
|
||||
# has imported a ROM) every failure gates as usual. Test by pointing
|
||||
# POKEPORT_IDENTITY at an empty identity.
|
||||
game3_artifacts_absent() {
|
||||
local ident=${POKEPORT_IDENTITY:-pokemon-love2d}
|
||||
[ -d data/generated ] && return 1
|
||||
local root d
|
||||
for root in "$HOME/Library/Application Support/LOVE/$ident" \
|
||||
"$HOME/.local/share/love/$ident"; do
|
||||
[ -d "$root" ] || continue
|
||||
for d in "$root"/*; do
|
||||
[ -d "$d/data/generated" ] && return 1
|
||||
done
|
||||
game3_kill_jobs() {
|
||||
local p
|
||||
for p in ${GAME3_PIDS:-}; do
|
||||
pkill -TERM -P "$p" 2>/dev/null
|
||||
kill -TERM "$p" 2>/dev/null
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
game3_cleanup() {
|
||||
game3_kill_jobs
|
||||
[ -n "${GAME3_TMP:-}" ] && rm -rf "$GAME3_TMP"
|
||||
}
|
||||
|
||||
run_game3_tier() {
|
||||
local jobs=${GAME3_JOBS:-8}
|
||||
case "$jobs" in ''|*[!0-9]*) jobs=8 ;; esac
|
||||
[ "$jobs" -ge 1 ] || jobs=8
|
||||
local limit=${GAME3_TIMEOUT:-300}
|
||||
case "$limit" in ''|*[!0-9]*) limit=300 ;; esac
|
||||
|
||||
local suites=(tests/game3_*.lua)
|
||||
if [ ! -f "${suites[0]:-}" ]; then
|
||||
@@ -219,26 +159,36 @@ run_game3_tier() {
|
||||
return 1
|
||||
fi
|
||||
local total=${#suites[@]}
|
||||
echo "-- T6 game3: running $total top-level suites, $jobs at a time"
|
||||
echo "-- T6 game3: running $total top-level suites, $jobs at a time, ${limit}s limit each"
|
||||
|
||||
local tmp
|
||||
tmp=$(mktemp -d "${TMPDIR:-/tmp}/game3gate.XXXXXX") || return 1
|
||||
GAME3_TMP=$(mktemp -d "${TMPDIR:-/tmp}/game3gate.XXXXXX") || return 1
|
||||
GAME3_PIDS=""
|
||||
local tmp=$GAME3_TMP
|
||||
trap game3_cleanup EXIT
|
||||
trap 'game3_cleanup; exit 130' INT
|
||||
trap 'game3_cleanup; exit 143' TERM
|
||||
|
||||
local suite base i=0
|
||||
for suite in "${suites[@]}"; do
|
||||
base=${suite##*/}
|
||||
base=${base%.lua}
|
||||
(
|
||||
"$LUA" "$suite" >"$tmp/$base.log" 2>&1
|
||||
perl -e 'alarm shift; exec @ARGV or exit 127' "$limit" "$LUA" "$suite" \
|
||||
>"$tmp/$base.log" 2>&1
|
||||
echo $? >"$tmp/$base.rc"
|
||||
) &
|
||||
) 2>/dev/null &
|
||||
GAME3_PIDS="$GAME3_PIDS $!"
|
||||
i=$((i + 1))
|
||||
[ $((i % jobs)) -eq 0 ] && wait
|
||||
if [ $((i % jobs)) -eq 0 ]; then
|
||||
wait
|
||||
GAME3_PIDS=""
|
||||
fi
|
||||
done
|
||||
wait
|
||||
GAME3_PIDS=""
|
||||
|
||||
local passed=0 known=0 fresh=0
|
||||
local fresh_list=""
|
||||
local passed=0 skipped=0 failed=0
|
||||
local fail_list=""
|
||||
for suite in "${suites[@]}"; do
|
||||
base=${suite##*/}
|
||||
base=${base%.lua}
|
||||
@@ -250,66 +200,44 @@ run_game3_tier() {
|
||||
fi
|
||||
if [ "$rc" = "0" ]; then
|
||||
passed=$((passed + 1))
|
||||
grep -q '^\[skip\]' "$tmp/$base.log" 2>/dev/null && skipped=$((skipped + 1))
|
||||
continue
|
||||
fi
|
||||
if printf '%s\n' "$KNOWN_GAME3_FAILURES" | grep -qx "$base"; then
|
||||
known=$((known + 1))
|
||||
echo " known-fail $suite (exit $rc)"
|
||||
failed=$((failed + 1))
|
||||
fail_list="$fail_list $suite"
|
||||
echo " FAIL $suite (exit $rc)"
|
||||
if [ "$rc" = "142" ]; then
|
||||
echo " | TIMEOUT: killed after ${limit}s (GAME3_TIMEOUT)"
|
||||
tail -6 "$tmp/$base.log" | sed 's/^/ | /'
|
||||
elif [ ! -s "$tmp/$base.log" ]; then
|
||||
echo " | EMPTY OUTPUT: the worker never printed anything" \
|
||||
"(exit $rc; 137/143 = killed, NO-EXIT-CODE = worker never ran) --" \
|
||||
"environment/parallelism problem, NOT a suite assertion"
|
||||
else
|
||||
fresh=$((fresh + 1))
|
||||
fresh_list="$fresh_list $suite"
|
||||
echo " FAIL $suite (exit $rc)"
|
||||
# Name the cause on the spot: assertion vs crash vs dead worker, so a
|
||||
# parallel-only anomaly is classifiable from the tier output alone.
|
||||
if [ ! -s "$tmp/$base.log" ]; then
|
||||
echo " | EMPTY OUTPUT: the worker never printed anything" \
|
||||
"(exit $rc; 137/143 = killed, NO-EXIT-CODE = worker never ran) --" \
|
||||
"environment/parallelism problem, NOT a suite assertion"
|
||||
local cause
|
||||
cause=$(grep -m1 '^\[FAIL\]' "$tmp/$base.log" || true)
|
||||
if [ -n "$cause" ]; then
|
||||
echo " | assert: $cause"
|
||||
else
|
||||
local cause
|
||||
cause=$(grep -m1 '^\[FAIL\]' "$tmp/$base.log" || true)
|
||||
if [ -n "$cause" ]; then
|
||||
echo " | assert: $cause"
|
||||
else
|
||||
cause=$(grep -m1 -E 'stack traceback|\.lua:[0-9]+:|Too many open files|not enough memory' \
|
||||
"$tmp/$base.log" || true)
|
||||
echo " | crash: ${cause:-non-zero exit with no recognized cause (see log tail)}"
|
||||
fi
|
||||
tail -6 "$tmp/$base.log" | sed 's/^/ | /'
|
||||
cause=$(grep -m1 -E 'stack traceback|\.lua:[0-9]+:|Too many open files|not enough memory' \
|
||||
"$tmp/$base.log" || true)
|
||||
echo " | crash: ${cause:-non-zero exit with no recognized cause (see log tail)}"
|
||||
fi
|
||||
tail -6 "$tmp/$base.log" | sed 's/^/ | /'
|
||||
fi
|
||||
done
|
||||
|
||||
# Missing-artifact tolerance (game3_artifacts_absent above): when this
|
||||
# machine has no imported game3 data at all, a suite that dies reading that
|
||||
# data is recorded as an artifact skip instead of a fresh failure. With the
|
||||
# data present the very same failure gates, so a regression in one of these
|
||||
# suites still fails a real checkout.
|
||||
local artifact_skips=0 artifact_list=""
|
||||
if [ "$fresh" -gt 0 ] && game3_artifacts_absent; then
|
||||
artifact_skips=$fresh
|
||||
artifact_list=$fresh_list
|
||||
fresh=0
|
||||
fresh_list=""
|
||||
fi
|
||||
echo "-- T6 game3: $total run, $passed passed ($skipped self-skipped), $failed failed"
|
||||
|
||||
echo "-- T6 game3: $total run, $passed passed, $known known failure(s), $fresh new failure(s)"
|
||||
if [ "$artifact_skips" -gt 0 ]; then
|
||||
echo "-- T6 game3: no imported game3 data in identity '${POKEPORT_IDENTITY:-pokemon-love2d}'" \
|
||||
"-> $artifact_skips suite failure(s) recorded as missing-artifact skips (they gate on a machine with imports):$artifact_list"
|
||||
fi
|
||||
if [ "$fresh" -gt 0 ]; then
|
||||
echo " new failures (not in the sweep-v113 baseline):$fresh_list"
|
||||
fi
|
||||
|
||||
local ok=1
|
||||
[ "$fresh" -eq 0 ] && ok=0
|
||||
if [ "$fresh" -gt 0 ]; then
|
||||
trap - EXIT INT TERM
|
||||
GAME3_TMP=""
|
||||
if [ "$failed" -gt 0 ]; then
|
||||
echo " failures:$fail_list"
|
||||
echo " per-suite logs kept for triage: $tmp"
|
||||
else
|
||||
rm -rf "$tmp"
|
||||
return 1
|
||||
fi
|
||||
return $ok
|
||||
rm -rf "$tmp"
|
||||
return 0
|
||||
}
|
||||
run_tier "T6 game3 top-level scenario suites" run_game3_tier
|
||||
|
||||
@@ -344,22 +272,10 @@ run_content_behavior() {
|
||||
local lines
|
||||
lines=$(printf '%s\n' "$out" | grep '^FAIL ' | sort)
|
||||
|
||||
# Verdict = exit code AND the FAIL-line allowlist together. The exit code
|
||||
# alone used to be discarded: a mid-run crash (unresolvable require under
|
||||
# POKEPORT_DATA_DIR) left hundreds of green checks, ZERO FAIL lines, rc=1
|
||||
# from luajit -- count matched KNOWN_CONTENT_FAILURES=0 and the tier printed
|
||||
# PASS. Any rc!=0 with no FAIL line at all is that crash signature.
|
||||
# Capture-then-print the stderr line: piping grep -m1 straight off $out
|
||||
# trips SIGPIPE under pipefail and double-reports via the fallback.
|
||||
if [ "$count" -eq "$KNOWN_CONTENT_FAILURES" ] \
|
||||
&& [ "$lines" = "$(printf '%s\n' "$KNOWN_CONTENT_LINES" | sort)" ]; then
|
||||
if [ "$rc" -ne 0 ] && [ "$count" -eq 0 ]; then
|
||||
printf '%s\n' "$out" | tail -3
|
||||
# stdout is block-buffered and stderr unbuffered under $(...) 2>&1, so the
|
||||
# luajit error can land MID-LINE after a buffered "ok ..." print -- never
|
||||
# anchor ^luajit:. Extract from 'luajit:' onward, cap the length (the
|
||||
# module-not-found dump is megabytes; BSD grep caps intervals at 255),
|
||||
# fall back to the traceback line.
|
||||
local crash=""
|
||||
crash=$(printf '%s\n' "$out" | grep -o 'luajit:.\{0,255\}' | head -1 || true)
|
||||
if [ -z "$crash" ]; then
|
||||
@@ -379,8 +295,6 @@ run_content_behavior() {
|
||||
|
||||
local faillines=""
|
||||
faillines=$(printf '%s\n' "$out" | grep '^FAIL ' || true)
|
||||
# here-string, not echo|head: one FAIL line can be megabytes (module-not-found
|
||||
# dumps) and echo would die of SIGPIPE mid-print under pipefail.
|
||||
head -10 <<<"$faillines" | cut -c1-160 || true
|
||||
printf '%s\n' "$out" | tail -2
|
||||
echo "expected exactly $KNOWN_CONTENT_FAILURES known failures; got $count"
|
||||
|
||||
Reference in New Issue
Block a user