fix: stabilize godot 4.7 headless validation
This commit is contained in:
+34
-1
@@ -9,6 +9,8 @@ Set-Location $ROOT
|
|||||||
|
|
||||||
$LOG = "logs/quality/latest"
|
$LOG = "logs/quality/latest"
|
||||||
New-Item -ItemType Directory -Path $LOG -Force | Out-Null
|
New-Item -ItemType Directory -Path $LOG -Force | Out-Null
|
||||||
|
$GODOT_PROFILE = Join-Path $ROOT "logs/quality/godot_profile"
|
||||||
|
New-Item -ItemType Directory -Path $GODOT_PROFILE -Force | Out-Null
|
||||||
|
|
||||||
$OVERALL = $false
|
$OVERALL = $false
|
||||||
$ERRORS = @()
|
$ERRORS = @()
|
||||||
@@ -16,8 +18,30 @@ $FIXES = @()
|
|||||||
$OWNED_GDSCRIPT_ROOTS = @("player", "simulation", "tests", "tools", "world")
|
$OWNED_GDSCRIPT_ROOTS = @("player", "simulation", "tests", "tools", "world")
|
||||||
|
|
||||||
# -- tool detection -----------------------------------------------------------
|
# -- tool detection -----------------------------------------------------------
|
||||||
|
function ConvertTo-ConsoleGodotPath($Path) {
|
||||||
|
if (-not $Path) { return $null }
|
||||||
|
$normalized = $Path.Replace('/', '\').Trim('"')
|
||||||
|
if ($normalized.EndsWith(".exe")) {
|
||||||
|
$consolePath = $normalized -replace '\.exe$', '_console.exe'
|
||||||
|
if (Test-Path $consolePath) { return $consolePath }
|
||||||
|
}
|
||||||
|
if (Test-Path $normalized) { return $normalized }
|
||||||
|
return $null
|
||||||
|
}
|
||||||
|
|
||||||
|
function Find-ProjectGodot {
|
||||||
|
$metadata = Join-Path $ROOT ".godot/editor/project_metadata.cfg"
|
||||||
|
if (-not (Test-Path $metadata)) { return $null }
|
||||||
|
$line = Select-String -Path $metadata -Pattern '^executable_path=' | Select-Object -First 1
|
||||||
|
if (-not $line) { return $null }
|
||||||
|
$rawPath = ($line.Line -replace '^executable_path=', '').Trim().Trim('"')
|
||||||
|
return ConvertTo-ConsoleGodotPath $rawPath
|
||||||
|
}
|
||||||
|
|
||||||
function Find-Godot {
|
function Find-Godot {
|
||||||
if ($env:GODOT_BIN) { return $env:GODOT_BIN }
|
if ($env:GODOT_BIN) { return (ConvertTo-ConsoleGodotPath $env:GODOT_BIN) }
|
||||||
|
$projectGodot = Find-ProjectGodot
|
||||||
|
if ($projectGodot) { return $projectGodot }
|
||||||
try { return (Get-Command godot -ErrorAction Stop).Source } catch {}
|
try { return (Get-Command godot -ErrorAction Stop).Source } catch {}
|
||||||
try { return (Get-Command godot4 -ErrorAction Stop).Source } catch {}
|
try { return (Get-Command godot4 -ErrorAction Stop).Source } catch {}
|
||||||
$common = @(
|
$common = @(
|
||||||
@@ -99,7 +123,16 @@ function Invoke-GodotWithTimeout {
|
|||||||
$psi.RedirectStandardError = $true
|
$psi.RedirectStandardError = $true
|
||||||
$psi.UseShellExecute = $false
|
$psi.UseShellExecute = $false
|
||||||
$psi.CreateNoWindow = $true
|
$psi.CreateNoWindow = $true
|
||||||
|
$previousAppData = $env:APPDATA
|
||||||
|
$previousLocalAppData = $env:LOCALAPPDATA
|
||||||
|
$env:APPDATA = $GODOT_PROFILE
|
||||||
|
$env:LOCALAPPDATA = $GODOT_PROFILE
|
||||||
|
try {
|
||||||
$p = [Diagnostics.Process]::Start($psi)
|
$p = [Diagnostics.Process]::Start($psi)
|
||||||
|
} finally {
|
||||||
|
$env:APPDATA = $previousAppData
|
||||||
|
$env:LOCALAPPDATA = $previousLocalAppData
|
||||||
|
}
|
||||||
$outputTask = $p.StandardOutput.ReadToEndAsync()
|
$outputTask = $p.StandardOutput.ReadToEndAsync()
|
||||||
$errorTask = $p.StandardError.ReadToEndAsync()
|
$errorTask = $p.StandardError.ReadToEndAsync()
|
||||||
$exited = $p.WaitForExit(30000)
|
$exited = $p.WaitForExit(30000)
|
||||||
|
|||||||
+35
-6
@@ -9,6 +9,8 @@ ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|||||||
cd "$ROOT" || exit 1
|
cd "$ROOT" || exit 1
|
||||||
LOG="logs/quality/latest"
|
LOG="logs/quality/latest"
|
||||||
mkdir -p "$LOG"
|
mkdir -p "$LOG"
|
||||||
|
GODOT_PROFILE="$ROOT/logs/quality/godot_profile"
|
||||||
|
mkdir -p "$GODOT_PROFILE"
|
||||||
|
|
||||||
CHANGED=false
|
CHANGED=false
|
||||||
[[ "${1:-}" == "--changed" ]] && CHANGED=true
|
[[ "${1:-}" == "--changed" ]] && CHANGED=true
|
||||||
@@ -18,8 +20,35 @@ FIXES=()
|
|||||||
OWNED_GDSCRIPT_ROOTS=(player simulation tests tools world)
|
OWNED_GDSCRIPT_ROOTS=(player simulation tests tools world)
|
||||||
|
|
||||||
# -- tool detection -----------------------------------------------------------
|
# -- 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() {
|
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
|
for c in godot godot4; do command -v "$c" &>/dev/null && echo "$c" && return 0; done
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
@@ -148,7 +177,7 @@ fi
|
|||||||
godot_result="PASS"
|
godot_result="PASS"
|
||||||
: > "$LOG/godot-check.log"
|
: > "$LOG/godot-check.log"
|
||||||
if need_timeout; then
|
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"
|
godot_result="PASS"
|
||||||
else
|
else
|
||||||
ec=$?
|
ec=$?
|
||||||
@@ -160,7 +189,7 @@ if need_timeout; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
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"
|
godot_result="PASS"
|
||||||
else
|
else
|
||||||
godot_result="FAIL"
|
godot_result="FAIL"
|
||||||
@@ -179,11 +208,11 @@ scenario_result="PASS"
|
|||||||
for test in tests/*_test.gd; do
|
for test in tests/*_test.gd; do
|
||||||
echo "[RUN] $(basename "$test")" >> "$LOG/scenarios.log"
|
echo "[RUN] $(basename "$test")" >> "$LOG/scenarios.log"
|
||||||
if need_timeout; then
|
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"
|
scenario_result="FAIL"
|
||||||
ERRORS+=("scenario: $(basename "$test") failed or timed out")
|
ERRORS+=("scenario: $(basename "$test") failed or timed out")
|
||||||
fi
|
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"
|
scenario_result="FAIL"
|
||||||
ERRORS+=("scenario: $(basename "$test") failed")
|
ERRORS+=("scenario: $(basename "$test") failed")
|
||||||
fi
|
fi
|
||||||
@@ -196,7 +225,7 @@ fi
|
|||||||
gut_result="SKIPPED"
|
gut_result="SKIPPED"
|
||||||
: > "$LOG/gut.log"
|
: > "$LOG/gut.log"
|
||||||
if [[ -f "addons/gut/gut_cmdln.gd" ]]; then
|
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"
|
gut_result="PASS"
|
||||||
else
|
else
|
||||||
gut_result="FAIL"
|
gut_result="FAIL"
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ func _ready() -> void:
|
|||||||
push_error("ActivitySite at %s has empty site_id" % get_path())
|
push_error("ActivitySite at %s has empty site_id" % get_path())
|
||||||
_update_presentation()
|
_update_presentation()
|
||||||
return
|
return
|
||||||
var existing := get_by_id(site_id)
|
var existing: ActivitySite = get_by_id(site_id) as ActivitySite
|
||||||
if existing != null:
|
if existing != null:
|
||||||
push_error(
|
push_error(
|
||||||
(
|
(
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://bly1hd36boprk
|
||||||
@@ -21,7 +21,7 @@ func _ready() -> void:
|
|||||||
push_error("StorageNode at %s has empty storage_id" % get_path())
|
push_error("StorageNode at %s has empty storage_id" % get_path())
|
||||||
_update_presentation()
|
_update_presentation()
|
||||||
return
|
return
|
||||||
var existing := get_by_id(storage_id)
|
var existing: StorageNode = get_by_id(storage_id) as StorageNode
|
||||||
if existing != null:
|
if existing != null:
|
||||||
push_error(
|
push_error(
|
||||||
(
|
(
|
||||||
|
|||||||
Reference in New Issue
Block a user