This commit is contained in:
parent
aa2ff7b2f0
commit
2f3113f55d
11742 changed files with 1223940 additions and 0 deletions
17
unikernel/duniverse/dune_/test/expect-tests/dune_stats/dune
Normal file
17
unikernel/duniverse/dune_/test/expect-tests/dune_stats/dune
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
(library
|
||||
(name dune_stats_tests)
|
||||
(inline_tests
|
||||
(deps
|
||||
(sandbox always)))
|
||||
(libraries
|
||||
dune_stats
|
||||
stdune
|
||||
unix
|
||||
;; This is because of the (implicit_transitive_deps false)
|
||||
;; in dune-project
|
||||
ppx_expect.config
|
||||
ppx_expect.config_types
|
||||
base
|
||||
ppx_inline_test.config)
|
||||
(preprocess
|
||||
(pps ppx_expect)))
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
open Stdune
|
||||
|
||||
let%expect_test "fd counting" =
|
||||
let module Fd_count = Dune_stats.Private.Fd_count in
|
||||
let get () =
|
||||
match Fd_count.get () with
|
||||
| This n -> n
|
||||
| Unknown -> failwith "no fd counting available"
|
||||
in
|
||||
let base = get () in
|
||||
let r, w = Unix.pipe () in
|
||||
let log () = printfn "fd count: %d" (get () - base) in
|
||||
log ();
|
||||
[%expect {| fd count: 2 |}];
|
||||
Unix.close r;
|
||||
log ();
|
||||
[%expect {| fd count: 1 |}];
|
||||
Unix.close w;
|
||||
log ();
|
||||
[%expect {| fd count: 0 |}]
|
||||
;;
|
||||
Loading…
Add table
Add a link
Reference in a new issue