File: 0001-Add-delay-in-timer_check.patch

package info (click to toggle)
ocaml-mirage-crypto 2.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,524 kB
  • sloc: ansic: 91,925; ml: 9,700; makefile: 5
file content (36 lines) | stat: -rw-r--r-- 1,173 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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';