| 1 | // Licensed to the .NET Foundation under one or more agreements. |
| 2 | // The .NET Foundation licenses this file to you under the MIT license. |
| 3 | // See the LICENSE file in the project root for more information. |
| 4 | |
| 5 | /*============================================================ |
| 6 | ** |
| 7 | ** Source : test.c |
| 8 | ** |
| 9 | ** Purpose: Test for GetSystemInfo() function |
| 10 | ** |
| 11 | ** |
| 12 | **=========================================================*/ |
| 13 | |
| 14 | #include <palsuite.h> |
| 15 | |
| 16 | int __cdecl main(int argc, char *argv[]) { |
| 17 | |
| 18 | SYSTEM_INFO TheSystemInfo; |
| 19 | SYSTEM_INFO* pSystemInfo = &TheSystemInfo; |
| 20 | |
| 21 | /* |
| 22 | * Initialize the PAL and return FAILURE if this fails |
| 23 | */ |
| 24 | |
| 25 | if(0 != (PAL_Initialize(argc, argv))) |
| 26 | { |
| 27 | return FAIL; |
| 28 | } |
| 29 | |
| 30 | GetSystemInfo(pSystemInfo); |
| 31 | |
| 32 | /* Ensure both valules are > than 0 */ |
| 33 | if(pSystemInfo->dwNumberOfProcessors < 1) |
| 34 | { |
| 35 | Fail("ERROR: The dwNumberofProcessors values should be > 0." ); |
| 36 | } |
| 37 | |
| 38 | if(pSystemInfo->dwPageSize < 1) |
| 39 | { |
| 40 | Fail("ERROR: The dwPageSize should be greater than 0." ); |
| 41 | } |
| 42 | |
| 43 | /* If this isn't WIN32, ensure all the other variables are 0 */ |
| 44 | |
| 45 | #if UNIX |
| 46 | if(pSystemInfo->dwOemId != 0 || |
| 47 | pSystemInfo->wProcessorArchitecture != 0 || |
| 48 | pSystemInfo->wReserved != 0 || |
| 49 | pSystemInfo->lpMinimumApplicationAddress != 0 || |
| 50 | pSystemInfo->lpMaximumApplicationAddress != 0 || |
| 51 | pSystemInfo->dwActiveProcessorMask != 0 || |
| 52 | pSystemInfo->dwProcessorType !=0 || |
| 53 | pSystemInfo->dwAllocationGranularity !=0 || |
| 54 | pSystemInfo->wProcessorLevel != 0 || |
| 55 | pSystemInfo->wProcessorRevision != 0) { |
| 56 | Fail("ERROR: Under FreeBSD, OemId, ProcessorArchitecture, Reserved, " |
| 57 | "MinimumApplicationAddress, MaximumApplicationAddress, " |
| 58 | "ActiveProcessorMask, ProcessorType, AllocationGranularity, " |
| 59 | "ProcessorLevel and ProcessorRevision should be equal to 0." ); |
| 60 | |
| 61 | |
| 62 | } |
| 63 | #endif |
| 64 | |
| 65 | |
| 66 | PAL_Terminate(); |
| 67 | return PASS; |
| 68 | } |
| 69 | |
| 70 | |
| 71 | |