#!/bin/bash set -e if [ -z "$DEVKITPRO" ]; then echo "DEVKITPRO environment variable is not set. Please set it to the path of your DEVKITPRO installation." exit 1 fi DOLPHIN_BIN="${DOLPHIN_BIN:-dolphin-emu}" if ! command -v "$DOLPHIN_BIN" >/dev/null 2>&1; then echo "$DOLPHIN_BIN not found. Install Dolphin Emulator (e.g. 'apt install dolphin-emu')" echo "or set DOLPHIN_BIN to its path." exit 1 fi if ! command -v xvfb-run >/dev/null 2>&1; then echo "xvfb-run not found. Install it (e.g. 'apt install xvfb') -- Dolphin's" echo "Qt frontend needs a display even in batch mode." exit 1 fi ./scripts/build-wii-iso.sh DUSK_TEST_DOLPHIN_SECONDS="${DUSK_TEST_DOLPHIN_SECONDS:-20}" ISO="build-wii-iso/Dusk-NTSC-U.iso" echo "Booting $ISO in Dolphin for up to ${DUSK_TEST_DOLPHIN_SECONDS}s (batch mode, headless via Xvfb)..." # Dolphin's batch mode (-b -e) runs the disc until told to stop -- there's # no "the game exited cleanly" signal to wait for, so we bound it with # timeout and treat "still running when the clock ran out" as success. set +e xvfb-run -a timeout "${DUSK_TEST_DOLPHIN_SECONDS}" "$DOLPHIN_BIN" -b -e "$ISO" status=$? set -e # timeout returns 124 when it had to kill Dolphin after the duration # elapsed -- that means the disc booted and kept running, the expected # smoke-test-passed outcome, not a failure. Any other non-zero status # means Dolphin crashed or refused to boot the disc. if [ "$status" -ne 0 ] && [ "$status" -ne 124 ]; then echo "Dolphin exited with unexpected status $status -- treating as a failure." exit "$status" fi echo "Wii smoke test passed (Dolphin ran $ISO for ${DUSK_TEST_DOLPHIN_SECONDS}s without crashing)."