fix: stabilize godot 4.7 headless validation
This commit is contained in:
+35
-6
@@ -9,6 +9,8 @@ ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
cd "$ROOT" || exit 1
|
||||
LOG="logs/quality/latest"
|
||||
mkdir -p "$LOG"
|
||||
GODOT_PROFILE="$ROOT/logs/quality/godot_profile"
|
||||
mkdir -p "$GODOT_PROFILE"
|
||||
|
||||
CHANGED=false
|
||||
[[ "${1:-}" == "--changed" ]] && CHANGED=true
|
||||
@@ -18,8 +20,35 @@ FIXES=()
|
||||
OWNED_GDSCRIPT_ROOTS=(player simulation tests tools world)
|
||||
|
||||
# -- tool detection -----------------------------------------------------------
|
||||
console_godot_path() {
|
||||
local candidate="${1:-}"
|
||||
[[ -z "$candidate" ]] && return 1
|
||||
candidate="${candidate%\"}"
|
||||
candidate="${candidate#\"}"
|
||||
candidate="${candidate//\\//}"
|
||||
if [[ "$candidate" == *.exe ]]; then
|
||||
local console_candidate="${candidate%.exe}_console.exe"
|
||||
if [[ -f "$console_candidate" ]]; then echo "$console_candidate"; return 0; fi
|
||||
fi
|
||||
if [[ -f "$candidate" ]]; then echo "$candidate"; return 0; fi
|
||||
return 1
|
||||
}
|
||||
|
||||
find_project_godot() {
|
||||
local metadata="$ROOT/.godot/editor/project_metadata.cfg"
|
||||
[[ -f "$metadata" ]] || return 1
|
||||
local line path
|
||||
line="$(grep -m 1 '^executable_path=' "$metadata" 2>/dev/null || true)"
|
||||
[[ -n "$line" ]] || return 1
|
||||
path="${line#executable_path=}"
|
||||
path="${path%\"}"
|
||||
path="${path#\"}"
|
||||
console_godot_path "$path"
|
||||
}
|
||||
|
||||
find_godot() {
|
||||
if [[ -n "${GODOT_BIN:-}" ]]; then echo "$GODOT_BIN"; return 0; fi
|
||||
if [[ -n "${GODOT_BIN:-}" ]]; then console_godot_path "$GODOT_BIN" && return 0; echo "$GODOT_BIN"; return 0; fi
|
||||
find_project_godot && return 0
|
||||
for c in godot godot4; do command -v "$c" &>/dev/null && echo "$c" && return 0; done
|
||||
return 1
|
||||
}
|
||||
@@ -148,7 +177,7 @@ fi
|
||||
godot_result="PASS"
|
||||
: > "$LOG/godot-check.log"
|
||||
if need_timeout; then
|
||||
if timeout 30 "$GODOT" --headless --path "$ROOT" --script res://tests/simulation_definitions_test.gd >> "$LOG/godot-check.log" 2>&1; then
|
||||
if APPDATA="$GODOT_PROFILE" LOCALAPPDATA="$GODOT_PROFILE" timeout 30 "$GODOT" --headless --path "$ROOT" --script res://tests/simulation_definitions_test.gd >> "$LOG/godot-check.log" 2>&1; then
|
||||
godot_result="PASS"
|
||||
else
|
||||
ec=$?
|
||||
@@ -160,7 +189,7 @@ if need_timeout; then
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if "$GODOT" --headless --path "$ROOT" --script res://tests/simulation_definitions_test.gd >> "$LOG/godot-check.log" 2>&1; then
|
||||
if APPDATA="$GODOT_PROFILE" LOCALAPPDATA="$GODOT_PROFILE" "$GODOT" --headless --path "$ROOT" --script res://tests/simulation_definitions_test.gd >> "$LOG/godot-check.log" 2>&1; then
|
||||
godot_result="PASS"
|
||||
else
|
||||
godot_result="FAIL"
|
||||
@@ -179,11 +208,11 @@ scenario_result="PASS"
|
||||
for test in tests/*_test.gd; do
|
||||
echo "[RUN] $(basename "$test")" >> "$LOG/scenarios.log"
|
||||
if need_timeout; then
|
||||
if ! timeout 30 "$GODOT" --headless --path "$ROOT" --script "res://$test" >> "$LOG/scenarios.log" 2>&1; then
|
||||
if ! APPDATA="$GODOT_PROFILE" LOCALAPPDATA="$GODOT_PROFILE" timeout 30 "$GODOT" --headless --path "$ROOT" --script "res://$test" >> "$LOG/scenarios.log" 2>&1; then
|
||||
scenario_result="FAIL"
|
||||
ERRORS+=("scenario: $(basename "$test") failed or timed out")
|
||||
fi
|
||||
elif ! "$GODOT" --headless --path "$ROOT" --script "res://$test" >> "$LOG/scenarios.log" 2>&1; then
|
||||
elif ! APPDATA="$GODOT_PROFILE" LOCALAPPDATA="$GODOT_PROFILE" "$GODOT" --headless --path "$ROOT" --script "res://$test" >> "$LOG/scenarios.log" 2>&1; then
|
||||
scenario_result="FAIL"
|
||||
ERRORS+=("scenario: $(basename "$test") failed")
|
||||
fi
|
||||
@@ -196,7 +225,7 @@ fi
|
||||
gut_result="SKIPPED"
|
||||
: > "$LOG/gut.log"
|
||||
if [[ -f "addons/gut/gut_cmdln.gd" ]]; then
|
||||
if $GODOT --headless --path "$ROOT" -s addons/gut/gut_cmdln.gd >> "$LOG/gut.log" 2>&1; then
|
||||
if APPDATA="$GODOT_PROFILE" LOCALAPPDATA="$GODOT_PROFILE" "$GODOT" --headless --path "$ROOT" -s addons/gut/gut_cmdln.gd >> "$LOG/gut.log" 2>&1; then
|
||||
gut_result="PASS"
|
||||
else
|
||||
gut_result="FAIL"
|
||||
|
||||
Reference in New Issue
Block a user