veilor-os/test/README.md
s8n deef914064 v0.5.5: autonomous install test harness (#12)
test/auto-install.sh boots ISO, drives gum installer via QEMU
monitor sendkey with hardcoded test answers, waits for anaconda,
reboots into installed system, SSHs in, runs validation checklist.

Co-authored-by: veilor-org <admin@veilor.org>
2026-05-02 22:49:51 +01:00

66 lines
3.3 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# test/
Test harnesses for veilor-os ISO builds.
## Files
| File | Purpose |
|------|---------|
| `run-vm.sh` | Manual smoke test — boot the latest ISO interactively in QEMU/KVM. SSH key injection via cloud-init seed + monitor sendkey fallback for live-image login. |
| `auto-install.sh` | **Autonomous** end-to-end install test. Boots ISO, drives the gum installer via QEMU monitor `sendkey`, waits for anaconda to finish + reboot, SSHs into the installed system, runs validation checklist. Prints PASS/FAIL summary. |
| `auto-install-keymap.sh` | Sourced helper. Provides `km_send_str`, `km_send_chord`, `km_send_key`, `km_screendump`, `km_wait_socket`, etc. Reusable by other automation. |
| `boot-checklist.md` | Manual post-install checklist (run on a real spare laptop). |
## Running the autonomous installer test
```sh
./test/auto-install.sh build/out/veilor-os-*.iso
```
Hardcoded inputs (deterministic — do not edit during a test run):
- Disk: first `/dev/vda` (the only disk in QEMU)
- Hostname: `veilor` (installer hardcoded since v0.5.4)
- LUKS passphrase: `testpass1234`
- Admin password: `adminpass1234`
- Locale: `en_GB.UTF-8`
Expected runtime: 2030 minutes wall clock (anaconda dominates).
### Outputs
- `/tmp/veilor-auto-install.log` — full driver log
- `/tmp/veilor-auto-install-NN-<step>.png` — milestone screenshots
- `/tmp/veilor-auto-install-final-ssh.txt` — final SSH session capture (uname/lsblk/cmdline/failed units)
### Exit codes
- `0` — all validation checks passed
- `1` — any failure (anaconda crashed, SSH never came up, validation check failed)
- `2` — preflight failure (missing tool, bad ISO arg, missing OVMF)
### Prerequisites
- `qemu-system-x86_64`, `qemu-img`, `socat`, `ssh`, `ssh-keygen`
- `edk2-ovmf` (OVMF UEFI firmware at `/usr/share/edk2/ovmf/OVMF_{CODE,VARS}.fd`)
- `mkisofs` or `xorriso` (for cloud-init seed ISO; harness falls back to TTY1 driving if seed cannot be built or cloud-init does not run on the installed system)
- `convert` from ImageMagick (optional — converts PPM screendumps to PNG; harness keeps PPM if absent)
- KVM access (`/dev/kvm` readable by the user)
### What it validates
Post-install on the booted system:
- `/etc/os-release``NAME=veilor-os`
- `hostnamectl --static``veilor`
- `systemctl is-active``active` for `sshd fail2ban usbguard tuned auditd firewalld chronyd sddm`
- `getenforce``Enforcing` (preferred) or `Permissive` (acceptable for v0.5.x)
- `lsblk -f` shows `crypto_LUKS` + `btrfs`
- `/etc/crypttab` has a LUKS entry
- `getent passwd admin` returns the user
- `/usr/local/bin/{veilor-power,veilor-doctor,veilor-update}` are present and executable
- `/proc/cmdline` contains `init_on_alloc=1`
### Troubleshooting
- **Stuck at boot banner**: ISO didn't autostart `veilor-installer` on tty1. Check `serial.log` and `auto-install-vm-NN-*.png` screenshots. The harness aborts after 5 minutes of identical screen frames.
- **SSH never up**: cloud-init may not have run on the installed system (no `cidata` mount). The harness falls back to TTY1 driving — typing the LUKS passphrase, logging in as admin, and hand-injecting the SSH key. If both paths fail, validation cannot proceed.
- **`screendump` produces unreadable PPM**: install ImageMagick (`dnf install ImageMagick`) so the harness converts to PNG.