milo

08 — Testing and CI

Milo verifies its freestanding C++20 subsystems across two complementary environments: a host-native snitch unit test and coverage harness (HOST_TEST under ASan, UBSan, and gcovr) and on-target AArch64 QEMU virt tests driven by the interactive milo> kernel shell and initrd user-space binaries. Automated checks are orchestrated locally by Makefile and scripts/*.py and in GitHub Actions under .github/workflows/.

Host Unit Testing & Coverage (tests/host/, Makefile)

Host unit tests execute hardware-independent kernel code directly on the host using g++ (C++20) and snitch (-lsnitch), avoiding target assembly and linking against deterministic HAL mocks (tests/host/mocks/host_hal.{hpp,cpp}).

Build & Execution Targets (Makefile)

Host Test Suites & HAL Mocks (tests/host/)

Quality Gates & Static Analysis (Makefile, scripts/)

make quality runs four verification stages in sequence:

  1. format-check: Runs clang-format --dry-run --Werror across C/C++ sources, user C sources, and headers (make format formats them in place).
  2. license-check: Runs python3 scripts/check_license_headers.py --check to verify SPDX (GPL-3.0-only) and copyright headers across tracked comment-capable files.
  3. lint-report: Depends on compile_commands.json (generated incrementally via scripts/generate_compile_commands.py from SRCS_CXX and HOST_ONLY_TEST_SRCS) and runs python3 scripts/generate_quality_report.py -j $(NPROC), which invokes parallel clang-tidy workers (filtering out _text/__bss reserved-identifier noise) and writes build/reports/quality_report.md and build/reports/quality_report.html.
  4. test-host: Executes the snitch ASan/UBSan suite and gcovr coverage pass.

Commit hygiene is enforced by .githooks/pre-commit: direct git commit calls exit with an error unless MILO_MAKE_COMMIT=1 is set, so commits go through make commit (which runs quality before git commit).

On-Target QEMU & EL0 Verification (kernel/shell/, user/, Makefile)

Interactive Kernel Shell (milo>) (kernel/shell/shell.cpp, kernel/shell/tests/)

Booting with make run starts kmain and enters Kernel::Shell::run(), which runs Tests::run_lazy_memory_acceptance_suite() (test_lazy_mm_suite.cpp) and then reads commands over the console (milo>):

EL0 User-Space Programs & Initrd Images (user/, Makefile)

Makefile builds EL0 programs (user/hello.s, user/hello_musl.c, user/hello_dyn.c, user/fb_test.c, user/evdev_smoke.c, user/unix_echo_server.c, user/unix_echo_client.c, user/unix_sock_smoke.c, user/test_milo.c) when aarch64-linux-musl-gcc is available and packages them into CPIO newc archives (initrds/busybox.cpio via make setup-busybox, or initrds/bash.cpio via make setup-bash). Inside milo-sh or milo-bash, /bin/test_milo runs non-interactive EL0 end-to-end checks (-q/--quiet for summary-only output).

GitHub Actions Workflows (.github/workflows/)