工程(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
+17
-8
@@ -17,10 +17,12 @@
|
||||
# 四件带断言探针;默认段断言面零删减零改动(--full 只增不改)。
|
||||
# 渲染面归 render_gate.sh 正主(窗口化:shot_probe 七屏+fx_shot/board_shot 取证+棋盘 golden 逐像素)。
|
||||
# 用法: tools/probe_gate.sh [game目录] [--click] [--full] 缺省 game 目录=脚本所在仓库的 game/(worktree 内自动指向该 worktree)
|
||||
# 依赖: Git Bash(coreutils timeout/taskkill) + PowerShell;Godot 路径可用环境变量 GODOT_BIN 覆盖。
|
||||
# 依赖: Git Bash(coreutils timeout/taskkill) + PowerShell(Windows 侧);macOS/Linux 走 tools/gate_platform.sh
|
||||
# 共享跨平台件(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=""; WITH_CLICK=0; WITH_FULL=0
|
||||
for a in "$@"; do
|
||||
case "$a" in
|
||||
@@ -30,7 +32,7 @@ for a in "$@"; do
|
||||
esac
|
||||
done
|
||||
GAME="${GAME:-$REPO/game}"
|
||||
GAME_WIN="$(cygpath -m "$GAME")" # Godot --path 需 Windows 形式
|
||||
GAME_WIN="$(gate_game_path "$GAME")" # Godot --path 接受形式(Windows 混合斜杠,其他平台原样)
|
||||
TMP="$(mktemp -d /tmp/probegate_XXXXXX)"
|
||||
trap 'rm -rf "$TMP"' EXIT
|
||||
_rc=0
|
||||
@@ -68,12 +70,11 @@ verdict() { # verdict <探针名> <日志路径> <退出码> [签名标记]
|
||||
return 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"
|
||||
}
|
||||
|
||||
# 每段跑批统一走本函数:后台启动记 MSYS PID→WINPID,守卫进程到点先 taskkill /T 整树回收
|
||||
@@ -81,6 +82,14 @@ kill_orphans() {
|
||||
# 2026-10-25 在册挂死根源),后 kill -9 收 MSYS 侧。正常退出不动进程树;段后 kill_orphans 照跑兜底。
|
||||
run_suite() { # run_suite <timeout秒> <日志> <场景 res:// 路径>
|
||||
local t="$1" log="$2" scene="$3"
|
||||
if ! gate_is_win; then
|
||||
# macOS/Linux:无 console wrapper(Godot 单进程),走共享带超时执行+孤儿清杀兜底。
|
||||
local st
|
||||
gate_run_timeout "$t" "$log" "$G" --headless --path "$GAME_WIN" "$scene"
|
||||
st=$?
|
||||
gate_kill_orphans "$GAME_WIN"
|
||||
return "$st"
|
||||
fi
|
||||
local kf="$TMP/killed.$RANDOM"
|
||||
rm -f "$kf"
|
||||
"$G" --headless --path "$GAME_WIN" "$scene" >"$log" 2>&1 &
|
||||
@@ -108,7 +117,7 @@ run_suite() { # run_suite <timeout秒> <日志> <场景 res:// 路径>
|
||||
# 冷检出刷导入(.godot 不入 git,fresh worktree 首跑一次性付)
|
||||
if [ ! -f "$GAME/.godot/uid_cache.bin" ]; then
|
||||
echo "[probe_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
|
||||
|
||||
@@ -183,7 +192,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 "[probe_gate] FAIL — 本闸残留未清零"; kill_orphans; _rc=1; fi
|
||||
if [ "$_rc" -eq 0 ]; then echo "[probe_gate] 全绿"; else echo "[probe_gate] 存在 FAIL,见上"; fi
|
||||
|
||||
Reference in new issue
Block a user