diff options
Diffstat (limited to 'src/pal/tests/palsuite/miscellaneous/GetSystemInfo')
4 files changed, 109 insertions, 0 deletions
diff --git a/src/pal/tests/palsuite/miscellaneous/GetSystemInfo/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/GetSystemInfo/CMakeLists.txt new file mode 100644 index 0000000000..f6aa0cb2d9 --- /dev/null +++ b/src/pal/tests/palsuite/miscellaneous/GetSystemInfo/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +add_subdirectory(test1) + diff --git a/src/pal/tests/palsuite/miscellaneous/GetSystemInfo/test1/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/GetSystemInfo/test1/CMakeLists.txt new file mode 100644 index 0000000000..960291fe79 --- /dev/null +++ b/src/pal/tests/palsuite/miscellaneous/GetSystemInfo/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test.c +) + +add_executable(paltest_getsysteminfo_test1 + ${SOURCES} +) + +add_dependencies(paltest_getsysteminfo_test1 coreclrpal) + +target_link_libraries(paltest_getsysteminfo_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/miscellaneous/GetSystemInfo/test1/test.c b/src/pal/tests/palsuite/miscellaneous/GetSystemInfo/test1/test.c new file mode 100644 index 0000000000..5f3608fb70 --- /dev/null +++ b/src/pal/tests/palsuite/miscellaneous/GetSystemInfo/test1/test.c @@ -0,0 +1,70 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/*============================================================ +** +** Source : test.c +** +** Purpose: Test for GetSystemInfo() function +** +** +**=========================================================*/ + +#include <palsuite.h> + +int __cdecl main(int argc, char *argv[]) { + + SYSTEM_INFO TheSystemInfo; + SYSTEM_INFO* pSystemInfo = &TheSystemInfo; + + /* + * Initialize the PAL and return FAILURE if this fails + */ + + if(0 != (PAL_Initialize(argc, argv))) + { + return FAIL; + } + + GetSystemInfo(pSystemInfo); + + /* Ensure both valules are > than 0 */ + if(pSystemInfo->dwNumberOfProcessors < 1) + { + Fail("ERROR: The dwNumberofProcessors values should be > 0."); + } + + if(pSystemInfo->dwPageSize < 1) + { + Fail("ERROR: The dwPageSize should be greater than 0."); + } + + /* If this isn't WIN32, ensure all the other variables are 0 */ + +#if UNIX + if(pSystemInfo->dwOemId != 0 || + pSystemInfo->wProcessorArchitecture != 0 || + pSystemInfo->wReserved != 0 || + pSystemInfo->lpMinimumApplicationAddress != 0 || + pSystemInfo->lpMaximumApplicationAddress != 0 || + pSystemInfo->dwActiveProcessorMask != 0 || + pSystemInfo->dwProcessorType !=0 || + pSystemInfo->dwAllocationGranularity !=0 || + pSystemInfo->wProcessorLevel != 0 || + pSystemInfo->wProcessorRevision != 0) { + Fail("ERROR: Under FreeBSD, OemId, ProcessorArchitecture, Reserved, " + "MinimumApplicationAddress, MaximumApplicationAddress, " + "ActiveProcessorMask, ProcessorType, AllocationGranularity, " + "ProcessorLevel and ProcessorRevision should be equal to 0."); + + + } +#endif + + + PAL_Terminate(); + return PASS; +} + + diff --git a/src/pal/tests/palsuite/miscellaneous/GetSystemInfo/test1/testinfo.dat b/src/pal/tests/palsuite/miscellaneous/GetSystemInfo/test1/testinfo.dat new file mode 100644 index 0000000000..7f03c6355c --- /dev/null +++ b/src/pal/tests/palsuite/miscellaneous/GetSystemInfo/test1/testinfo.dat @@ -0,0 +1,16 @@ +# Licensed to the .NET Foundation under one or more agreements. +# The .NET Foundation licenses this file to you under the MIT license. +# See the LICENSE file in the project root for more information. + +Version = 1.0 +Section = Miscellaneous +Function = GetSystemInfo +Name = Positive Test for GetSystemInfo +TYPE = DEFAULT +EXE1 = test +Description += Ensures the two required System Info fields can be aquired, += and the others are all 0. + + + |