first commit
This commit is contained in:
54
tests/run.sh
Executable file
54
tests/run.sh
Executable file
@@ -0,0 +1,54 @@
|
||||
#!/bin/bash
|
||||
# Führt die Testskripte aus. Sie werden als Autoload eingehängt und danach
|
||||
# wird das Projekt wieder in den Ausgangszustand gebracht.
|
||||
set -u
|
||||
GODOT="${GODOT:-$HOME/bin/godot}"
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
cd "$ROOT"
|
||||
|
||||
restore() { git checkout project.godot 2>/dev/null || cp /tmp/_pg.bak project.godot; rm -f scripts/_test.gd /tmp/_pg.bak; }
|
||||
cp project.godot /tmp/_pg.bak
|
||||
trap restore EXIT
|
||||
|
||||
install_test() {
|
||||
cp "$1" scripts/_test.gd
|
||||
cp /tmp/_pg.bak project.godot
|
||||
printf '\n[autoload]\n\nTest="*res://scripts/_test.gd"\n' >> project.godot
|
||||
}
|
||||
|
||||
echo "=== Einzelspieler-Tests ==="
|
||||
install_test tests/solo_test.gd
|
||||
"$GODOT" --headless --path . --fixed-fps 60 2>&1 | grep -E "OK|FAIL|=="
|
||||
SOLO=${PIPESTATUS[0]}
|
||||
|
||||
echo
|
||||
echo "=== Eingabe-Tests (braucht ein Fenster) ==="
|
||||
install_test tests/input_test.gd
|
||||
"$GODOT" --path . --resolution 1280x720 2>&1 | grep -E "OK|FAIL|=="
|
||||
INPUT=${PIPESTATUS[0]}
|
||||
|
||||
echo
|
||||
echo "=== Klang-Tests ==="
|
||||
install_test tests/audio_test.gd
|
||||
"$GODOT" --path . --resolution 1280x720 2>&1 | grep -E "OK|FAIL|=="
|
||||
AUDIO=${PIPESTATUS[0]}
|
||||
|
||||
echo
|
||||
echo "=== Richtungs-Tests ==="
|
||||
install_test tests/direction_test.gd
|
||||
"$GODOT" --path . --resolution 1280x720 2>&1 | grep -E "OK|FAIL|=="
|
||||
DIR=${PIPESTATUS[0]}
|
||||
|
||||
echo
|
||||
echo "=== Netzwerk-Tests ==="
|
||||
install_test tests/net_test.gd
|
||||
"$GODOT" --headless --path . -- --host > /tmp/_host.log 2>&1 &
|
||||
HOST=$!
|
||||
sleep 6
|
||||
"$GODOT" --headless --path . -- --client 2>&1 | grep -E "OK|FAIL|=="
|
||||
NET=${PIPESTATUS[0]}
|
||||
wait $HOST 2>/dev/null
|
||||
|
||||
echo
|
||||
[ "$SOLO" -eq 0 ] && [ "$INPUT" -eq 0 ] && [ "$DIR" -eq 0 ] && [ "$AUDIO" -eq 0 ] && [ "$NET" -eq 0 ] && echo "Alle Tests bestanden." || echo "Es sind Tests fehlgeschlagen."
|
||||
exit $(( SOLO || INPUT || DIR || AUDIO || NET ))
|
||||
Reference in New Issue
Block a user