aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-02-23 05:09:45 -0600
committerCraig Jennings <c@cjennings.net>2026-02-23 05:09:45 -0600
commite1733666d6c942483925a61a0aa21ea66f5e6d96 (patch)
treed4d7ed88f090fd08c99bdc649a512c7d211925bb /scripts
parent8b9c2cc247f8d71d570921cb127e7e08cfac7674 (diff)
downloadarchangel-e1733666d6c942483925a61a0aa21ea66f5e6d96.tar.gz
archangel-e1733666d6c942483925a61a0aa21ea66f5e6d96.zip
fix: support no-ssh test by adding console boot verification
The no-ssh test failed because reboot verification unconditionally used wait_for_ssh, which timed out on systems without SSH. Add wait_for_boot_console() that checks serial log for ZFSBootMenu boot markers, and branch run_test() on ENABLE_SSH to use the appropriate verification path.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/test-install.sh103
1 files changed, 73 insertions, 30 deletions
diff --git a/scripts/test-install.sh b/scripts/test-install.sh
index f0046bb..9240c12 100755
--- a/scripts/test-install.sh
+++ b/scripts/test-install.sh
@@ -249,6 +249,28 @@ wait_for_ssh() {
done
}
+# Wait for boot via serial console (for systems without SSH)
+# Checks for ZFSBootMenu loading, which proves the disk is bootable
+# and EFI entries + ZBM binary were installed correctly.
+wait_for_boot_console() {
+ local timeout="$1"
+ local start_time
+ start_time=$(date +%s)
+
+ while true; do
+ if grep -q "ZFSBootMenu\|login:" "$SERIAL_LOG" 2>/dev/null; then
+ return 0
+ fi
+
+ local elapsed=$(($(date +%s) - start_time))
+ if [[ $elapsed -ge $timeout ]]; then
+ return 1
+ fi
+
+ sleep 5
+ done
+}
+
# Run SSH command (uses SSH_PASSWORD by default, or INSTALLED_PASSWORD if set)
ssh_cmd() {
local password="${INSTALLED_PASSWORD:-$SSH_PASSWORD}"
@@ -569,42 +591,63 @@ run_test() {
fi
info "VM started from disk (PID: $vm_pid2)"
- # Get installed system's root password from config
- local installed_password
- installed_password=$(grep '^ROOT_PASSWORD=' "$config" | cut -d= -f2)
+ # Check if SSH is enabled in the config
+ local enable_ssh
+ enable_ssh=$(grep '^ENABLE_SSH=' "$config" | cut -d= -f2)
- # Wait for system to boot from disk (using installed system's password)
- step "Waiting for installed system to boot (timeout: ${BOOT_TIMEOUT}s)..."
- if ! wait_for_ssh "$BOOT_TIMEOUT" "$installed_password"; then
- error "Installed system did not boot successfully"
- stop_vm "$config_name"
+ if [[ "$enable_ssh" == "no" ]]; then
+ # No SSH — verify boot via serial console login prompt
+ step "Waiting for console boot marker (timeout: ${BOOT_TIMEOUT}s)..."
+ if ! wait_for_boot_console "$BOOT_TIMEOUT"; then
+ error "Installed system did not boot successfully (no login prompt in serial log)"
+ stop_vm "$config_name"
- cp "$SERIAL_LOG" "$LOG_DIR/${config_name}-reboot-serial.log" 2>/dev/null || true
- error "Serial log saved to: $LOG_DIR/${config_name}-reboot-serial.log"
+ cp "$SERIAL_LOG" "$LOG_DIR/${config_name}-reboot-serial.log" 2>/dev/null || true
+ error "Serial log saved to: $LOG_DIR/${config_name}-reboot-serial.log"
- cleanup_disks "$config_name"
- TESTS_FAILED=$((TESTS_FAILED + 1))
- FAILED_TESTS+=("$config_name")
- return 1
- fi
+ cleanup_disks "$config_name"
+ TESTS_FAILED=$((TESTS_FAILED + 1))
+ FAILED_TESTS+=("$config_name")
+ return 1
+ fi
+ info "Console boot verified (boot marker detected in serial log)"
+ else
+ # SSH enabled — full verification path
+ local installed_password
+ installed_password=$(grep '^ROOT_PASSWORD=' "$config" | cut -d= -f2)
- # Use installed system's password for subsequent SSH commands
- export INSTALLED_PASSWORD="$installed_password"
+ step "Waiting for installed system to boot (timeout: ${BOOT_TIMEOUT}s)..."
+ if ! wait_for_ssh "$BOOT_TIMEOUT" "$installed_password"; then
+ error "Installed system did not boot successfully"
+ stop_vm "$config_name"
- # Verify reboot survival
- if ! verify_reboot_survival "$config"; then
- error "Reboot survival check failed"
- stop_vm "$config_name"
- cleanup_disks "$config_name"
- TESTS_FAILED=$((TESTS_FAILED + 1))
- FAILED_TESTS+=("$config_name")
- return 1
- fi
+ cp "$SERIAL_LOG" "$LOG_DIR/${config_name}-reboot-serial.log" 2>/dev/null || true
+ error "Serial log saved to: $LOG_DIR/${config_name}-reboot-serial.log"
- # Verify rollback functionality
- if ! verify_rollback "$config"; then
- warn "Rollback verification had issues"
- # Don't fail the test for rollback issues - it's a bonus check
+ cleanup_disks "$config_name"
+ TESTS_FAILED=$((TESTS_FAILED + 1))
+ FAILED_TESTS+=("$config_name")
+ return 1
+ fi
+
+ # Use installed system's password for subsequent SSH commands
+ export INSTALLED_PASSWORD="$installed_password"
+
+ # Verify reboot survival
+ if ! verify_reboot_survival "$config"; then
+ error "Reboot survival check failed"
+ stop_vm "$config_name"
+ cleanup_disks "$config_name"
+ TESTS_FAILED=$((TESTS_FAILED + 1))
+ FAILED_TESTS+=("$config_name")
+ return 1
+ fi
+
+ # Verify rollback functionality
+ if ! verify_rollback "$config"; then
+ warn "Rollback verification had issues"
+ # Don't fail the test for rollback issues - it's a bonus check
+ fi
fi
# Cleanup