#!/bin/sh # Functional test matrix for hate-no-d. # # Every case is a self-contained process: it prints "ok " or # "skip (...)", or raises with a specific message. Cases must run under # ./hate-no-d -- the system luajit has no raylib symbols. set -u ROOT=$(CDPATH= cd -- "$(dirname "$0")/.." && pwd) cd "$ROOT" || exit 1 export HATE_NO_D_ROOT="$ROOT" if [ ! -x ./hate-no-d ]; then echo "run.sh: ./hate-no-d not built (run make)" >&2 exit 1 fi # If there is no display, retry the whole matrix under a virtual X server when # one is available. Otherwise mark the run headless and let window cases skip. if [ -z "${DISPLAY:-}" ] && [ "${HATE_NO_D_XVFB:-0}" != "1" ]; then if command -v xvfb-run >/dev/null 2>&1; then HATE_NO_D_XVFB=1 export HATE_NO_D_XVFB exec xvfb-run -a "$0" "$@" fi echo "run.sh: no DISPLAY and no xvfb-run; window cases will be skipped" >&2 HATE_NO_D_HEADLESS=1 export HATE_NO_D_HEADLESS fi # Cases that need a window. The cases themselves also gate on IsWindowReady; # this list just avoids starting them at all when the runner knows it is # headless. WINDOW_CASES="01_many_textures 03_borrowed 04_model_from_mesh 06_teardown 08_pins 08b_views" is_window_case() { for w in $WINDOW_CASES; do [ "$w" = "$1" ] && return 0 done return 1 } fail=0 for case in tests/cases/*.lua; do name=$(basename "$case" .lua) if [ "${HATE_NO_D_HEADLESS:-0}" = "1" ] && is_window_case "$name"; then echo "skip $name (no display)" continue fi if out=$(./hate-no-d "$case" 2>&1); then echo "$out" else echo "FAIL $name" >&2 echo "$out" >&2 fail=1 fi done if [ "$fail" -eq 0 ]; then echo "test: ok" fi exit "$fail"