hate-no-d/tests/run.sh
pedro-bento 449be4c4b7
Some checks failed
release / linux/x86_64 (pull_request) Failing after 1m54s
release / freebsd/x86_64 (pull_request) Successful in 5m1s
release / linux/aarch64 (pull_request) Failing after 1m54s
release / linux/armv7 (pull_request) Failing after 2m12s
release / linux/i686 (pull_request) Failing after 1m59s
release / android (pull_request) Successful in 2m54s
release / windows/i686 (pull_request) Successful in 2m3s
release / windows/x86_64 (pull_request) Successful in 2m15s
probe
2026-10-24 22:20:01 +01:00

62 lines
1.7 KiB
Bash
Executable file

#!/bin/sh
# Functional test matrix for hate-no-d.
#
# Every case is a self-contained process: it prints "ok <name>" or
# "skip <name> (...)", 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"