From: Stephane Glondu <glondu@debian.org>
Date: Wed, 21 Aug 2024 08:52:20 +0200
Subject: Add delay in timer_check

On riscv64, it may happen that the loop is too fast and same data is
returned in two consecutive iterations.
---
 tests/dune            | 2 +-
 tests/test_entropy.ml | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/dune b/tests/dune
index 18892a3..7c489d2 100644
--- a/tests/dune
+++ b/tests/dune
@@ -34,7 +34,7 @@
  (name test_entropy)
  (modules test_entropy)
  (package mirage-crypto-rng)
- (libraries mirage-crypto-rng ohex)
+ (libraries unix mirage-crypto-rng ohex)
  (enabled_if (and (<> %{architecture} "arm64") (<> %{architecture} "riscv64"))))
  ; see https://github.com/mirage/mirage-crypto/issues/216
 
diff --git a/tests/test_entropy.ml b/tests/test_entropy.ml
index 13cb91f..e2ef433 100644
--- a/tests/test_entropy.ml
+++ b/tests/test_entropy.ml
@@ -32,6 +32,7 @@ let whirlwind_bootstrap_check () =
 
 let timer_check () =
   for i = 0 to 10 do
+    Unix.sleepf 0.01;
     let data' = Mirage_crypto_rng.Entropy.interrupt_hook () in
     if String.equal !data data' then begin
       Ohex.pp Format.std_formatter data';
