kernel32/tests: Add tests for Get(Active|Maximum)ProcessorCount.

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alex Henrie 2020-12-10 22:55:15 -07:00 committed by Alexandre Julliard
parent 114d512613
commit d91e951445
1 changed files with 22 additions and 0 deletions

View File

@ -90,6 +90,8 @@ static SIZE_T (WINAPI *pGetLargePageMinimum)(void);
static BOOL (WINAPI *pInitializeProcThreadAttributeList)(struct _PROC_THREAD_ATTRIBUTE_LIST*, DWORD, DWORD, SIZE_T*);
static BOOL (WINAPI *pUpdateProcThreadAttribute)(struct _PROC_THREAD_ATTRIBUTE_LIST*, DWORD, DWORD_PTR, void *,SIZE_T,void*,SIZE_T*);
static void (WINAPI *pDeleteProcThreadAttributeList)(struct _PROC_THREAD_ATTRIBUTE_LIST*);
static DWORD (WINAPI *pGetActiveProcessorCount)(WORD);
static DWORD (WINAPI *pGetMaximumProcessorCount)(WORD);
/* ############################### */
static char base[MAX_PATH];
@ -270,6 +272,8 @@ static BOOL init(void)
pInitializeProcThreadAttributeList = (void *)GetProcAddress(hkernel32, "InitializeProcThreadAttributeList");
pUpdateProcThreadAttribute = (void *)GetProcAddress(hkernel32, "UpdateProcThreadAttribute");
pDeleteProcThreadAttributeList = (void *)GetProcAddress(hkernel32, "DeleteProcThreadAttributeList");
pGetActiveProcessorCount = (void *)GetProcAddress(hkernel32, "GetActiveProcessorCount");
pGetMaximumProcessorCount = (void *)GetProcAddress(hkernel32, "GetMaximumProcessorCount");
return TRUE;
}
@ -2320,6 +2324,23 @@ static void test_SystemInfo(void)
}
}
static void test_ProcessorCount(void)
{
DWORD active, maximum;
if (!pGetActiveProcessorCount || !pGetMaximumProcessorCount)
{
win_skip("GetActiveProcessorCount or GetMaximumProcessorCount is not available\n");
return;
}
active = pGetActiveProcessorCount(ALL_PROCESSOR_GROUPS);
maximum = pGetMaximumProcessorCount(ALL_PROCESSOR_GROUPS);
ok(active <= maximum,
"Number of active processors %i is greater than maximum number of processors %i\n",
active, maximum);
}
static void test_RegistryQuota(void)
{
BOOL ret;
@ -4257,6 +4278,7 @@ START_TEST(process)
test_IsWow64Process();
test_IsWow64Process2();
test_SystemInfo();
test_ProcessorCount();
test_RegistryQuota();
test_DuplicateHandle();
test_StartupNoConsole();