mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-02 20:58:26 +00:00
test: harden parallels all-os smoke harness
This commit is contained in:
@@ -17,6 +17,7 @@ MAIN_TGZ_DIR="$(mktemp -d)"
|
||||
MAIN_TGZ_PATH=""
|
||||
SERVER_PID=""
|
||||
RUN_DIR="$(mktemp -d /tmp/openclaw-parallels-linux.XXXXXX)"
|
||||
BUILD_LOCK_DIR="${TMPDIR:-/tmp}/openclaw-parallels-build.lock"
|
||||
|
||||
TIMEOUT_SNAPSHOT_S=180
|
||||
TIMEOUT_BOOTSTRAP_S=600
|
||||
@@ -260,16 +261,41 @@ else:
|
||||
PY
|
||||
}
|
||||
|
||||
acquire_build_lock() {
|
||||
local owner_pid=""
|
||||
while ! mkdir "$BUILD_LOCK_DIR" 2>/dev/null; do
|
||||
if [[ -f "$BUILD_LOCK_DIR/pid" ]]; then
|
||||
owner_pid="$(cat "$BUILD_LOCK_DIR/pid" 2>/dev/null || true)"
|
||||
if [[ -n "$owner_pid" ]] && ! kill -0 "$owner_pid" >/dev/null 2>&1; then
|
||||
warn "Removing stale Parallels build lock"
|
||||
rm -rf "$BUILD_LOCK_DIR"
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
printf '%s\n' "$$" >"$BUILD_LOCK_DIR/pid"
|
||||
}
|
||||
|
||||
release_build_lock() {
|
||||
if [[ -d "$BUILD_LOCK_DIR" ]]; then
|
||||
rm -rf "$BUILD_LOCK_DIR"
|
||||
fi
|
||||
}
|
||||
|
||||
ensure_current_build() {
|
||||
local head build_commit
|
||||
acquire_build_lock
|
||||
head="$(git rev-parse HEAD)"
|
||||
build_commit="$(current_build_commit)"
|
||||
if [[ "$build_commit" == "$head" ]]; then
|
||||
release_build_lock
|
||||
return
|
||||
fi
|
||||
say "Build dist for current head"
|
||||
pnpm build
|
||||
build_commit="$(current_build_commit)"
|
||||
release_build_lock
|
||||
[[ "$build_commit" == "$head" ]] || die "dist/build-info.json still does not match HEAD after build"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user