summaryrefslogtreecommitdiff
path: root/testsuite/tests/lib-runtime-events/test_env_start.ml
blob: 6b6bca5b0995135e6157ca824e1fdc448079f4e3 (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
(* TEST
include runtime_events
set OCAML_RUNTIME_EVENTS_START = "1"
*)

(* In this test the runtime_events should already be started by the environment
   variable that we are passing and so we should not need to start it *)

let got_start = ref false

let lifecycle domain_id ts lifecycle_event data =
  match lifecycle_event with
  | Runtime_events.EV_RING_START ->
      begin
          assert(match data with
          | Some(pid) -> true
          | None -> false);
          got_start := true
      end
  | _ -> ()

let () =
  let cursor = Runtime_events.create_cursor None in
    let callbacks = Runtime_events.Callbacks.create ~lifecycle () in
      let _read = Runtime_events.read_poll cursor callbacks None in
        assert(!got_start)