···11-/*
22- * Unit test suite for cpu functions
33- *
44- * Copyright 2014 Michael Müller
55- *
66- * This library is free software; you can redistribute it and/or
77- * modify it under the terms of the GNU Lesser General Public
88- * License as published by the Free Software Foundation; either
99- * version 2.1 of the License, or (at your option) any later version.
1010- *
1111- * This library is distributed in the hope that it will be useful,
1212- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1313- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1414- * Lesser General Public License for more details.
1515- *
1616- * You should have received a copy of the GNU Lesser General Public
1717- * License along with this library; if not, write to the Free Software
1818- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
1919- */
2020-2121-#include "precomp.h"
2222-2323-static BOOL (WINAPI *pGetNumaProcessorNode)(UCHAR, PUCHAR);
2424-2525-static void InitFunctionPointers(void)
2626-{
2727- HMODULE hkernel32 = GetModuleHandleA("kernel32");
2828-2929- pGetNumaProcessorNode = (void *)GetProcAddress(hkernel32, "GetNumaProcessorNode");
3030-}
3131-3232-static void test_GetNumaProcessorNode(void)
3333-{
3434- SYSTEM_INFO si;
3535- UCHAR node;
3636- BOOL ret;
3737- int i;
3838-3939- if (!pGetNumaProcessorNode)
4040- {
4141- win_skip("GetNumaProcessorNode() is missing\n");
4242- return;
4343- }
4444-4545- GetSystemInfo(&si);
4646-4747- for (i = 0; i < 256; i++)
4848- {
4949- ret = pGetNumaProcessorNode(i, &node);
5050- if (i < si.dwNumberOfProcessors)
5151- {
5252- ok(ret, "expected TRUE, got FALSE for processor %d\n", i);
5353- ok(node != 0xFF, "expected node != 0xFF, but got 0xFF\n");
5454- }
5555- else
5656- {
5757- ok(!ret, "expected FALSE, got TRUE for processor %d\n", i);
5858- ok(node == 0xFF, "expected node == 0xFF, but got %x\n", node);
5959- ok(GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
6060- }
6161- }
6262-6363- /* crashes on windows */
6464- if (0)
6565- {
6666- ok(!pGetNumaProcessorNode(0, NULL), "expected return value FALSE, got TRUE\n");
6767- ok(GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
6868- }
6969-}
7070-7171-START_TEST(cpu)
7272-{
7373- InitFunctionPointers();
7474- test_GetNumaProcessorNode();
7575-}