#!/usr/bin/env bash # A JSON PASS is insufficient: shutdown happens after the report is written. # Keep the exported client's complete log and fail on renderer/RID leaks too. set -euo pipefail cd "$(dirname "$0")/.." app_path="${MT_RENDER_APP:-$PWD/build/export/mtgodot-poc.app}" output_dir="${MT_RENDER_OUTPUT:-$PWD/build/rendering/package-gate-$(date +%Y%m%d-%H%M%S)-$$}" test -x "$app_path/Contents/MacOS/mtgodot-poc" mkdir -p "$output_dir" status=0 env -u MT_ASSETS MT_TEST_MODE=render MT_RENDER_OUTPUT="$output_dir" \ "$app_path/Contents/MacOS/mtgodot-poc" --quit-after 1800 >"$output_dir/client.log" 2>&1 || status=$? if [ "$status" -ne 0 ] || ! grep -qE '^PKGRENDER: PASS$' "$output_dir/client.log" || \ grep -qE 'SCRIPT ERROR|Parse Error|^ERROR:|leaked at exit|shaders of type .* were never freed' "$output_dir/client.log"; then echo "FAIL: package load/exit gate (exit=$status): $output_dir/client.log" exit 1 fi echo "PASS: package load and clean exit: $output_dir/client.log"