universalisos/tools/uos-boot-test/README.md
Fábio Coutada 793069c915 feat(testing): add boot test infrastructure — Phase 1 complete
kernel/Makefile:
- Add 'test' target that builds + boots all architectures
- Add 'test-armv7', 'test-aarch64', 'test-riscv' per-arch targets
- Configurable timeout (BOOT_TIMEOUT=15s) and banner string
- Architecture matrix: armv7, aarch64, riscv

tools/uos-boot-test/:
- New QEMU orchestrator (356 lines Python)
- Spawns QEMU, captures UART, checks for boot banner
- JUnit XML output for CI integration
- Supports --arch, --timeout, --junit, --verbose flags
- Per-arch configs with correct QEMU binaries and flags

.github/workflows/ci.yml:
- Add 'boot-test' job that runs after kernel-build
- Matrix strategy: armv7, aarch64, riscv
- Downloads ELF artifacts from kernel-build job
- Installs QEMU + cross-compilers
- Runs uos-boot-test.py with JUnit XML output
- Uploads test results as artifacts

Phase 1 of testing roadmap: CI boot testing now operational.
2026-07-12 16:42:23 +01:00

2.1 KiB

uos-boot-test

QEMU boot test orchestrator for UniversalisOS. Spawns QEMU for each architecture, monitors UART output for the boot banner, and reports pass/fail.

Usage

# Test all architectures
python3 tools/uos-boot-test/uos-boot-test.py --arch all

# Test specific architecture
python3 tools/uos-boot-test/uos-boot-test.py --arch armv7

# Generate JUnit XML for CI
python3 tools/uos-boot-test/uos-boot-test.py --arch all --junit results.xml

# Custom timeout
python3 tools/uos-boot-test/uos-boot-test.py --arch armv7 --timeout 30

# Verbose output (show UART)
python3 tools/uos-boot-test/uos-boot-test.py --arch all --verbose

How It Works

  1. Build: Compiles the kernel for the target architecture (skipped with --no-build)
  2. Boot: Launches QEMU with the compiled ELF
  3. Monitor: Captures UART output for up to --timeout seconds
  4. Verify: Checks for the "UniversalisOS" banner string in output
  5. Report: Prints pass/fail and optionally generates JUnit XML

Exit Codes

  • 0 — All tests passed
  • 1 — One or more tests failed

CI Integration

The JUnit XML output integrates with GitHub Actions:

- name: Run boot tests
  run: python3 tools/uos-boot-test/uos-boot-test.py --arch all --junit test-results.xml

- name: Publish test results
  uses: dorny/test-reporter@v1
  if: always()
  with:
    name: Boot Tests
    path: test-results.xml
    reporter: java-junit

Supported Architectures

Architecture QEMU Binary Default Flags
armv7 qemu-system-arm -M virt -cpu cortex-a15 -m 512M -nographic
aarch64 qemu-system-aarch64 -M virt,gic-version=3,virtualization=on -cpu cortex-a53 -m 512M -smp 4 -nographic
riscv qemu-system-riscv64 -machine microchip-icicle-kit -smp 5 -m 2G -nographic -bios none

Limitations

  • Only checks for boot banner (no functional test validation)
  • RISC-V -bios none is BSP-only (secondaries held in reset)
  • AArch64 requires virtualization=on (see AGENTS.md gotcha)
  • Timeout may kill QEMU before banner appears on slow systems