Skip to content

Commit

Permalink
Delay: wait a bit more testing the module (#6162)
Browse files Browse the repository at this point in the history
In some environments the time ranges checked are too strict causing test
to fail.
Previously the maximum error accepted was 10 ms, increase to 50 ms.
Also increase timeouts to reduce error/value ratio.
  • Loading branch information
robhoes authored Dec 6, 2024
2 parents 4d3c669 + f936acb commit f14fcdf
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ocaml/libs/xapi-stdext/lib/xapi-stdext-threads/threadext_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ Single simple signal stored
let simple () =
let d = Delay.make () in
Delay.signal d ;
delay_wait_check ~min:0. ~max:0.01 d 1.0 false
delay_wait_check ~min:0. ~max:0.05 d 1.0 false

(*
No signal
- wait on same thread should timeout more or less on delay
*)
let no_signal () =
let d = Delay.make () in
delay_wait_check ~min:0.1 ~max:0.11 d 0.1 true
delay_wait_check ~min:0.2 ~max:0.25 d 0.2 true

(*
Signal twice, collapsed
Expand All @@ -52,8 +52,8 @@ let collapsed () =
let d = Delay.make () in
Delay.signal d ;
Delay.signal d ;
delay_wait_check ~min:0. ~max:0.01 d 0.1 false ;
delay_wait_check ~min:0.1 ~max:0.11 d 0.1 true
delay_wait_check ~min:0. ~max:0.05 d 0.2 false ;
delay_wait_check ~min:0.2 ~max:0.25 d 0.2 true

(*
Signal from another thread
Expand All @@ -62,8 +62,8 @@ Signal from another thread
*)
let other_thread () =
let d = Delay.make () in
let th = Thread.create (fun d -> Thread.delay 0.1 ; Delay.signal d) d in
delay_wait_check ~min:0.1 ~max:0.11 d 1.0 false ;
let th = Thread.create (fun d -> Thread.delay 0.2 ; Delay.signal d) d in
delay_wait_check ~min:0.2 ~max:0.25 d 1.0 false ;
Thread.join th

let tests =
Expand Down

0 comments on commit f14fcdf

Please sign in to comment.