Francois Gouget : ntdll/tests: Improve the RtlWaitOnAddress() timeout checks.
Alexandre Julliard
julliard at winehq.org
Mon Jul 5 16:24:20 CDT 2021
Module: wine
Branch: master
Commit: e72c71d27d67462480026edc2b756a66578db7bd
URL: https://source.winehq.org/git/wine.git/?a=commit;h=e72c71d27d67462480026edc2b756a66578db7bd
Author: Francois Gouget <fgouget at codeweavers.com>
Date: Mon Jul 5 18:10:39 2021 +0200
ntdll/tests: Improve the RtlWaitOnAddress() timeout checks.
GetTickCount()'s granularity represents 15% of the time we want to
mesure, making it hard to not get failures. So use NtQuerySystemTime()
instead since we already depend on it.
Narrow down the acceptable range again.
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/tests/om.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/dlls/ntdll/tests/om.c b/dlls/ntdll/tests/om.c
index 82f8188d176..81be7de00f6 100644
--- a/dlls/ntdll/tests/om.c
+++ b/dlls/ntdll/tests/om.c
@@ -2266,10 +2266,10 @@ static void test_semaphore(void)
static void test_wait_on_address(void)
{
- DWORD ticks;
SIZE_T size;
NTSTATUS status;
- LARGE_INTEGER timeout;
+ LARGE_INTEGER start, end, timeout;
+ DWORD elapsed;
LONG64 address, compare;
if (!pRtlWaitOnAddress)
@@ -2298,13 +2298,13 @@ static void test_wait_on_address(void)
/* values match */
address = 0;
compare = 0;
- pNtQuerySystemTime(&timeout);
- timeout.QuadPart += 100*10000;
- ticks = GetTickCount();
+ pNtQuerySystemTime(&start);
+ timeout.QuadPart = start.QuadPart + 100 * 10000;
status = pRtlWaitOnAddress(&address, &compare, 8, &timeout);
- ticks = GetTickCount() - ticks;
+ pNtQuerySystemTime(&end);
ok(status == STATUS_TIMEOUT, "got 0x%08x\n", status);
- ok(ticks >= 80 && ticks <= 1000, "got %u\n", ticks);
+ elapsed = (end.QuadPart - start.QuadPart) / 10000;
+ ok(90 <= elapsed && elapsed <= 900, "timed out in %u ms\n", elapsed);
ok(address == 0, "got %s\n", wine_dbgstr_longlong(address));
ok(compare == 0, "got %s\n", wine_dbgstr_longlong(compare));
@@ -2314,12 +2314,13 @@ static void test_wait_on_address(void)
compare = ~0;
compare <<= size * 8;
+ pNtQuerySystemTime(&start);
timeout.QuadPart = -100 * 10000;
- ticks = GetTickCount();
status = pRtlWaitOnAddress(&address, &compare, size, &timeout);
- ticks = GetTickCount() - ticks;
+ pNtQuerySystemTime(&end);
ok(status == STATUS_TIMEOUT, "got 0x%08x\n", status);
- ok(ticks >= 80 && ticks <= 1000, "got %u\n", ticks);
+ elapsed = (end.QuadPart - start.QuadPart) / 10000;
+ ok(90 <= elapsed && elapsed <= 900, "timed out in %u ms\n", elapsed);
status = pRtlWaitOnAddress(&address, &compare, size << 1, &timeout);
ok(!status, "got 0x%08x\n", status);
More information about the wine-cvs
mailing list