aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile44
1 files changed, 36 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 629c750..98927bc 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,18 @@
# (https://git.cjennings.net/dotfiles.git). Run them from there:
# cd ~/.dotfiles && make stow|restow|reset|unstow|import <de>
-.PHONY: help deps test-unit test test-keep test-vm-base package-diff
+.PHONY: help deps test-unit test test-keep test-vm-base test-maint package-diff
+
+# Filesystem profile for the VM harness: btrfs (default) or zfs. Selects the
+# base image the scripts build/use; exported so create-base-vm.sh + run-test.sh
+# pick the matching archangel config and image. e.g. make test FS_PROFILE=zfs
+FS_PROFILE ?= btrfs
+export FS_PROFILE
+ifeq ($(FS_PROFILE),btrfs)
+BASE_IMAGE := vm-images/archsetup-base.qcow2
+else
+BASE_IMAGE := vm-images/archsetup-base-$(FS_PROFILE).qcow2
+endif
# Default target - show help
help:
@@ -17,8 +28,12 @@ help:
@echo " test Run full VM test suite (creates base VM if needed)"
@echo " test-keep Run test and keep VM running for manual testing"
@echo " test-vm-base Create base VM only (runs archangel)"
+ @echo " test-maint Run maint remedy scenarios in the VM (break/fix/assert)"
@echo " package-diff Compare archsetup's declared packages vs this system"
@echo ""
+ @echo "Filesystem profile (test, test-keep, test-vm-base):"
+ @echo " FS_PROFILE=btrfs (default) or zfs, e.g. make test FS_PROFILE=zfs"
+ @echo ""
@echo "Dotfile stow operations now live in the dotfiles repo:"
@echo " cd ~/.dotfiles && make stow|restow|reset|unstow|import <de>"
@echo ""
@@ -27,7 +42,8 @@ help:
deps:
@echo "Installing VM testing dependencies..."
sudo pacman -S --needed qemu-full virt-manager virt-viewer libguestfs \
- bridge-utils dnsmasq archiso sshpass socat
+ bridge-utils dnsmasq archiso sshpass socat \
+ python-pytest python-pytest-testinfra
@echo ""
@echo "Done. For VM testing, also ensure libvirtd is running:"
@echo " sudo systemctl enable --now libvirtd"
@@ -50,22 +66,34 @@ test-vm-base:
# Test - run full VM integration test suite (creates base VM if needed)
test:
- @if [ ! -f vm-images/archsetup-base.qcow2 ] || \
- ! qemu-img snapshot -l vm-images/archsetup-base.qcow2 2>/dev/null | grep -q "clean-install"; then \
- echo "Base VM not found or missing snapshot, creating..."; \
+ @if [ ! -f $(BASE_IMAGE) ] || \
+ ! qemu-img snapshot -l $(BASE_IMAGE) 2>/dev/null | grep -q "clean-install"; then \
+ echo "Base VM not found or missing snapshot, creating ($(FS_PROFILE))..."; \
bash scripts/testing/create-base-vm.sh; \
fi
@bash scripts/testing/run-test.sh
# Test and keep VM running (for manual testing after archsetup)
test-keep:
- @if [ ! -f vm-images/archsetup-base.qcow2 ] || \
- ! qemu-img snapshot -l vm-images/archsetup-base.qcow2 2>/dev/null | grep -q "clean-install"; then \
- echo "Base VM not found or missing snapshot, creating..."; \
+ @if [ ! -f $(BASE_IMAGE) ] || \
+ ! qemu-img snapshot -l $(BASE_IMAGE) 2>/dev/null | grep -q "clean-install"; then \
+ echo "Base VM not found or missing snapshot, creating ($(FS_PROFILE))..."; \
bash scripts/testing/create-base-vm.sh; \
fi
@bash scripts/testing/run-test.sh --keep
+# Maintenance-console remedy scenarios: break the VM, run the real
+# `maint fix`, assert the post-state. Grouped batches over the clean-install
+# snapshot; the base image is restored afterwards. `--list` variant to
+# preview: bash scripts/testing/run-maint-scenarios.sh --list
+test-maint:
+ @if [ ! -f $(BASE_IMAGE) ] || \
+ ! qemu-img snapshot -l $(BASE_IMAGE) 2>/dev/null | grep -q "clean-install"; then \
+ echo "Base VM not found or missing snapshot, creating ($(FS_PROFILE))..."; \
+ bash scripts/testing/create-base-vm.sh; \
+ fi
+ @bash scripts/testing/run-maint-scenarios.sh
+
# Compare the packages archsetup declares against what's installed here.
# Shows declared-but-missing and installed-but-undeclared (AUR vs official).
package-diff: