Skip to content

[ISSUE] Replace Noisy Shell & Test Output with Dot Progress, Failure Details, and Structured Forensic Log Capture #247

Done

Description

@marcobuschini

Problem

  1. Noisy boot and test output:
    • Kernel::Shell::run() in kernel/shell/shell.cpp runs Tests::run_lazy_memory_acceptance_suite() at boot before the milo> prompt, printing dozens of [INFO][test], [DEBUG][proc], [DEBUG][sys_proc], [TRACE][sched], and [DBG] lines.
    • assert_test() in kernel/shell/tests/test_common.cpp emits a full [INFO][test] [PASS] <name> line for every passing assertion across 40+ suites in test all, burying [FAIL] diagnostics inside subsystem DEBUG/TRACE chatter.
  2. No separation between console UX and forensic/debug logs:
    • Currently Kernel::Log in kernel/core/log.hpp / kernel/core/log.cpp only has a single set_level() filter writing directly to the console. Lowering the log level to keep the console clean discards the detailed TRACE/DEBUG/INFO events needed for post-mortem debugging and CI forensics.

Proposed Behavior

1. Compact Console Output (Dot Progress + Failure Details)

  • Boot & test all / test <suite>:
    • Print . for each passing assertion (wrapping cleanly, e.g., every 64 dots) and F on failure.
    • Suppress non-error console chatter (TRACE/DEBUG/INFO) during compact test runs while keeping WARN/ERROR visible.
    • At the end of the run, print a concise summary (passed=<N> failed=<M>) followed by full details for any failed assertions only.
  • Verbose opt-in: Support -v / --verbose (e.g. test all -v, test <suite> -v) to stream full per-check [PASS]/[FAIL] and kernel logs live to the console when desired.

2. Full Forensic Log Capture (Standard Format, Off-Console)

  • Decouple console level from capture level in Kernel::Log (SinkWriter in kernel/core/log.hpp):
    • Always capture full TRACE–ERROR log records (with monotonic timestamp/tick, sequence number, level, tag, and message) into an in-memory kernel ring buffer regardless of the active console verbosity threshold.
    • Format records in a standard machine-readable format — e.g. JSON Lines (.jsonl / NDJSON) ({"seq":1,"ts_ns":123456,"level":"DEBUG","tag":"proc","msg":"..."}) or RFC 5424 syslog.
  • Access & export without cluttering the console:
    • Add a dmesg / logs shell command (e.g. logs, logs --tail <n>, logs --json, logs --level debug) to inspect captured logs on demand, plus automatic dump on kernel panic/fatal test failure.
    • Expose captured logs for host/EL0 forensics via one or both of:
      • A VFS node (e.g., /dev/kmsg or /tmp/kmsg.jsonl / test_milo log output) readable from userspace.
      • An optional off-console QEMU sink (e.g., secondary UART/virtio-console or -chardev file in Makefile) so make run / CI can persist full .jsonl logs to build/ without polluting the interactive milo> console.

Key Files

  • kernel/core/log.hpp & kernel/core/log.cpp (separate console level vs ring-buffer/off-console forensic sink, structured JSONL/syslog formatting)
  • kernel/shell/tests/test_common.cpp (assert_test(), dot progress, failure buffering & summary)
  • kernel/shell/shell.cpp (Kernel::Shell::run(), test all/test <suite> -v flag, dmesg/logs command)
  • Makefile (optional QEMU forensic log -chardev file wiring)
  • user/test_milo.c (optional alignment for EL0 dot-progress / -v / JSONL log dump)

Acceptance Criteria

  • Booting to milo> and running test all displays compact dot progress (.) for passes, suppresses TRACE/DEBUG/INFO console noise, and prints detailed diagnostics only for failures plus a final passed/failed summary.
  • Full TRACE–ERROR logs (including boot and test execution) are captured in a standard structured format (.jsonl or RFC 5424) without cluttering the console.
  • Captured forensic logs can be inspected on demand (logs / dmesg or exported file/chardev) and are automatically surfaced on panic or failure.
  • Verbose mode (-v) still allows live detailed console output when debugging.
  • make -j"$(nproc)" all && make -j"$(nproc)" quality passes with zero warnings, and test all in QEMU reports failed=0.

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions