summaryrefslogtreecommitdiff
path: root/ocaml/test
diff options
context:
space:
mode:
Diffstat (limited to 'ocaml/test')
-rw-r--r--ocaml/test/dune5
-rw-r--r--ocaml/test/test_ivory_boot.ml2
-rw-r--r--ocaml/test/test_life_on_bot.ml7
-rw-r--r--ocaml/test/test_two_phase_boot.ml42
4 files changed, 53 insertions, 3 deletions
diff --git a/ocaml/test/dune b/ocaml/test/dune
index c7cf6da..3f23caa 100644
--- a/ocaml/test/dune
+++ b/ocaml/test/dune
@@ -281,3 +281,8 @@
(name examine_ivory)
(modules examine_ivory)
(libraries nock_lib eio_main))
+
+(executable
+ (name test_two_phase_boot)
+ (modules test_two_phase_boot)
+ (libraries nock_lib eio_main))
diff --git a/ocaml/test/test_ivory_boot.ml b/ocaml/test/test_ivory_boot.ml
index 7cada9e..f9d511a 100644
--- a/ocaml/test/test_ivory_boot.ml
+++ b/ocaml/test/test_ivory_boot.ml
@@ -20,7 +20,7 @@ let test_ivory_boot env =
Printf.printf "Step 3: Run lifecycle formula [2 [0 3] [0 2]]\n";
Printf.printf "Step 4: Extract slot 7 from result\n\n";
- match Boot.boot_ivory ~fs state "ivory.pill" with
+ match Boot.boot_lite ~fs state "ivory.pill" with
| Error msg ->
Printf.printf "✗ Boot failed: %s\n%!" msg
diff --git a/ocaml/test/test_life_on_bot.ml b/ocaml/test/test_life_on_bot.ml
index 4aa1080..1625a53 100644
--- a/ocaml/test/test_life_on_bot.ml
+++ b/ocaml/test/test_life_on_bot.ml
@@ -7,14 +7,17 @@ let rec to_list acc noun =
| Noun.Atom _ -> List.rev acc
| Noun.Cell (item, rest) -> to_list (item :: acc) rest
-let test _env =
+let test env =
Printf.printf "═══════════════════════════════════════\n";
Printf.printf " Testing u3v_life on Bot Events\n";
Printf.printf "═══════════════════════════════════════\n\n";
+ Eio.Switch.run @@ fun _sw ->
+ let fs = Eio.Stdenv.fs env in
+
(* Cue the solid pill *)
Printf.printf "Cuing solid.pill...\n%!";
- let pill_bytes = Eio.Path.load (Eio.Path.("." / "solid.pill")) |> Bytes.of_string in
+ let pill_bytes = Eio.Path.load (Eio.Path.(fs / "solid.pill")) |> Bytes.of_string in
let pill = Serial.cue pill_bytes in
Printf.printf "✓ Pill cued\n\n";
diff --git a/ocaml/test/test_two_phase_boot.ml b/ocaml/test/test_two_phase_boot.ml
new file mode 100644
index 0000000..0669b92
--- /dev/null
+++ b/ocaml/test/test_two_phase_boot.ml
@@ -0,0 +1,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