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/.
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}).
Makefile)$(HOST_TEST_BIN)): Compiles HOST_ONLY_TEST_SRCS and HOST_KERNEL_SRCS into build/host-tests/kernel_host_tests with -std=c++20 -O1 -g -Wall -Wextra -Werror -Wpedantic -fno-exceptions -fno-rtti -DHOST_TEST -DSNITCH_WITH_EXCEPTIONS=0 -Wshadow -Wconversion -Wsign-conversion -Wnull-dereference -fsanitize=address,undefined -fno-omit-frame-pointer -MMD -MP.$(HOST_COV_BIN)): Compiles the same sources into build/host-coverage/kernel_host_coverage with -O0 -g --coverage (and without ASan/UBSan flags) so gcov counters can be collected cleanly.make test-host Pipeline:
./build/host-tests/kernel_host_tests under ASan and UBSan.*.gcda files in build/host-coverage/, runs ./build/host-coverage/kernel_host_coverage -r xml -o build/reports/test_report.xml, and runs gcovr -j $(NPROC) -r . --object-directory build/host-coverage --filter 'kernel/' to emit terminal output plus build/reports/coverage_report.html, build/reports/cobertura.xml, and build/reports/jacoco.xml.make clean-tests: Removes build/host-tests and build/host-coverage.tests/host/)tests/host/mocks/host_hal.{hpp,cpp}): Provides a 16 MiB simulated physical RAM arena (HostTest::SIM_RAM_BASE = 0x40000000ULL, HostTest::SIM_RAM_SIZE = 16 MiB, HostTest::SIM_PAGE_SIZE = 4096U), mock Console (HostTest::get_captured_console_output()), mock CpuControl, mock MemoryControl, mock AddressSpaceBackend (supporting roots, cloning, PageFlags::Shared, CoW, and failure injection via HostTest::set_fail_create_root and HostTest::set_fail_map_after), and HostTest::reset_host_hal().HOST_ONLY_TEST_SRCS in Makefile): Automatically discovers all tests/host/*.cpp and tests/host/mocks/*.cpp files (plus DRIVER_SRCS), covering af_unix, cpio_duration, ddk_dummy, ddk_kernel_services, distro_abi, elf_interp, evdev, ext2, fb0_devfs, fdt, file_syscalls, fw_cfg, gicv2, log, page_cache, pfa, pl011_uart, process_subsystem, ramfb, rootfs, socket_syscall, stack_builder, syscall_helpers, tmpfs, vfs, virtio_blk, virtio_bus, virtio_gpu, virtio_input, virtio_net, virtio_ring, and vma. HOST_KERNEL_SRCS is derived directly from KERNEL_CORE_SRCS in kernel/kernel.mk..clang-tidy (tests/host/.clang-tidy): Configures clang-tidy rules for tests/host/.* with -fno-exceptions -fno-rtti -std=c++20.Makefile, scripts/)make quality runs four verification stages in sequence:
format-check: Runs clang-format --dry-run --Werror across C/C++ sources, user C sources, and headers (make format formats them in place).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.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.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).
kernel/shell/, user/, Makefile)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>):
help, info, ls initrd, cat initrd <p>, elf initrd <p>, clear, sh, bash, halt.test <name> commands (test cpu, test mmu, test el0, test cpp, test svc, test abort, test pfa, test ro, test nx, test sys, test cpio, test elf, test elf_interp, test dyn_exec, test vmm, test vma_mmap, test file_vma, test page_cache, test loader, test user, test user_echo, test uxn_fault, test syscall, test tty_echo, test user_mm, test proc_exit, test fork_exec, test musl, test sched, test heap, test dynamic_io, test refcount, test cow, test demand_paging, test lazy_mm, test virtio, test gpu, test fb, test input, test net, test af_unix, test unix_sock, test blk, test stack_abi) and test all.test all Timer Handling: In kernel/shell/shell.cpp, test all disables the timer IRQ (HAL::Platform::disable_timer_irq()), disables CPU interrupts, clears the current process (Kernel::Process::Process::set_current(nullptr)), and runs cmd_test_blk() last so block IRQ/completion assertions execute in a deterministic state.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/workflows/).github/workflows/ci.yml (CI): Triggers on push to main and on pull_request:
build-and-quality: Runs inside container ghcr.io/$/milo-ci:latest (--user root), checks out the repository, runs make -j$(nproc) all, runs make -j$(nproc) quality, and uploads build/reports/cobertura.xml as artifact coverage-cobertura (skipping fork PRs).upload-coverage: Depends on build-and-quality (skipping fork PRs), marks the workspace safe in git, downloads build/reports/cobertura.xml, and uploads coverage to Coveralls (coverallsapp/github-action@v2) and Qlty (qltysh/qlty-action/coverage@v2.8.0)..github/workflows/ci-image.yml (Build CI Image): Triggers on push to main or pull_request when .devcontainer/**, Dockerfile, or .github/workflows/ci-image.yml changes (plus workflow_dispatch), builds ghcr.io/$/milo-ci:latest and :sha with Docker Buildx and GHA cache, and pushes tags on non-PR events.