blob: 30a52d4f9a21ad78cd669796021966d78d470c9a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# 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 <de>
.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 <de>"
@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/<name>/ 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
|