summaryrefslogtreecommitdiff
path: root/ocaml/scripts/test_solid_boot.ml
blob: 06f23808c87dc5663a23556fdf4a493dac6c8319 (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
open Nock_lib

let rec find_project_root dir =
  let pills_dir = Filename.concat dir "pills" in
  if Sys.file_exists pills_dir && Sys.is_directory pills_dir then dir
  else
    let parent = Filename.dirname dir in
    if String.equal parent dir then failwith "unable to locate project root containing pills/"
    else find_project_root parent

let project_root =
  match Sys.getenv_opt "NEOVERE_ROOT" with
  | Some root -> root
  | None ->
      let exe_dir = Filename.dirname Sys.executable_name in
      find_project_root exe_dir

let () =
  Printf.printf "\n╔═══════════════════════════════════════════════════════╗\n";
  Printf.printf "║  Solid Pill Boot Test                                 ║\n";
  Printf.printf "╚═══════════════════════════════════════════════════════╝\n\n";

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

  (* Step 1: Boot ivory pill *)
  Printf.printf "[1] Booting ivory.pill...\n%!";
  let ivory_path = Filename.concat project_root "pills/ivory.pill" in
  begin match Boot.boot_ivory state ivory_path with
  | Error (Boot.Invalid_pill msg) ->
      Printf.printf "✗ Ivory boot failed: %s\n%!" msg;
      exit 1
  | Error (Boot.Unsupported msg) ->
      Printf.printf "✗ Unsupported: %s\n%!" msg;
      exit 1
  | Ok () ->
      Printf.printf "✓ Ivory kernel loaded\n\n%!";
  end;

  (* Step 2: Boot solid pill events *)
  Printf.printf "[2] Loading solid.pill events...\n%!";
  let solid_path = Filename.concat project_root "pills/solid.pill" in
  (* Process all events *)
  begin match Boot.boot_solid state solid_path with
  | Error (Boot.Invalid_pill msg) ->
      Printf.printf "✗ Solid boot failed: %s\n%!" msg;
      exit 1
  | Error (Boot.Unsupported msg) ->
      Printf.printf "✗ Unsupported: %s\n%!" msg;
      exit 1
  | Ok () ->
      let eve = State.event_number state in
      Printf.printf "✓ Solid boot completed!\n%!";
      Printf.printf "  Events played: %Ld\n\n%!" eve;
  end;

  Printf.printf "╔═══════════════════════════════════════════════════════╗\n";
  Printf.printf "║  Solid boot SUCCESS! 🎉                               ║\n";
  Printf.printf "╚═══════════════════════════════════════════════════════╝\n\n"