Jacek Caban : ucrtbase/tests: Fix clock tests.
Alexandre Julliard
julliard at winehq.org
Tue Mar 17 17:21:10 CDT 2020
Module: wine
Branch: master
Commit: 618b0736fecd1367067a0b702361ab01ccb25d1b
URL: https://source.winehq.org/git/wine.git/?a=commit;h=618b0736fecd1367067a0b702361ab01ccb25d1b
Author: Jacek Caban <jacek at codeweavers.com>
Date: Tue Mar 17 15:55:24 2020 +0100
ucrtbase/tests: Fix clock tests.
crt_init_start no longer makes sense since ucrtbase.dll is directly
linked to test executable.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ucrtbase/tests/misc.c | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
diff --git a/dlls/ucrtbase/tests/misc.c b/dlls/ucrtbase/tests/misc.c
index ada3a52eb6..46389edf25 100644
--- a/dlls/ucrtbase/tests/misc.c
+++ b/dlls/ucrtbase/tests/misc.c
@@ -131,7 +131,7 @@ typedef struct {
typedef int (CDECL *MSVCRT_matherr_func)(struct MSVCRT__exception *);
static HMODULE module;
-static LONGLONG crt_init_start, crt_init_end;
+static LONGLONG crt_init_end;
static int (CDECL *p_initialize_onexit_table)(MSVCRT__onexit_table_t *table);
static int (CDECL *p_register_onexit_function)(MSVCRT__onexit_table_t *table, MSVCRT__onexit_t func);
@@ -485,16 +485,10 @@ static BOOL init(void)
{
FILETIME cur;
- GetSystemTimeAsFileTime(&cur);
- crt_init_start = ((LONGLONG)cur.dwHighDateTime << 32) + cur.dwLowDateTime;
- module = LoadLibraryA("ucrtbase.dll");
GetSystemTimeAsFileTime(&cur);
crt_init_end = ((LONGLONG)cur.dwHighDateTime << 32) + cur.dwLowDateTime;
- if(!module) {
- win_skip("ucrtbase.dll not available\n");
- return FALSE;
- }
+ module = GetModuleHandleW(L"ucrtbase.dll");
p_initialize_onexit_table = (void*)GetProcAddress(module, "_initialize_onexit_table");
p_register_onexit_function = (void*)GetProcAddress(module, "_register_onexit_function");
@@ -1384,17 +1378,16 @@ static void test__o_malloc(void)
static void test_clock(void)
{
- static const int thresh = 100;
- int c, expect_min, expect_max;
+ static const int thresh = 100, max_load_delay = 1000;
+ int c, expect_min;
FILETIME cur;
GetSystemTimeAsFileTime(&cur);
c = clock();
expect_min = (((LONGLONG)cur.dwHighDateTime << 32) + cur.dwLowDateTime - crt_init_end) / 10000;
- expect_max = (((LONGLONG)cur.dwHighDateTime << 32) + cur.dwLowDateTime - crt_init_start) / 10000;
- ok(c > expect_min-thresh && c < expect_max+thresh, "clock() = %d, expected range [%d, %d]\n",
- c, expect_min, expect_max);
+ ok(c >= expect_min - thresh && c < expect_min + max_load_delay, "clock() = %d, expected range [%d, %d]\n",
+ c, expect_min - thresh, expect_min + max_load_delay);
}
START_TEST(misc)
More information about the wine-cvs
mailing list