mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 16:50:43 +00:00
refactor(test): share docker e2e shell helpers
This commit is contained in:
@@ -1,16 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Shared logging helpers for shell-based Docker E2E lanes.
|
||||
# They centralize temporary log naming and the small success/failure print
|
||||
# pattern used by Docker scenario scripts.
|
||||
|
||||
run_logged() {
|
||||
local label="$1"
|
||||
shift
|
||||
local log_file
|
||||
local tmp_dir="${TMPDIR:-/tmp}"
|
||||
tmp_dir="${tmp_dir%/}"
|
||||
log_file="$(mktemp "$tmp_dir/openclaw-${label}.XXXXXX")"
|
||||
log_file="$(docker_e2e_run_log "$label")"
|
||||
if ! "$@" >"$log_file" 2>&1; then
|
||||
cat "$log_file"
|
||||
docker_e2e_print_log "$log_file"
|
||||
rm -f "$log_file"
|
||||
return 1
|
||||
fi
|
||||
rm -f "$log_file"
|
||||
}
|
||||
|
||||
docker_e2e_run_log() {
|
||||
local label="$1"
|
||||
local tmp_dir="${TMPDIR:-/tmp}"
|
||||
tmp_dir="${tmp_dir%/}"
|
||||
mktemp "$tmp_dir/openclaw-${label}.XXXXXX"
|
||||
}
|
||||
|
||||
docker_e2e_print_log() {
|
||||
local log_file="$1"
|
||||
cat "$log_file"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user