test: wip porting tests

This commit is contained in:
Simon Cruanes 2024-08-28 16:09:56 -04:00
parent 07a7fc3a1c
commit 6e05b928ed
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
2 changed files with 4 additions and 4 deletions

View file

@ -80,10 +80,10 @@ let () =
let clock = ref (0 :: i :: clock0) in let clock = ref (0 :: i :: clock0) in
logf !clock "await fiber %d" i; logf !clock "await fiber %d" i;
logf (TS.tick_get clock) "cur fiber[%d] is some: %b" i logf (TS.tick_get clock) "cur fiber[%d] is some: %b" i
(Option.is_some @@ F.Private_.get_cur ()); (Option.is_some @@ F.Private_.get_cur_opt ());
let res = F.await f in let res = F.await f in
logf (TS.tick_get clock) "cur fiber[%d] is some: %b" i logf (TS.tick_get clock) "cur fiber[%d] is some: %b" i
(Option.is_some @@ F.Private_.get_cur ()); (Option.is_some @@ F.Private_.get_cur_opt ());
F.yield (); F.yield ();
logf (TS.tick_get clock) "res %d = %d" i res) logf (TS.tick_get clock) "res %d = %d" i res)
subs); subs);

View file

@ -7,7 +7,7 @@ module FLS = Moonpool_fib.Fls
type span_id = int type span_id = int
let k_parent : span_id option FLS.key = FLS.new_key ~init:(fun () -> None) () let k_parent : span_id option FLS.t = FLS.create ()
let ( let@ ) = ( @@ ) let ( let@ ) = ( @@ )
let spf = Printf.sprintf let spf = Printf.sprintf
@ -39,7 +39,7 @@ module Tracer = struct
let with_span self name f = let with_span self name f =
let id = Span.new_id_ () in let id = Span.new_id_ () in
let parent = FLS.get k_parent in let parent = FLS.get ~default:None k_parent in
let span = { Span.id; parent; msg = name } in let span = { Span.id; parent; msg = name } in
add self span; add self span;
FLS.with_value k_parent (Some id) f FLS.with_value k_parent (Some id) f