summaryrefslogtreecommitdiff
path: root/ocaml/test/test_two_phase_boot.ml
blob: 0669b9213e48f2f1b8ad8dbf7a49bd5375ef2dbb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
(* Test Two-Phase Boot: Ivory → Solid
 *
 * This matches the C Vere boot flow:
 * 1. Boot ivory pill (lite boot, creates minimal kernel)
 * 2. Boot solid events (metamorphosis to full kernel)
 *)

open Nock_lib

let test_boot env =
  Printf.printf "šŸŽÆ Testing Two-Phase Boot (Ivory → Solid)\n\n";

  Eio.Switch.run @@ fun _sw ->
  let fs = Eio.Stdenv.fs env in

  (* Create runtime state *)
  let state = State.create () in

  (* Boot with ivory + solid *)
  match Boot.boot_solid ~fs state "ivory.pill" "solid.pill" with
  | Error msg ->
      Printf.printf "āŒ Boot failed: %s\n" msg;
      exit 1
  | Ok () ->
      Printf.printf "āœ… Boot succeeded!\n\n";

      (* Check kernel state *)
      let arvo = State.get_arvo state in
      Printf.printf "Arvo kernel structure:\n";
      Printf.printf "  Type: %s\n"
        (if Noun.is_cell arvo then "Cell" else "Atom");

      Printf.printf "\nšŸŽ‰ TWO-PHASE BOOT COMPLETE!\n"

let () =
  Printf.printf "\n";
  Printf.printf "═══════════════════════════════════════════════════════════\n";
  Printf.printf " Testing Two-Phase Boot System\n";
  Printf.printf "═══════════════════════════════════════════════════════════\n";
  Printf.printf "\n";

  Eio_main.run test_boot