aboutsummaryrefslogtreecommitdiff
path: root/scripts/testing/create-base-vm.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/testing/create-base-vm.sh')
-rwxr-xr-xscripts/testing/create-base-vm.sh19
1 files changed, 14 insertions, 5 deletions
diff --git a/scripts/testing/create-base-vm.sh b/scripts/testing/create-base-vm.sh
index 11c40a7..4ecf4d6 100755
--- a/scripts/testing/create-base-vm.sh
+++ b/scripts/testing/create-base-vm.sh
@@ -29,6 +29,14 @@ LOGFILE="$PROJECT_ROOT/test-results/create-base-vm-$(date +'%Y%m%d-%H%M%S').log"
init_logging "$LOGFILE"
init_vm_paths "$VM_IMAGES_DIR"
+# Kill QEMU if we exit before reaching the controlled stop_qemu calls below.
+cleanup_create_base() {
+ if declare -f vm_is_running >/dev/null 2>&1 && vm_is_running; then
+ kill_qemu 2>/dev/null || true
+ fi
+}
+trap cleanup_create_base EXIT
+
section "Creating Base VM for ArchSetup Testing"
# ─── Prerequisites ────────────────────────────────────────────────────
@@ -45,8 +53,8 @@ fi
# Find archangel ISO in vm-images/
ISO_PATH=$(find "$VM_IMAGES_DIR" -maxdepth 1 -name "archangel-*.iso" -type f 2>/dev/null | sort -V | tail -1)
if [ -z "$ISO_PATH" ]; then
- fatal "No archangel ISO found in $VM_IMAGES_DIR/"
info "Copy an archangel-*.iso file to: $VM_IMAGES_DIR/"
+ fatal "No archangel ISO found in $VM_IMAGES_DIR/"
fi
info "Using ISO: $(basename "$ISO_PATH")"
@@ -150,10 +158,11 @@ create_snapshot "$DISK_PATH" "$SNAPSHOT_NAME" || fatal "Failed to create snapsho
section "Base VM Created Successfully"
info ""
-info " Disk: $DISK_PATH"
-info " Snapshot: $SNAPSHOT_NAME"
-info " Config: $(basename "$CONFIG_FILE")"
-info " Log: $LOGFILE"
+info " Disk: $DISK_PATH"
+info " Snapshot: $SNAPSHOT_NAME"
+info " Config: $(basename "$CONFIG_FILE")"
+info " Log: $LOGFILE"
+info " Serial log: $SERIAL_LOG"
info ""
info "Next step: Run ./scripts/testing/run-test.sh"
info ""