[PATCH] kernelbase/tests: Loosen up the Sleep() test lower bound.

Francois Gouget fgouget at codeweavers.com
Fri May 6 07:50:31 CDT 2022


It looks like Windows tries to work around the timer granularity by
sometimes returning early such that the total may be a bit less than
requested.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
Based on the failures on record 70% should be low enough (crossing
fingers).
---
 dlls/kernelbase/tests/sync.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/dlls/kernelbase/tests/sync.c b/dlls/kernelbase/tests/sync.c
index ecbff6d5707..4dfcfde3f26 100644
--- a/dlls/kernelbase/tests/sync.c
+++ b/dlls/kernelbase/tests/sync.c
@@ -213,8 +213,11 @@ static void test_Sleep(void)
     min = 50.0 * (r1 < r2 ? r1 : r2) / 10000000.0;
     max = 50.0 * (r1 < r2 ? r2 : r1) / 10000000.0;
 
-    /* Add an extra 1s to account for potential scheduling delays */
-    ok(0.9 * min <= elapsed_time && elapsed_time <= 1.0 + max,
+    /* Windows tries to work around the timer resolution by sometimes
+     * returning early such that the total may be a bit less than requested!
+     * Also add an extra 1s to account for potential scheduling delays.
+     */
+    ok(0.7 * min <= elapsed_time && elapsed_time <= 1.0 + max,
        "got %f, expected between %f and %f\n", elapsed_time, min, max);
 }
 
-- 
2.30.2



More information about the wine-devel mailing list