aboutsummaryrefslogtreecommitdiff
path: root/scripts/testing/run-test.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/testing/run-test.sh')
-rwxr-xr-xscripts/testing/run-test.sh45
1 files changed, 31 insertions, 14 deletions
diff --git a/scripts/testing/run-test.sh b/scripts/testing/run-test.sh
index 5830ed9..f962df3 100755
--- a/scripts/testing/run-test.sh
+++ b/scripts/testing/run-test.sh
@@ -1,4 +1,5 @@
#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0-or-later
# Run archsetup test in a VM using snapshots
# Author: Craig Jennings <craigmartinjennings@gmail.com>
# License: GNU GPLv3
@@ -23,6 +24,7 @@ source "$SCRIPT_DIR/lib/logging.sh"
source "$SCRIPT_DIR/lib/vm-utils.sh"
source "$SCRIPT_DIR/lib/network-diagnostics.sh"
source "$SCRIPT_DIR/lib/validation.sh"
+source "$SCRIPT_DIR/lib/testinfra.sh"
# Parse arguments
KEEP_VM=false
@@ -48,6 +50,9 @@ while [[ $# -gt 0 ]]; do
echo " --keep Keep VM in post-test state (for debugging)"
echo " --script Specify custom archsetup script to test"
echo " --snapshot Snapshot name to revert to (default: clean-install)"
+ echo ""
+ echo "Env: FS_PROFILE=btrfs|zfs (default btrfs) selects the base image"
+ echo " built by create-base-vm.sh. e.g. FS_PROFILE=zfs $0"
exit 1
;;
esac
@@ -98,6 +103,7 @@ init_logging "$LOGFILE"
init_vm_paths "$VM_IMAGES_DIR"
section "ArchSetup Test Run: $TIMESTAMP"
+info "Filesystem profile: $FS_PROFILE (image: $(basename "$DISK_PATH"))"
# Verify archsetup script exists
if [ ! -f "$ARCHSETUP_SCRIPT" ]; then
@@ -106,7 +112,11 @@ fi
# Check disk exists
if [ ! -f "$DISK_PATH" ]; then
- info "Create it first: ./scripts/testing/create-base-vm.sh"
+ if [ "$FS_PROFILE" = "btrfs" ]; then
+ info "Create it first: ./scripts/testing/create-base-vm.sh"
+ else
+ info "Create it first: FS_PROFILE=$FS_PROFILE ./scripts/testing/create-base-vm.sh"
+ fi
fatal "Base disk not found: $DISK_PATH"
fi
@@ -140,6 +150,13 @@ start_qemu "$DISK_PATH" "disk" "" "none" || fatal "Failed to start VM"
wait_for_ssh "$ROOT_PASSWORD" 120 || fatal "VM SSH not available"
stop_timer "boot"
+# Authorize a root key now, before archsetup runs. archsetup hardens sshd to
+# PermitRootLogin prohibit-password partway through, which breaks the harness's
+# root password SSH; key auth survives it. Without this, the run aborts mid-way
+# (before any validation) once the hardening step lands.
+inject_root_key "$TEST_RESULTS_DIR/root_key" || \
+ warn "Continuing without root key - run may break at the sshd hardening step"
+
# Run network diagnostics
if ! run_network_diagnostics; then
fatal "Network diagnostics failed - aborting test"
@@ -240,7 +257,8 @@ fi
# Poll for completion
step "Monitoring archsetup progress (polling every 30 seconds)..."
POLL_COUNT=0
-MAX_POLLS=180 # 90 minutes max (180 * 30 seconds)
+MAX_POLLS=300 # 150 minutes max (300 * 30 seconds); a full install with heavy
+ # AUR builds (e.g. vagrant) can exceed 90 min on a slow mirror
while [ $POLL_COUNT -lt $MAX_POLLS ]; do
# Check if archsetup process is still running
@@ -261,7 +279,7 @@ while [ $POLL_COUNT -lt $MAX_POLLS ]; do
done
if [ $POLL_COUNT -ge $MAX_POLLS ]; then
- error "ArchSetup timed out after 90 minutes"
+ error "ArchSetup timed out after 150 minutes"
ARCHSETUP_EXIT_CODE=124
else
# Get exit code from the remote log
@@ -307,18 +325,17 @@ copy_from_vm "/var/log/archsetup-installed-packages.txt" "$TEST_RESULTS_DIR/" "$
# Capture post-install state
capture_post_install_state "$TEST_RESULTS_DIR"
-# Run comprehensive validation
-# This uses the validation.sh library for all checks.
+# Run comprehensive validation (Testinfra/pytest is the primary validator; the
+# old shell run_all_validations sweep was retired once pytest reached parity).
#
# From here to the end of the script, errexit is disabled on purpose: the
-# validation functions are designed to fail-and-count (see VALIDATION_FAILED)
-# rather than abort, and the analysis/report-generation steps below can also
-# legitimately return non-zero. With `set -e` active, a single failed check
-# would kill the run before the test report is written or the VM is cleaned
-# up. Pass/fail is signalled explicitly by the exit code at the bottom.
+# analysis/report-generation steps below can legitimately return non-zero, and
+# with `set -e` active a single failed check would kill the run before the test
+# report is written or the VM is cleaned up. Pass/fail is signalled explicitly
+# by the exit code at the bottom.
set +e
-run_all_validations
-validate_all_services
+run_testinfra_validation "$TEST_RESULTS_DIR"
+testinfra_rc=$?
# Analyze log differences (pre vs post install)
analyze_log_diff "$TEST_RESULTS_DIR"
@@ -327,8 +344,8 @@ analyze_log_diff "$TEST_RESULTS_DIR"
# If base install issues found and archzfs inbox exists, create issue file
generate_issue_report "$TEST_RESULTS_DIR" "$ARCHZFS_INBOX"
-# Set validation result based on failure count
-if [ "$VALIDATION_FAILED" -eq 0 ]; then
+# The run passes only if the Testinfra sweep passed.
+if [ "$testinfra_rc" -eq 0 ]; then
TEST_PASSED=true
else
TEST_PASSED=false