2026-03-24 13:40:46 +00:00

2.0 KiB
Raw Blame History

Layered Test Suite Architecture (PR8.3)

Overview

  • Tests are organized by runtime layer to isolate failures and clarify ownership of behavior.
  • Location: crates/dev/prometeu-layer-tests/tests/

Layers and representative tests

  1. Bytecode encode/decode
    • bytecode_encode_decode.rs — roundtrip decoding for edge immediates and structure.
  2. Verifier
    • verifier_closure_reject.rs — rejects CALL_CLOSURE when TOS is not a closure.
    • Rule: verifier tests never run the VM.
  3. VM execution
    • vm_exec_valid.rs — executes a tiny valid program; assumes verified input.
    • Rule: VM tests do not depend on the verifier; they prepare ROM directly.
  4. GC behavior
    • gc_collect_unreachable.rs — unrooted closure is reclaimed; rooted one survives.
  5. Scheduler behavior
    • scheduler_determinism.rs — deterministic FIFO ordering for sametick wakeups.

Running the layered suite

  • Run just the layered tests: cargo test -p prometeu-layer-tests
  • Run the entire workspace: cargo test

Host debugger socket tests

  • The host debugger integration tests in crates/host/prometeu-host-desktop-winit/src/runner.rs open localhost TCP ports and are marked #[ignore] in the default test flow.
  • This keeps cargo test --workspace --all-targets --all-features --no-fail-fast green in restricted environments that forbid TcpListener::bind.
  • Run the socket-dependent suite explicitly with make test-debugger-socket or cargo test -p prometeu-host-desktop-winit --lib -- --ignored.
  • These tests must still run in at least one official environment that permits localhost bind/connect.

Separation of concerns

  • No crosslayer assumptions in these tests.
  • Verifier tests: no VirtualMachine execution.
  • VM tests: assume preverified bytecode; interact via public VM APIs only.
  • GC and Scheduler tests: exercise their public APIs directly, without booting the VM.

DRY helpers

  • Shared utilities should live in crates/dev/prometeu-test-support when needed. The current minimal suite avoids duplication by using tiny local helpers.