工程(ci远端化·阶段二): 闸脚本跨平台化——新增tools/gate_platform.sh单点封装(平台探测/路径形式/纯bash带超时执行/孤儿清杀/进程计数,双平台双栖); run_all_gates cygpath×2换封装+PY解析加存在性守卫(修非Windows误选幽灵venv路径); probe_gate/render_gate/golden_baseline_refresh的cygpath/taskkill/PowerShell/tasklist/裸timeout全部收编封装,Windows侧原逻辑保留走平台分支; run_smoke/run_system_test DEFAULT_GODOT改GODOT_BIN环境变量优先; gdstyle_gate DEFAULT_BIN平台化(macOS=/usr/local/bin/gdstyle,自举件装v0.4.0 darwin包); 依据=第七轮容器实测断点清单+runner迁移Mac host模式裁决
This commit is contained in:
1 parent
0e7fdfb84c
commit
b3928f8167
8 files changed
+134
-28
No files matched your search
+11
-11
@@ -27,22 +27,22 @@
|
||||
# 窗口化运行会短暂弹 Godot 窗口(本机可开窗口径);禁改 --headless 跑本闸
|
||||
# (headless 无渲染面,探针内 fail-fast 护栏会红——那是护栏生效不是闸红)。
|
||||
# 用法: tools/render_gate.sh [game目录] 缺省 game 目录=脚本所在仓库的 game/(worktree 内自动指向该 worktree)
|
||||
# 依赖: Git Bash(coreutils timeout/taskkill) + PowerShell + python(PIL);Godot 路径可用环境变量 GODOT_BIN 覆盖。
|
||||
# 依赖: tools/gate_platform.sh(双平台封装)+ python(PIL);Windows 侧另用 taskkill/PowerShell,macOS/Linux 走共享件;Godot 路径可用环境变量 GODOT_BIN 覆盖。
|
||||
set -u
|
||||
G="${GODOT_BIN:-/d/code/godot/Godot_v4.7.2-stable_win64_console.exe}"
|
||||
REPO="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
. "$REPO/tools/gate_platform.sh" # 跨平台件(平台探测/路径形式/带超时执行/孤儿清杀)
|
||||
GAME="${1:-$REPO/game}"
|
||||
GAME_WIN="$(cygpath -m "$GAME")" # Godot --path 需 Windows 形式
|
||||
GAME_WIN="$(gate_game_path "$GAME")" # Godot --path 接受形式(Windows 混合斜杠,其他平台原样)
|
||||
TMP="$(mktemp -d /tmp/rendergate_XXXXXX)"
|
||||
trap 'rm -rf "$TMP"' EXIT
|
||||
_rc=0
|
||||
|
||||
orphans() { # 列出命令行含本 game 路径的 Godot 进程 PID(console wrapper+真引擎都算)
|
||||
printf "Get-CimInstance Win32_Process -Filter \"Name like 'Godot%%'\" | Where-Object { \$_.CommandLine -like '*%s*' } | ForEach-Object { \$_.ProcessId }\n" "$GAME_WIN" > "$TMP/k.ps1"
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File "$(cygpath -w "$TMP/k.ps1")" 2>/dev/null | tr -d '\r'
|
||||
orphans() { # 列出命令行含本 game 路径的 Godot 进程 PID(实现单点在 gate_platform.sh,双平台)
|
||||
gate_orphans "$GAME_WIN"
|
||||
}
|
||||
kill_orphans() {
|
||||
local p; for p in $(orphans); do taskkill //F //PID "$p" >/dev/null 2>&1; done
|
||||
gate_kill_orphans "$GAME_WIN"
|
||||
}
|
||||
|
||||
scan_log() { # scan_log <段名> <日志>——脚本错误扫描;日志不可读(error_scan exit 2)同判红
|
||||
@@ -57,7 +57,7 @@ scan_log() { # scan_log <段名> <日志>——脚本错误扫描;日志不
|
||||
# 冷检出刷导入(.godot 不入 git,fresh worktree 首跑一次性付)
|
||||
if [ ! -f "$GAME/.godot/uid_cache.bin" ]; then
|
||||
echo "[render_gate] 冷检出:editor --quit 刷导入(一次性,可到 1-2 分钟)"
|
||||
timeout 300 "$G" --headless --path "$GAME_WIN" --editor --quit >/dev/null 2>&1
|
||||
gate_run_timeout 300 "$TMP/refresh.log" "$G" --headless --path "$GAME_WIN" --editor --quit >/dev/null 2>&1
|
||||
kill_orphans
|
||||
fi
|
||||
|
||||
@@ -66,7 +66,7 @@ if [ "$pre" -gt 0 ]; then echo "[render_gate] 预清本闸残留 Godot×$pre"; k
|
||||
|
||||
echo "======== shot_probe 七屏截图 → shot_checker A-D ========"
|
||||
SHOT="$TMP/shots"
|
||||
timeout 180 "$G" --path "$GAME_WIN" res://probe/shot_probe.tscn -- "$SHOT" >"$TMP/shot.log" 2>&1
|
||||
gate_run_timeout 180 "$TMP/shot.log" "$G" --path "$GAME_WIN" res://probe/shot_probe.tscn -- "$SHOT"
|
||||
st=$?; kill_orphans
|
||||
grep -E "\[shot_probe\]" "$TMP/shot.log" | tail -12
|
||||
if [ "$st" -eq 124 ] || [ "$st" -eq 137 ]; then
|
||||
@@ -83,7 +83,7 @@ scan_log "shot_probe" "$TMP/shot.log"
|
||||
|
||||
echo "======== fx_shot_probe 三时刻取证(Q7) ========"
|
||||
FX="$TMP/fxshots"
|
||||
timeout 180 "$G" --path "$GAME_WIN" res://probe/fx_shot_probe.tscn -- "$FX" >"$TMP/fx.log" 2>&1
|
||||
gate_run_timeout 180 "$TMP/fx.log" "$G" --path "$GAME_WIN" res://probe/fx_shot_probe.tscn -- "$FX"
|
||||
st=$?; kill_orphans
|
||||
grep -E "\[fx_shot_probe\]" "$TMP/fx.log" | tail -4
|
||||
if [ "$st" -eq 124 ] || [ "$st" -eq 137 ]; then
|
||||
@@ -108,7 +108,7 @@ fx_evidence "fx_final.png" 1
|
||||
|
||||
echo "======== board_shot_probe L1-L3 取证(Q7) ========"
|
||||
BD="$TMP/boardshots"
|
||||
timeout 180 "$G" --path "$GAME_WIN" res://probe/board_shot_probe.tscn -- "$BD" >"$TMP/bd.log" 2>&1
|
||||
gate_run_timeout 180 "$TMP/bd.log" "$G" --path "$GAME_WIN" res://probe/board_shot_probe.tscn -- "$BD"
|
||||
st=$?; kill_orphans
|
||||
grep -E "\[board_shot\]" "$TMP/bd.log" | tail -6
|
||||
if [ "$st" -eq 124 ] || [ "$st" -eq 137 ]; then
|
||||
@@ -172,7 +172,7 @@ fi
|
||||
|
||||
echo "======== 残留检查(批末闸) ========"
|
||||
left="$(orphans | wc -l | tr -d ' ')"
|
||||
total="$(tasklist 2>/dev/null | grep -ci '^Godot' || true)"
|
||||
total="$(gate_godot_count_all)"
|
||||
echo "本闸残留 Godot=$left(必须0) 全局 Godot 进程=$total(其他会话的仅报数不算账)"
|
||||
if [ "$left" -ne 0 ]; then echo "[render_gate] FAIL — 本闸残留未清零"; kill_orphans; _rc=1; fi
|
||||
if [ "$_rc" -eq 0 ]; then echo "[render_gate] 全绿"; else echo "[render_gate] 存在 FAIL,见上"; fi
|
||||
|
||||
Reference in new issue
Block a user