aboutsummaryrefslogtreecommitdiff
path: root/scripts/testing
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/testing')
-rw-r--r--scripts/testing/archsetup-test-zfs.conf21
-rwxr-xr-xscripts/testing/create-base-vm.sh11
-rwxr-xr-xscripts/testing/lib/vm-utils.sh17
-rwxr-xr-xscripts/testing/run-test.sh10
4 files changed, 56 insertions, 3 deletions
diff --git a/scripts/testing/archsetup-test-zfs.conf b/scripts/testing/archsetup-test-zfs.conf
new file mode 100644
index 0000000..a5459cf
--- /dev/null
+++ b/scripts/testing/archsetup-test-zfs.conf
@@ -0,0 +1,21 @@
+# archsetup-test-zfs.conf - Archangel config for archsetup ZFS test VMs
+# Used by create-base-vm.sh (FS_PROFILE=zfs) for fully automated base VM creation
+#
+# Usage: archangel --config-file /root/archsetup-test.conf
+#
+# Note: User creation is handled by archsetup, not archangel.
+# See archsetup-vm.conf for archsetup configuration (shared across profiles -
+# archsetup detects ZFS from the live root, so it needs no filesystem setting).
+#
+# Unencrypted ZFS root: encryption isn't what the harness validates, and
+# NO_ENCRYPT=yes skips the passphrase prompt for a fully unattended install.
+
+FILESYSTEM=zfs
+HOSTNAME=archsetup-test
+TIMEZONE=America/Chicago
+LOCALE=en_US.UTF-8
+KEYMAP=us
+DISKS=/dev/vda
+NO_ENCRYPT=yes
+ROOT_PASSWORD=archsetup
+ENABLE_SSH=yes
diff --git a/scripts/testing/create-base-vm.sh b/scripts/testing/create-base-vm.sh
index b8a4e2b..e626813 100755
--- a/scripts/testing/create-base-vm.sh
+++ b/scripts/testing/create-base-vm.sh
@@ -20,10 +20,19 @@ source "$SCRIPT_DIR/lib/vm-utils.sh"
# Configuration
VM_IMAGES_DIR="$PROJECT_ROOT/vm-images"
-CONFIG_FILE="$SCRIPT_DIR/archsetup-test.conf"
LIVE_ISO_PASSWORD="archangel"
SNAPSHOT_NAME="clean-install"
+# FS_PROFILE (btrfs default / zfs) picks the archangel base-install config.
+# btrfs -> archsetup-test.conf, zfs -> archsetup-test-zfs.conf. The matching
+# base image name is derived from FS_PROFILE by init_vm_paths.
+FS_PROFILE="${FS_PROFILE:-btrfs}"
+if [ "$FS_PROFILE" = "btrfs" ]; then
+ CONFIG_FILE="$SCRIPT_DIR/archsetup-test.conf"
+else
+ CONFIG_FILE="$SCRIPT_DIR/archsetup-test-${FS_PROFILE}.conf"
+fi
+
# Initialize logging
mkdir -p "$PROJECT_ROOT/test-results"
LOGFILE="$PROJECT_ROOT/test-results/create-base-vm-$(date +'%Y%m%d-%H%M%S').log"
diff --git a/scripts/testing/lib/vm-utils.sh b/scripts/testing/lib/vm-utils.sh
index f86e583..6d9f6f6 100755
--- a/scripts/testing/lib/vm-utils.sh
+++ b/scripts/testing/lib/vm-utils.sh
@@ -14,6 +14,12 @@ VM_CPUS="${VM_CPUS:-4}"
VM_RAM="${VM_RAM:-4096}" # MB
VM_DISK_SIZE="${VM_DISK_SIZE:-50}" # GB
+# Filesystem profile: selects which base image + archangel config the harness
+# targets. "btrfs" is the historical default (its image name stays unsuffixed
+# so existing base images keep working); "zfs" gets its own image, since the
+# two on-disk layouts can't share a disk. Honoured by init_vm_paths below.
+FS_PROFILE="${FS_PROFILE:-btrfs}"
+
# SSH configuration
SSH_PORT="${SSH_PORT:-2222}"
SSH_OPTS="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=10"
@@ -42,8 +48,17 @@ init_vm_paths() {
local images_dir="${1:-$VM_IMAGES_DIR}"
[ -z "$images_dir" ] && fatal "VM_IMAGES_DIR not set"
+ case "$FS_PROFILE" in
+ btrfs|zfs) ;;
+ *) fatal "Invalid FS_PROFILE: $FS_PROFILE (must be 'btrfs' or 'zfs')" ;;
+ esac
+
VM_IMAGES_DIR="$images_dir"
- DISK_PATH="$VM_IMAGES_DIR/archsetup-base.qcow2"
+ # btrfs keeps the legacy unsuffixed name; other profiles get a suffix so
+ # their images sit side by side without clobbering each other.
+ local img_suffix=""
+ [ "$FS_PROFILE" != "btrfs" ] && img_suffix="-$FS_PROFILE"
+ DISK_PATH="$VM_IMAGES_DIR/archsetup-base${img_suffix}.qcow2"
OVMF_VARS="$VM_IMAGES_DIR/OVMF_VARS.fd"
PID_FILE="$VM_IMAGES_DIR/qemu.pid"
MONITOR_SOCK="$VM_IMAGES_DIR/qemu-monitor.sock"
diff --git a/scripts/testing/run-test.sh b/scripts/testing/run-test.sh
index a22ae98..f962df3 100755
--- a/scripts/testing/run-test.sh
+++ b/scripts/testing/run-test.sh
@@ -50,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
@@ -100,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
@@ -108,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