#!/usr/bin/env bash # 40250 asset gate (docs/PORT-PLAN.md 2D steps 3-4): with MT_ASSETS_STRICT=1, verify the provenance manifest # (audit/assets/40250-client.json), then run the native pack/proto tests and the Godot tests that read the # 40250 client. Missing assets, a manifest mismatch, a skipped test or a failed one all fail the gate; nothing is # reported as PASS without having run. # # MT_40250_CLIENT=<.../Server Client TMP4/Client> script/run_40250_asset_gate.sh # # Uses the build tree $MT_BUILD_DIR (default build/, configured with BUILD_TESTING=ON) and $GODOT (default godot). set -uo pipefail cd "$(dirname "$0")/.." REPO="$PWD" export MT_ASSETS_STRICT=1 CLIENT="${MT_40250_CLIENT:-$REPO/../40250/Server Client TMP4/Client}" BUILD="${MT_BUILD_DIR:-build}" GODOT="${GODOT:-godot}" LOG="${MT_ASSET_GATE_LOG:-$BUILD/40250-asset-gate.log}" fail=0 : >"$LOG" 2>/dev/null || LOG=/dev/null step() { # name, command... local name="$1"; shift if "$@" >>"$LOG" 2>&1; then echo "PASS $name" else echo "FAIL $name (see $LOG)" fail=1 fi } if [ ! -f "$CLIENT/pack/Index" ]; then echo "FAIL no 40250 client at '$CLIENT' (set MT_40250_CLIENT)" exit 1 fi CLIENT="$(cd "$CLIENT" && pwd)" export MT_40250_CLIENT="$CLIENT" step "manifest audit/assets/40250-client.json" python3 tools/asset_manifest.py verify "$CLIENT" native() { cmake -S . -B "$BUILD" -DBUILD_TESTING=ON "-DMT_40250_CLIENT=$CLIENT" \ && cmake --build "$BUILD" --target port_eterpack_test proto_test proto_item_layout_test mtgodot -j 8 \ && ctest --test-dir "$BUILD" -R '^(port\.eterpack|proto\.)' --output-on-failure --no-tests=error } # under MT_ASSETS_STRICT=1 the tests exit 1, not the ctest skip code 77, when the client is missing step "native pack/proto tests" native godot_test() { # script: runs headless; a "(skip" line is a failure under the gate local out out="$(cd project && "$GODOT" --headless --path . -s "$1" 2>&1)" local rc=$? printf '%s\n' "$out" [ $rc -eq 0 ] && ! grep -q "(skip" <<<"$out" && grep -q "^PASS" <<<"$out" } for t in netbridge_test.gd equip_model_test.gd remote_player_test.gd mob_view_test.gd; do step "godot $t" godot_test "$t" done if [ $fail -ne 0 ]; then echo "40250 asset gate: FAIL" exit 1 fi echo "40250 asset gate: PASS"