Compare commits

...

1 commit
v0.11 ... main

Author SHA1 Message Date
Simon Cruanes
18701bfde4
update to trace 0.11 and qcheck 0.21
Some checks failed
github pages / Deploy doc (push) Has been cancelled
Build and Test / build (push) Has been cancelled
Build and Test / build-compat (push) Has been cancelled
Build and Test / format (push) Has been cancelled
2026-02-24 21:16:22 -05:00
9 changed files with 46 additions and 40 deletions

View file

@ -28,12 +28,18 @@
dune dune
(either (either
(>= 1.0)) (>= 1.0))
(trace :with-test) (trace
(trace-tef :with-test) (and
(>= 0.11)
:with-test))
(trace-tef
(and
(>= 0.11)
:with-test))
(qcheck-core (qcheck-core
(and (and
:with-test :with-test
(>= 0.19))) (>= 0.21)))
(thread-local-storage (thread-local-storage
(and (and
(>= 0.2) (>= 0.2)
@ -71,12 +77,18 @@
(qcheck-core (qcheck-core
(and (and
:with-test :with-test
(>= 0.19))) (>= 0.21)))
(hmap :with-test) (hmap :with-test)
(lwt (and (>= 5.0) (< 6.0))) (lwt (and (>= 5.0) (< 6.0)))
base-unix base-unix
(trace :with-test) (trace
(trace-tef :with-test) (and
(>= 0.11)
:with-test))
(trace-tef
(and
(>= 0.11)
:with-test))
(odoc :with-doc))) (odoc :with-doc)))
; See the complete stanza docs at https://dune.readthedocs.io/en/stable/dune-files.html#dune-project ; See the complete stanza docs at https://dune.readthedocs.io/en/stable/dune-files.html#dune-project

View file

@ -11,12 +11,12 @@ depends: [
"dune" {>= "3.0"} "dune" {>= "3.0"}
"moonpool" {= version} "moonpool" {= version}
"ocaml" {>= "5.0"} "ocaml" {>= "5.0"}
"qcheck-core" {with-test & >= "0.19"} "qcheck-core" {with-test & >= "0.21"}
"hmap" {with-test} "hmap" {with-test}
"lwt" {>= "5.0" & < "6.0"} "lwt" {>= "5.0" & < "6.0"}
"base-unix" "base-unix"
"trace" {with-test} "trace" {>= "0.11" & with-test}
"trace-tef" {with-test} "trace-tef" {>= "0.11" & with-test}
"odoc" {with-doc} "odoc" {with-doc}
] ]
build: [ build: [

View file

@ -12,9 +12,9 @@ depends: [
"ocaml" {>= "5.0"} "ocaml" {>= "5.0"}
"dune" {>= "3.0"} "dune" {>= "3.0"}
"either" {>= "1.0"} "either" {>= "1.0"}
"trace" {with-test} "trace" {>= "0.11" & with-test}
"trace-tef" {with-test} "trace-tef" {>= "0.11" & with-test}
"qcheck-core" {with-test & >= "0.19"} "qcheck-core" {with-test & >= "0.21"}
"thread-local-storage" {>= "0.2" & < "0.3"} "thread-local-storage" {>= "0.2" & < "0.3"}
"odoc" {with-doc} "odoc" {with-doc}
"hmap" {with-test} "hmap" {with-test}

View file

@ -171,7 +171,7 @@ module Evaluator = struct
let gen_fun = let gen_fun =
Q.Gen.( Q.Gen.(
frequency oneof_weighted
[ [
( 2, ( 2,
let+ n = 0 -- 100 in let+ n = 0 -- 100 in
@ -190,7 +190,7 @@ module Evaluator = struct
abs x abs x
in in
let open Q.Gen in let open Q.Gen in
frequency oneof_weighted
[ [
( 1, ( 1,
let+ x = 1 -- 10000 in let+ x = 1 -- 10000 in
@ -208,13 +208,13 @@ module Evaluator = struct
let+ f = gen_fun let+ f = gen_fun
and+ csize = 1 -- 16 and+ csize = 1 -- 16
and+ l = list_size (0 -- 290) (gen 1) and+ l = list_size (0 -- 290) (gen 1)
and+ r = oneofl [ R_add; R_max; R_add_shift ] in and+ r = oneof_list [ R_add; R_max; R_add_shift ] in
Map_arr (csize, f, l, r) ); Map_arr (csize, f, l, r) );
( clamp_if_base 2, ( clamp_if_base 2,
let+ f = gen_fun let+ f = gen_fun
and+ csize = 1 -- 3 and+ csize = 1 -- 3
and+ l = list_size (1 -- 7) (gen (min 3 (n - 1))) and+ l = list_size (1 -- 7) (gen (min 3 (n - 1)))
and+ r = oneofl [ R_add; R_max; R_add_shift ] in and+ r = oneof_list [ R_add; R_max; R_add_shift ] in
Map_arr (csize, f, l, r) ); Map_arr (csize, f, l, r) );
] ]
@ -280,7 +280,7 @@ let t_for_nested ~min ~chunk_size () =
let neg x = -x in let neg x = -x in
Q.Test.make Q.Test.make
~name:(spf "t_for_nested ~min:%d" min) ~name:(spf "t_for_nested ~min:%d" min)
Q.(small_list (small_list small_int)) Q.(list_small (list_small nat_small))
(fun l -> (fun l ->
let ref_l1 = List.map (List.map neg) l in let ref_l1 = List.map (List.map neg) l in
let ref_l2 = List.map (List.map neg) ref_l1 in let ref_l2 = List.map (List.map neg) ref_l1 in
@ -302,7 +302,7 @@ let t_for_nested ~min ~chunk_size () =
let t_map ~chunk_size () = let t_map ~chunk_size () =
let ppa = Q.Print.(array string) in let ppa = Q.Print.(array string) in
Q.Test.make ~name:"map1" Q.Test.make ~name:"map1"
Q.(small_list small_int |> Q.set_stats [ "len", List.length ]) Q.(list_small nat_small |> Q.set_stats [ "len", List.length ])
(fun l -> (fun l ->
let@ pool = Ws_pool.with_ ~num_threads:4 () in let@ pool = Ws_pool.with_ ~num_threads:4 () in
let@ () = Ws_pool.run_wait_block pool in let@ () = Ws_pool.run_wait_block pool in

View file

@ -25,7 +25,7 @@ let main ~port ~n ~n_conn ~verbose ~msg_per_conn () : unit =
let@ () = M_lwt.spawn_lwt in let@ () = M_lwt.spawn_lwt in
let _sp = let _sp =
Trace.enter_manual_span ~parent:None ~__FILE__ ~__LINE__ "connect.client" Trace.enter_span ~parent:None ~__FILE__ ~__LINE__ "connect.client"
in in
Trace.message "connecting new client…"; Trace.message "connecting new client…";
@ -43,9 +43,7 @@ let main ~port ~n ~n_conn ~verbose ~msg_per_conn () : unit =
for _j = 1 to msg_per_conn do for _j = 1 to msg_per_conn do
let _sp = let _sp =
Trace.enter_manual_span Trace.enter_span ~parent:(Some _sp) ~__FILE__ ~__LINE__ "write.loop"
~parent:(Some (Trace.ctx_of_span _sp))
~__FILE__ ~__LINE__ "write.loop"
in in
let s = spf "hello %d" _j in let s = spf "hello %d" _j in
@ -57,10 +55,10 @@ let main ~port ~n ~n_conn ~verbose ~msg_per_conn () : unit =
Lwt_io.read_into_exactly ic buf 0 (String.length s) |> await_lwt; Lwt_io.read_into_exactly ic buf 0 (String.length s) |> await_lwt;
if verbose then if verbose then
Printf.printf "read: %s\n%!" (Bytes.sub_string buf 0 (String.length s)); Printf.printf "read: %s\n%!" (Bytes.sub_string buf 0 (String.length s));
Trace.exit_manual_span _sp; Trace.exit_span _sp;
() ()
done; done;
Trace.exit_manual_span _sp Trace.exit_span _sp
in in
(* start the first [n_conn] tasks *) (* start the first [n_conn] tasks *)

View file

@ -22,7 +22,7 @@ let main ~port ~verbose ~runner:_ () : unit =
let handle_client client_addr (ic, oc) : _ Lwt.t = let handle_client client_addr (ic, oc) : _ Lwt.t =
let@ () = M_lwt.spawn_lwt in let@ () = M_lwt.spawn_lwt in
let _sp = let _sp =
Trace.enter_manual_span ~parent:None ~__FILE__ ~__LINE__ "handle.client" Trace.enter_span ~parent:None ~__FILE__ ~__LINE__ "handle.client"
~data:(fun () -> [ "addr", `String (str_of_sockaddr client_addr) ]) ~data:(fun () -> [ "addr", `String (str_of_sockaddr client_addr) ])
in in
@ -45,7 +45,7 @@ let main ~port ~verbose ~runner:_ () : unit =
done; done;
if verbose then if verbose then
Printf.printf "done with client on %s\n%!" (str_of_sockaddr client_addr); Printf.printf "done with client on %s\n%!" (str_of_sockaddr client_addr);
Trace.exit_manual_span _sp; Trace.exit_span _sp;
Trace.message "exit handle client" Trace.message "exit handle client"
in in

View file

@ -21,9 +21,7 @@ let main ~port ~ext ~dir ~n_conn () : unit =
(* TODO: *) (* TODO: *)
let run_task () : unit Lwt.t = let run_task () : unit Lwt.t =
let@ () = M_lwt.spawn_lwt in let@ () = M_lwt.spawn_lwt in
let _sp = let _sp = Trace.enter_span ~parent:None ~__FILE__ ~__LINE__ "run-task" in
Trace.enter_manual_span ~parent:None ~__FILE__ ~__LINE__ "run-task"
in
let seen = Str_tbl.create 16 in let seen = Str_tbl.create 16 in
@ -35,9 +33,7 @@ let main ~port ~ext ~dir ~n_conn () : unit =
() ()
else if Sys.is_directory file then ( else if Sys.is_directory file then (
let _sp = let _sp =
Trace.enter_manual_span Trace.enter_span ~parent:(Some _sp) ~__FILE__ ~__LINE__ "walk-dir"
~parent:(Some (Trace.ctx_of_span _sp))
~__FILE__ ~__LINE__ "walk-dir"
~data:(fun () -> [ "d", `String file ]) ~data:(fun () -> [ "d", `String file ])
in in
@ -55,7 +51,7 @@ let main ~port ~ext ~dir ~n_conn () : unit =
) )
in in
walk dir; walk dir;
Trace.exit_manual_span _sp Trace.exit_span _sp
in in
(* start the first [n_conn] tasks *) (* start the first [n_conn] tasks *)

View file

@ -167,7 +167,7 @@ let main ~port ~runner () : unit =
let handle_client client_addr (ic, oc) = let handle_client client_addr (ic, oc) =
let@ () = Moonpool_lwt.spawn_lwt in let@ () = Moonpool_lwt.spawn_lwt in
let _sp = let _sp =
Trace.enter_manual_span ~parent:None ~__FILE__ ~__LINE__ "handle.client" Trace.enter_span ~parent:None ~__FILE__ ~__LINE__ "handle.client"
~data:(fun () -> [ "addr", `String (str_of_sockaddr client_addr) ]) ~data:(fun () -> [ "addr", `String (str_of_sockaddr client_addr) ])
in in
@ -199,7 +199,7 @@ let main ~port ~runner () : unit =
Lwt_io.flush oc |> await_lwt Lwt_io.flush oc |> await_lwt
done done
with End_of_file | Unix.Unix_error (Unix.ECONNRESET, _, _) -> with End_of_file | Unix.Unix_error (Unix.ECONNRESET, _, _) ->
Trace.exit_manual_span _sp; Trace.exit_span _sp;
Trace.message "exit handle client" Trace.message "exit handle client"
in in

View file

@ -13,7 +13,7 @@ let with_pool ~kind () f =
let () = let () =
add_test @@ fun ~kind -> add_test @@ fun ~kind ->
Q.Test.make ~name:"map then join_list" Q.Test.make ~name:"map then join_list"
Q.(small_list small_int) Q.(list_small nat_small)
(fun l -> (fun l ->
let@ pool = with_pool ~kind () in let@ pool = with_pool ~kind () in
let l' = List.map (fun x -> Fut.spawn ~on:pool (fun () -> x + 1)) l in let l' = List.map (fun x -> Fut.spawn ~on:pool (fun () -> x + 1)) l in
@ -24,7 +24,7 @@ let () =
let () = let () =
add_test @@ fun ~kind -> add_test @@ fun ~kind ->
Q.Test.make ~name:"map bind" Q.Test.make ~name:"map bind"
Q.(small_list small_int) Q.(list_small nat_small)
(fun l -> (fun l ->
let@ pool = with_pool ~kind () in let@ pool = with_pool ~kind () in
let open Fut.Infix in let open Fut.Infix in