# Makefile for archsetup # VM-based integration testing + project dependencies. # # Dotfile stow operations live in the dotfiles repo's own Makefile # (https://git.cjennings.net/dotfiles.git). Run them from there: # cd ~/.dotfiles && make stow|restow|reset|unstow|import .PHONY: help deps test-unit test test-keep test-vm-base # Default target - show help help: @echo "archsetup - install and test" @echo "" @echo "Targets:" @echo " deps Install VM-testing dependencies" @echo " test-unit Run fast unit tests for installer helpers (no VM)" @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 "" @echo "Dotfile stow operations now live in the dotfiles repo:" @echo " cd ~/.dotfiles && make stow|restow|reset|unstow|import " @echo "" # Install project dependencies (VM integration testing) deps: @echo "Installing VM testing dependencies..." sudo pacman -S --needed qemu-full virt-manager virt-viewer libguestfs \ bridge-utils dnsmasq archiso sshpass socat @echo "" @echo "Done. For VM testing, also ensure libvirtd is running:" @echo " sudo systemctl enable --now libvirtd" # Run the fast unit-test suites for installer helpers (no VM needed). # One suite per tests// dir; `unittest discover` can't find them # because the dir names are hyphenated, so each suite is run explicitly. test-unit: @fail=0; \ for t in tests/*/test_*.py; do \ mod=$$(echo "$$t" | sed 's|/|.|g; s|\.py$$||'); \ echo "==> $$mod"; \ python3 -m unittest "$$mod" || fail=1; \ done; \ exit $$fail # Create base VM for testing (runs archangel only, no archsetup) test-vm-base: @bash scripts/testing/create-base-vm.sh # 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..."; \ 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..."; \ bash scripts/testing/create-base-vm.sh; \ fi @bash scripts/testing/run-test.sh --keep