diff options
| author | Craig Jennings <c@cjennings.net> | 2026-04-12 23:48:14 -0400 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-04-12 23:48:14 -0400 |
| commit | 863ceeac8fdb10258a58d35bcee6874097fffc88 (patch) | |
| tree | 37180f7a5393784beb0c8bbb35870558f0a02fb5 /Makefile | |
| parent | 33ff55507895af2c29a20ec7e7e707d317cb8ef1 (diff) | |
| download | archangel-863ceeac8fdb10258a58d35bcee6874097fffc88.tar.gz archangel-863ceeac8fdb10258a58d35bcee6874097fffc88.zip | |
test: add bats unit tests for common.sh and config.sh
23 bats tests covering the pure logic in installer/lib/common.sh
(command_exists, require_command, info/warn/error, enable_color,
require_root, log) and installer/lib/config.sh (parse_args, load_config,
validate_config, check_config). Makefile adds a 'bats' target; 'test'
now runs lint + bats (VM integration tests remain under test-install).
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -3,7 +3,8 @@ # Usage: # make build - Build the ISO # make lint - Run shellcheck on all scripts -# make test - Run lint +# make bats - Run bats unit tests (tests/unit/) +# make test - Run lint + bats # make test-install - Run all automated install tests in VMs (slow) # make release - Full test + build + deploy # @@ -19,7 +20,7 @@ # # Test configurations are in scripts/test-configs/ -.PHONY: test test-install test-vm test-multi test-multi3 test-boot test-clean build release clean distclean lint +.PHONY: test test-install test-vm test-multi test-multi3 test-boot test-clean build release clean distclean lint bats # Lint all bash scripts lint: @@ -27,6 +28,13 @@ lint: @shellcheck -x build.sh scripts/*.sh installer/archangel installer/zfsrollback installer/zfssnapshot installer/lib/*.sh @echo "==> Shellcheck complete" +# Run bats unit tests +bats: + @command -v bats >/dev/null 2>&1 || { echo "bats not installed. Install: sudo pacman -S bats (Arch), brew install bats-core (macOS), apt install bats (Debian/Ubuntu)"; exit 1; } + @echo "==> Running bats unit tests..." + @bats tests/unit/ + @echo "==> Bats tests complete" + # Build the ISO (requires sudo) build: @echo "==> Building ISO..." @@ -37,8 +45,8 @@ test-install: build @echo "==> Running install tests..." ./scripts/test-install.sh -# All tests (lint only - VM tests via test-install) -test: lint +# All fast tests (lint + bats — VM integration tests via test-install) +test: lint bats # Full release: test everything, build, deploy release: test test-install |
