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

Alexandre Julliard julliard at winehq.org
Thu Dec 17 15:50:26 CST 2020


Module: wine
Branch: master
Commit: d91e951445e1109caa8b435b39611dfffd13a506
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=d91e951445e1109caa8b435b39611dfffd13a506

Author: Alex Henrie <alexhenrie24 at gmail.com>
Date:   Thu Dec 10 22:55:15 2020 -0700

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

Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernel32/tests/process.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c
index 7c6a0ff0a84..ea9cde5facc 100644
--- a/dlls/kernel32/tests/process.c
+++ b/dlls/kernel32/tests/process.c
@@ -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();




More information about the wine-cvs mailing list