diff options
Diffstat (limited to 'scripts/test-install.sh')
| -rwxr-xr-x | scripts/test-install.sh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/scripts/test-install.sh b/scripts/test-install.sh index cbca9b3..7a7f991 100755 --- a/scripts/test-install.sh +++ b/scripts/test-install.sh @@ -587,6 +587,30 @@ ssh_cmd() { -p "$SSH_PORT" root@localhost "$@" 2>/dev/null } +# Keep a failed attempt's install log under its own name. The retry loop +# refetches the guest's newest /tmp/archangel-*.log after every failed +# attempt, and the final *-install.log only ever holds the last one — so +# the failure that triggered a retry used to be gone by the time anyone +# read test-logs/ (2026-09-12: attempt 2's "Disk in use" was all that +# survived of a pacstrap stall). Pure: takes the captured text, never +# talks to the guest. An empty capture writes an empty file, so "attempt ran, +# log was empty" stays distinguishable from "attempt never ran". Returns 1 +# on a write failure; the caller treats that as non-fatal. +# +# Usage: save_attempt_log <log_dir> <config_name> <attempt> <log_text> +save_attempt_log() { + local log_dir="$1" config_name="$2" attempt="$3" log_text="$4" + local file="$log_dir/${config_name}-install-attempt${attempt}.log" + # 2>/dev/null goes before the output redirect so it also silences the + # redirect's own "Permission denied"; the caller prints its own warning. + if [[ -n "$log_text" ]]; then + printf '%s\n' "$log_text" 2>/dev/null > "$file" || return 1 + else + : 2>/dev/null > "$file" || return 1 + fi + return 0 +} + # Decide whether a failed install is a transient pacstrap/network flake # (worth retrying) or a deterministic regression (fail fast). Returns 0 # only when the install log shows BOTH pacstrap's own base-install @@ -1159,6 +1183,8 @@ run_test() { # pacstrap's failure text survives. Read just the latest log — # a retry leaves a second timestamped log behind. install_log=$(ssh_cmd "cat \"\$(ls -t /tmp/archangel-*.log 2>/dev/null | head -1)\"" 2>/dev/null) || true + save_attempt_log "$LOG_DIR" "$config_name" "$attempt" "$install_log" \ + || warn "Could not save attempt $attempt's install log to $LOG_DIR" if [[ "$attempt" -lt 3 ]] && is_transient_install_failure "$install_log"; then warn "Install attempt $attempt hit a transient pacstrap flake — retrying ($((attempt + 1))/3)" continue |
