From 9bad6d8d5e9a7fb3c5fab6164c861ec232d6423b Mon Sep 17 00:00:00 2001 From: Hannes Mehnert Date: Tue, 1 Oct 2024 09:35:09 +0200 Subject: [PATCH] mirage-crypto-rng-eio: declare the cstruct dependency remove unused test_rng.ml --- mirage-crypto-rng-eio.opam | 1 + rng/eio/dune | 2 +- tests/test_rng.ml | 26 -------------------------- 3 files changed, 2 insertions(+), 27 deletions(-) delete mode 100644 tests/test_rng.ml diff --git a/mirage-crypto-rng-eio.opam b/mirage-crypto-rng-eio.opam index 6348bb0e..522e0eff 100644 --- a/mirage-crypto-rng-eio.opam +++ b/mirage-crypto-rng-eio.opam @@ -20,6 +20,7 @@ depends: [ "mirage-crypto-rng" {=version} "duration" "mtime" + "cstruct" {>= "6.1.0"} "eio_main" {with-test} "ohex" {with-test & >= "0.2.0"} ] diff --git a/rng/eio/dune b/rng/eio/dune index d268ef83..44df0317 100644 --- a/rng/eio/dune +++ b/rng/eio/dune @@ -1,4 +1,4 @@ (library (name mirage_crypto_rng_eio) (public_name mirage-crypto-rng-eio) - (libraries eio logs mirage-crypto-rng duration mtime)) + (libraries eio logs mirage-crypto-rng duration mtime cstruct)) diff --git a/tests/test_rng.ml b/tests/test_rng.ml deleted file mode 100644 index 87615c8f..00000000 --- a/tests/test_rng.ml +++ /dev/null @@ -1,26 +0,0 @@ - -let all0 cs = - let c = ref 0 in - let l = Cstruct.length cs in - for i = 0 to pred l do - if Cstruct.get_uint8 cs i = 0 then incr c - done; - l = !c - -let () = - Printf.printf "foo\n%!"; - Mirage_crypto_rng_unix.initialize (module Mirage_crypto_rng.Fortuna); - let rec one z n = function - | 0 -> z - | c -> - let data = Mirage_crypto_rng.generate n in - Cstruct.hexdump data; - let z' = if all0 data then succ z else z in - one z' n (pred c) - in - let iterations = 1_000 in - let all0 = one 0 260 iterations in - if all0 = iterations then - Printf.printf "all 0\n" - else - Printf.printf "%d iterations\n" iterations