diff options
author | Jiyoung Yun <jy910.yun@samsung.com> | 2017-04-13 14:17:19 +0900 |
---|---|---|
committer | Jiyoung Yun <jy910.yun@samsung.com> | 2017-04-13 14:17:19 +0900 |
commit | a56e30c8d33048216567753d9d3fefc2152af8ac (patch) | |
tree | 7e5d979695fc4a431740982eb1cfecc2898b23a5 /src/pal/tests/palsuite | |
parent | 4b11dc566a5bbfa1378d6266525c281b028abcc8 (diff) | |
download | coreclr-a56e30c8d33048216567753d9d3fefc2152af8ac.tar.gz coreclr-a56e30c8d33048216567753d9d3fefc2152af8ac.tar.bz2 coreclr-a56e30c8d33048216567753d9d3fefc2152af8ac.zip |
Imported Upstream version 2.0.0.11353upstream/2.0.0.11353
Diffstat (limited to 'src/pal/tests/palsuite')
33 files changed, 201 insertions, 267 deletions
diff --git a/src/pal/tests/palsuite/c_runtime/pow/test1/test1.cpp b/src/pal/tests/palsuite/c_runtime/pow/test1/test1.cpp index 0a05cd5a47..7eea316e62 100644 --- a/src/pal/tests/palsuite/c_runtime/pow/test1/test1.cpp +++ b/src/pal/tests/palsuite/c_runtime/pow/test1/test1.cpp @@ -106,6 +106,9 @@ int __cdecl main(int argc, char **argv) { -2.7182818284590452, 1, -2.7182818284590452, PAL_EPSILON * 10 }, // x: -(e) expected: e { -2.7182818284590452, PAL_POSINF, PAL_POSINF, 0 }, // x: -(e) + { -1.0, PAL_NEGINF, 1.0, PAL_EPSILON * 10 }, + { -1.0, PAL_POSINF, 1.0, PAL_EPSILON * 10 }, + { -0.0, PAL_NEGINF, PAL_POSINF, 0 }, { -0.0, -1, PAL_NEGINF, 0 }, { -0.0, -0.0, 1, PAL_EPSILON * 10 }, @@ -113,6 +116,9 @@ int __cdecl main(int argc, char **argv) { -0.0, 1, -0.0, PAL_EPSILON }, { -0.0, PAL_POSINF, 0, PAL_EPSILON }, + { PAL_NAN, -0.0, 1.0, PAL_EPSILON * 10 }, + { PAL_NAN, 0, 1.0, PAL_EPSILON * 10 }, + { 0.0, PAL_NEGINF, PAL_POSINF, 0 }, { 0.0, -1, PAL_POSINF, 0 }, { 0, -0.0, 1, PAL_EPSILON * 10 }, @@ -211,12 +217,6 @@ int __cdecl main(int argc, char **argv) validate_isnan(-2.7182818284590452, 0.78539816339744828); // x: -(e) y: pi / 4 validate_isnan(-2.7182818284590452, 1.5707963267948966); // x: -(e) y: pi / 2 - validate_isnan(-1, PAL_NEGINF); - validate_isnan(-1, PAL_POSINF); - - validate_isnan(PAL_NAN, -0.0); - validate_isnan(PAL_NAN, 0); - validate_isnan(PAL_NEGINF, PAL_NAN); validate_isnan(PAL_NAN, PAL_NEGINF); diff --git a/src/pal/tests/palsuite/c_runtime/powf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/powf/test1/test1.c index ca738e8c8d..e8933c5ce2 100644 --- a/src/pal/tests/palsuite/c_runtime/powf/test1/test1.c +++ b/src/pal/tests/palsuite/c_runtime/powf/test1/test1.c @@ -104,7 +104,10 @@ int __cdecl main(int argc, char **argv) { -2.71828183f, 0, 1, PAL_EPSILON * 10 }, // x: -(e) { -2.71828183f, 1, -2.71828183f, PAL_EPSILON * 10 }, // x: -(e) expected: e { -2.71828183f, PAL_POSINF, PAL_POSINF, 0 }, // x: -(e) - + + { -1.0, PAL_NEGINF, 1.0, PAL_EPSILON * 10 }, + { -1.0, PAL_POSINF, 1.0, PAL_EPSILON * 10 }, + { -0.0, PAL_NEGINF, PAL_POSINF, 0 }, { -0.0, -1, PAL_NEGINF, 0 }, { -0.0f, -0.0f, 1, PAL_EPSILON * 10 }, @@ -112,6 +115,9 @@ int __cdecl main(int argc, char **argv) { -0.0, 1, -0.0, PAL_EPSILON }, { -0.0, PAL_POSINF, 0, PAL_EPSILON }, + { PAL_NAN, -0.0, 1.0, PAL_EPSILON * 10 }, + { PAL_NAN, 0, 1.0, PAL_EPSILON * 10 }, + { 0.0, PAL_NEGINF, PAL_POSINF, 0 }, { 0.0, -1, PAL_POSINF, 0 }, { 0, -0.0f, 1, PAL_EPSILON * 10 }, @@ -210,12 +216,6 @@ int __cdecl main(int argc, char **argv) validate_isnan(-2.71828183f, 0.785398163f); // x: -(e) y: pi / 4 validate_isnan(-2.71828183f, 1.57079633f); // x: -(e) y: pi / 2 - validate_isnan(-1, PAL_NEGINF); - validate_isnan(-1, PAL_POSINF); - - validate_isnan(PAL_NAN, -0.0); - validate_isnan(PAL_NAN, 0); - validate_isnan(PAL_NEGINF, PAL_NAN); validate_isnan(PAL_NAN, PAL_NEGINF); diff --git a/src/pal/tests/palsuite/filemapping_memmgt/FreeLibrary/test1/dlltest.cpp b/src/pal/tests/palsuite/filemapping_memmgt/FreeLibrary/test1/dlltest.cpp index 44f1b5a903..3e6cff292e 100644 --- a/src/pal/tests/palsuite/filemapping_memmgt/FreeLibrary/test1/dlltest.cpp +++ b/src/pal/tests/palsuite/filemapping_memmgt/FreeLibrary/test1/dlltest.cpp @@ -19,13 +19,13 @@ __declspec(dllexport) #endif -int __stdcall DllTest() +int PALAPI DllTest() { return 1; } #ifdef WIN32 -int __stdcall _DllMainCRTStartup(void *hinstDLL, int reason, void * lpvReserved) +int PALAPI _DllMainCRTStartup(void *hinstDLL, int reason, void * lpvReserved) { return 1; } diff --git a/src/pal/tests/palsuite/filemapping_memmgt/FreeLibraryAndExitThread/test1/dlltest.cpp b/src/pal/tests/palsuite/filemapping_memmgt/FreeLibraryAndExitThread/test1/dlltest.cpp index 954c624d19..e66a9ebdbe 100644 --- a/src/pal/tests/palsuite/filemapping_memmgt/FreeLibraryAndExitThread/test1/dlltest.cpp +++ b/src/pal/tests/palsuite/filemapping_memmgt/FreeLibraryAndExitThread/test1/dlltest.cpp @@ -19,13 +19,13 @@ __declspec(dllexport) #endif -int _stdcall DllTest() +int PALAPI DllTest() { return 1; } #if WIN32 -int __stdcall _DllMainCRTStartup(void *hinstDLL, int reason, void * lpvReserved) +int PALAPI _DllMainCRTStartup(void *hinstDLL, int reason, void * lpvReserved) { return 1; } diff --git a/src/pal/tests/palsuite/filemapping_memmgt/GetProcAddress/test1/test1.cpp b/src/pal/tests/palsuite/filemapping_memmgt/GetProcAddress/test1/test1.cpp index f0b76c615f..5515ae4562 100644 --- a/src/pal/tests/palsuite/filemapping_memmgt/GetProcAddress/test1/test1.cpp +++ b/src/pal/tests/palsuite/filemapping_memmgt/GetProcAddress/test1/test1.cpp @@ -15,7 +15,7 @@ **===========================================================================*/ #include <palsuite.h> -typedef int (__stdcall *SIMPLEFUNCTION)(int); +typedef int (PALAPI *SIMPLEFUNCTION)(int); /* SHLEXT is defined only for Unix variants */ #if defined(SHLEXT) diff --git a/src/pal/tests/palsuite/filemapping_memmgt/GetProcAddress/test1/testlib.cpp b/src/pal/tests/palsuite/filemapping_memmgt/GetProcAddress/test1/testlib.cpp index e8fe48e05d..7b87ba7f79 100644 --- a/src/pal/tests/palsuite/filemapping_memmgt/GetProcAddress/test1/testlib.cpp +++ b/src/pal/tests/palsuite/filemapping_memmgt/GetProcAddress/test1/testlib.cpp @@ -20,13 +20,13 @@ __declspec(dllexport) /** * Simple function that returns i+1 */ -int __stdcall SimpleFunction(int i) +int PALAPI SimpleFunction(int i) { return i+1; } #if WIN32 -int __stdcall _DllMainCRTStartup(void *hinstDLL, int reason, void *lpvReserved) +int PALAPI _DllMainCRTStartup(void *hinstDLL, int reason, void *lpvReserved) { return 1; } diff --git a/src/pal/tests/palsuite/filemapping_memmgt/GetProcAddress/test2/testlib.cpp b/src/pal/tests/palsuite/filemapping_memmgt/GetProcAddress/test2/testlib.cpp index 23e58e871e..47299a1b1f 100644 --- a/src/pal/tests/palsuite/filemapping_memmgt/GetProcAddress/test2/testlib.cpp +++ b/src/pal/tests/palsuite/filemapping_memmgt/GetProcAddress/test2/testlib.cpp @@ -20,13 +20,13 @@ __declspec(dllexport) /** * Simple function that returns i+1 */ -int __stdcall SimpleFunction(int i) +int PALAPI SimpleFunction(int i) { return i+1; } #if WIN32 -int __stdcall _DllMainCRTStartup(void *hinstDLL, int reason, void *lpvReserved) +int PALAPI _DllMainCRTStartup(void *hinstDLL, int reason, void *lpvReserved) { return 1; } diff --git a/src/pal/tests/palsuite/loader/LoadLibraryA/test6/dlltest.cpp b/src/pal/tests/palsuite/loader/LoadLibraryA/test6/dlltest.cpp index 72380eebb5..372657605b 100644 --- a/src/pal/tests/palsuite/loader/LoadLibraryA/test6/dlltest.cpp +++ b/src/pal/tests/palsuite/loader/LoadLibraryA/test6/dlltest.cpp @@ -23,7 +23,7 @@ static int g_attachCount = 0; /* standard DllMain() */ -BOOL __stdcall DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID lpvReserved) +BOOL PALAPI DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID lpvReserved) { switch( reason ) { @@ -53,7 +53,7 @@ BOOL __stdcall DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID lpvReserved) } #if _WIN32 -BOOL __stdcall _DllMainCRTStartup(HINSTANCE hinstDLL, DWORD reason, LPVOID lpvReserved) +BOOL PALAPI _DllMainCRTStartup(HINSTANCE hinstDLL, DWORD reason, LPVOID lpvReserved) { return DllMain(hinstDLL, reason, lpvReserved); } diff --git a/src/pal/tests/palsuite/loader/LoadLibraryA/test8/dlltest.cpp b/src/pal/tests/palsuite/loader/LoadLibraryA/test8/dlltest.cpp index 72380eebb5..372657605b 100644 --- a/src/pal/tests/palsuite/loader/LoadLibraryA/test8/dlltest.cpp +++ b/src/pal/tests/palsuite/loader/LoadLibraryA/test8/dlltest.cpp @@ -23,7 +23,7 @@ static int g_attachCount = 0; /* standard DllMain() */ -BOOL __stdcall DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID lpvReserved) +BOOL PALAPI DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID lpvReserved) { switch( reason ) { @@ -53,7 +53,7 @@ BOOL __stdcall DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID lpvReserved) } #if _WIN32 -BOOL __stdcall _DllMainCRTStartup(HINSTANCE hinstDLL, DWORD reason, LPVOID lpvReserved) +BOOL PALAPI _DllMainCRTStartup(HINSTANCE hinstDLL, DWORD reason, LPVOID lpvReserved) { return DllMain(hinstDLL, reason, lpvReserved); } diff --git a/src/pal/tests/palsuite/miscellaneous/GetVersionExA/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/CGroup/CMakeLists.txt index f6aa0cb2d9..f6aa0cb2d9 100644 --- a/src/pal/tests/palsuite/miscellaneous/GetVersionExA/CMakeLists.txt +++ b/src/pal/tests/palsuite/miscellaneous/CGroup/CMakeLists.txt diff --git a/src/pal/tests/palsuite/miscellaneous/CGroup/test1/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/CGroup/test1/CMakeLists.txt new file mode 100644 index 0000000000..cdd7fa99d0 --- /dev/null +++ b/src/pal/tests/palsuite/miscellaneous/CGroup/test1/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test.cpp +) + +add_executable(paltest_cgroup_test1 + ${SOURCES} +) + +add_dependencies(paltest_cgroup_test1 coreclrpal) + +target_link_libraries(paltest_cgroup_test1 + ${COMMON_TEST_LIBRARIES} +) diff --git a/src/pal/tests/palsuite/miscellaneous/CGroup/test1/test.cpp b/src/pal/tests/palsuite/miscellaneous/CGroup/test1/test.cpp new file mode 100644 index 0000000000..44b970a233 --- /dev/null +++ b/src/pal/tests/palsuite/miscellaneous/CGroup/test1/test.cpp @@ -0,0 +1,53 @@ +// 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 CGroup +** +** +** Steps to run this test on ubuntu: +** 1. sudo apt-get install cgroup-bin +** 2. sudo vi /etc/default/grub +** Add cgroup_enable=memory swapaccount=1 to GRUB_CMDLINE_LINUX_DEFAULT +** 3. sudo update-grub +** 4. reboot +** 5. sudo cgcreate -g cpu,memory:/myGroup -a <username>:<username> -t <username>:<username> +** 6. echo 4M > /sys/fs/cgroup/memory/mygroup/memory.limit_in_bytes +** 7. echo 4M > /sys/fs/cgroup/memory/mygroup/memory.memsw.limit_in_bytes +** 8. cgexe -g memory:/mygroup --sticky <application> +**=========================================================*/ + +#include <palsuite.h> + +int __cdecl main(int argc,char *argv[]) +{ + + /* + * Initialize the PAL and return FAILURE if this fails + */ + + if(0 != (PAL_Initialize(argc, argv))) + { + return FAIL; + } + + size_t mem_limit = PAL_GetRestrictedPhysicalMemoryLimit(); + + FILE* file = fopen("/sys/fs/cgroup/memory/mygroup/memory.limit_in_bytes", "r"); + if(file != NULL) + { + if(mem_limit != 4194304) + Fail("Memory limit obtained from PAL_GetRestrictedPhysicalMemory is not 4MB\n"); + fclose(file); + } + + PAL_Terminate(); + return PASS; +} + + + diff --git a/src/pal/tests/palsuite/miscellaneous/GetVersionExW/test1/testinfo.dat b/src/pal/tests/palsuite/miscellaneous/CGroup/test1/testinfo.dat index 7773245b3f..86da2d1515 100644 --- a/src/pal/tests/palsuite/miscellaneous/GetVersionExW/test1/testinfo.dat +++ b/src/pal/tests/palsuite/miscellaneous/CGroup/test1/testinfo.dat @@ -4,13 +4,9 @@ Version = 1.0 Section = Miscellaneous -Function = GetVersionExW -Name = Positive Test for GetVersionExW +Function = CGroup +Name = Positive Test for CGroup TYPE = DEFAULT EXE1 = test Description -= Test that all the values in the OSVERSION structure are set properly -= for the current environment. - - - += Test to see if Cgroup memory limit works properly diff --git a/src/pal/tests/palsuite/miscellaneous/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/CMakeLists.txt index 0fd4df8ad5..9352edef52 100644 --- a/src/pal/tests/palsuite/miscellaneous/CMakeLists.txt +++ b/src/pal/tests/palsuite/miscellaneous/CMakeLists.txt @@ -1,5 +1,6 @@ cmake_minimum_required(VERSION 2.8.12.2) +add_subdirectory(CGroup) add_subdirectory(CharNextA) add_subdirectory(CharNextExA) add_subdirectory(CloseHandle) @@ -14,6 +15,7 @@ add_subdirectory(GetEnvironmentVariableA) add_subdirectory(GetEnvironmentVariableW) add_subdirectory(GetLastError) add_subdirectory(GetSystemInfo) +add_subdirectory(GlobalMemoryStatusEx) add_subdirectory(GetTickCount) add_subdirectory(InterlockedBit) add_subdirectory(InterlockedCompareExchange) diff --git a/src/pal/tests/palsuite/miscellaneous/GetVersionExA/test1/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/GetVersionExA/test1/CMakeLists.txt deleted file mode 100644 index 1e512f3c2f..0000000000 --- a/src/pal/tests/palsuite/miscellaneous/GetVersionExA/test1/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test.cpp -) - -add_executable(paltest_getversionexa_test1 - ${SOURCES} -) - -add_dependencies(paltest_getversionexa_test1 coreclrpal) - -target_link_libraries(paltest_getversionexa_test1 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/pal/tests/palsuite/miscellaneous/GetVersionExA/test1/test.cpp b/src/pal/tests/palsuite/miscellaneous/GetVersionExA/test1/test.cpp deleted file mode 100644 index 5dd20c6576..0000000000 --- a/src/pal/tests/palsuite/miscellaneous/GetVersionExA/test1/test.cpp +++ /dev/null @@ -1,83 +0,0 @@ -// 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 GetVersionExA() function -** -** -**=========================================================*/ - -#include <palsuite.h> - -int __cdecl main(int argc, char *argv[]) { - - OSVERSIONINFO TheVersionInfo; - OSVERSIONINFO* pVersionInfo = &TheVersionInfo; - - /* - * Initialize the PAL and return FAILURE if this fails - */ - - if(0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - - /* This needs to be done before using GetVersionEx */ - pVersionInfo->dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - - /* If GetVersionEx fails, then the test fails */ - if(GetVersionEx(pVersionInfo) == 0) - { - Fail("ERROR: The GetVersionEx function returned 0, which indicates " - "failure."); - } - - /* These values are fixed, ensure they're set properly */ - if(pVersionInfo->dwMajorVersion != 5) - { - Fail("ERROR: The fixed value of dwMajorVersion shoud be 5, " - "but is really %d.",pVersionInfo->dwMajorVersion); - } - - /* The minor version values for Win2k and XP are different - for Win2k minor version equals 0 and for XP minor version - equals 1. Both values are excepted here. */ - if((pVersionInfo->dwMinorVersion != 0) && - (pVersionInfo->dwMinorVersion != 1)) - { - Fail("ERROR: The fixed value of dwMinorVersion shoud be 0 or 1, " - "but is really %d.",pVersionInfo->dwMinorVersion); - } - if(pVersionInfo->dwBuildNumber_PAL_Undefined < 0) - { - Fail("ERROR: The value of dwBuildNumber shoud be at least 0, but " - "is really %d.",pVersionInfo->dwBuildNumber_PAL_Undefined); - } - -#if !WIN32 - /* Under BSD, the PlatformID should be UNIX and the Service Pack - version should be set to "". - */ - - if(pVersionInfo->dwPlatformId != VER_PLATFORM_UNIX || - pVersionInfo->szCSDVersion_PAL_Undefined[0] != 0) - { - Fail("ERROR: The dwPlatformId should be %d but is really %d. And the " - "szCSDVerion should be NULL.", - VER_PLATFORM_UNIX,pVersionInfo->dwPlatformId); - } -#endif - - - PAL_Terminate(); - return PASS; -} - - - diff --git a/src/pal/tests/palsuite/miscellaneous/GetVersionExW/test1/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/GetVersionExW/test1/CMakeLists.txt deleted file mode 100644 index 4ef820c479..0000000000 --- a/src/pal/tests/palsuite/miscellaneous/GetVersionExW/test1/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test.cpp -) - -add_executable(paltest_getversionexw_test1 - ${SOURCES} -) - -add_dependencies(paltest_getversionexw_test1 coreclrpal) - -target_link_libraries(paltest_getversionexw_test1 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/pal/tests/palsuite/miscellaneous/GetVersionExW/test1/test.cpp b/src/pal/tests/palsuite/miscellaneous/GetVersionExW/test1/test.cpp deleted file mode 100644 index 69aae54bcf..0000000000 --- a/src/pal/tests/palsuite/miscellaneous/GetVersionExW/test1/test.cpp +++ /dev/null @@ -1,88 +0,0 @@ -// 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 GetVersionExW() function -** -** -**=========================================================*/ - -#define UNICODE - -#include <palsuite.h> - -int __cdecl main(int argc, char *argv[]) -{ - - OSVERSIONINFO TheVersionInfo; - OSVERSIONINFO* pVersionInfo = &TheVersionInfo; - - /* - * Initialize the PAL and return FAILURE if this fails - */ - - if(0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - /* This needs to be done before using GetVersionEx */ - pVersionInfo->dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - - /* If GetVersionEx fails, then the test fails */ - if(GetVersionEx(pVersionInfo) == 0) - { - Fail("ERROR: The GetVersionEx function returned 0, which indicates " - "failure."); - } - - /* These values are fixed, ensure they're set properly */ - if(pVersionInfo->dwMajorVersion != 5) - { - Fail("ERROR: The fixed value of dwMajorVersion shoud be 5, but is " - " really %d.",pVersionInfo->dwMajorVersion); - } - - /* The minor version values for Win2k and XP are different - for Win2k minor version equals 0 and for XP minor version - equals 1. Both values are excepted here. */ - if((pVersionInfo->dwMinorVersion != 0) && - (pVersionInfo->dwMinorVersion != 1)) - { - Fail("ERROR: The fixed value of dwMinorVersion shoud be 0 or 1, " - "but is really %d.",pVersionInfo->dwMinorVersion); - } - - if(pVersionInfo->dwBuildNumber_PAL_Undefined < 0) - { - Fail("ERROR: The value of dwBuildNumber shoud be at least 0, but is " - "really %d.",pVersionInfo->dwBuildNumber_PAL_Undefined); - } - -#if !WIN32 - - - /* Under BSD, the PlatformID should be UNIX and the Service Pack - version should be set to "". - */ - - if(pVersionInfo->dwPlatformId != VER_PLATFORM_UNIX || - pVersionInfo->szCSDVersion_PAL_Undefined[0] != 0) - { - Fail("ERROR: The dwPlatformId should be %d but is really %d. And the " - "szCSDVerion should be NULL.",VER_PLATFORM_UNIX, - pVersionInfo->dwPlatformId); - } -#endif - - - PAL_Terminate(); - return PASS; -} - - - diff --git a/src/pal/tests/palsuite/miscellaneous/GetVersionExW/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/GlobalMemoryStatusEx/CMakeLists.txt index f6aa0cb2d9..f6aa0cb2d9 100644 --- a/src/pal/tests/palsuite/miscellaneous/GetVersionExW/CMakeLists.txt +++ b/src/pal/tests/palsuite/miscellaneous/GlobalMemoryStatusEx/CMakeLists.txt diff --git a/src/pal/tests/palsuite/miscellaneous/GlobalMemoryStatusEx/test1/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/GlobalMemoryStatusEx/test1/CMakeLists.txt new file mode 100644 index 0000000000..6e74f22baa --- /dev/null +++ b/src/pal/tests/palsuite/miscellaneous/GlobalMemoryStatusEx/test1/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test.cpp +) + +add_executable(paltest_globalmemorystatusex_test1 + ${SOURCES} +) + +add_dependencies(paltest_globalmemorystatusex_test1 coreclrpal) + +target_link_libraries(paltest_globalmemorystatusex_test1 + ${COMMON_TEST_LIBRARIES} +) diff --git a/src/pal/tests/palsuite/miscellaneous/GlobalMemoryStatusEx/test1/test.cpp b/src/pal/tests/palsuite/miscellaneous/GlobalMemoryStatusEx/test1/test.cpp new file mode 100644 index 0000000000..460edade61 --- /dev/null +++ b/src/pal/tests/palsuite/miscellaneous/GlobalMemoryStatusEx/test1/test.cpp @@ -0,0 +1,55 @@ +// 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 GlobalMemoryStatusEx() function +** +** +**=========================================================*/ + +#include <palsuite.h> + +int __cdecl main(int argc, char *argv[]) { + + MEMORYSTATUSEX memoryStatus; + + /* + * Initialize the PAL and return FAILURE if this fails + */ + + if(0 != (PAL_Initialize(argc, argv))) + { + return FAIL; + } + + if (!GlobalMemoryStatusEx(&memoryStatus)) + { + Fail("ERROR: GlobalMemoryStatusEx failed."); + } + + printf("GlobalMemoryStatusEx:\n"); + printf(" ullTotalPhys: %llu\n", memoryStatus.ullTotalPhys); + printf(" ullAvailPhys: %llu\n", memoryStatus.ullAvailPhys); + printf(" ullTotalVirtual: %llu\n", memoryStatus.ullTotalVirtual); + printf(" ullAvailVirtual: %llu\n", memoryStatus.ullAvailVirtual); + printf(" ullTotalPageFile: %llu\n", memoryStatus.ullTotalPageFile); + printf(" ullAvailPageFile: %llu\n", memoryStatus.ullAvailPageFile); + printf(" ullAvailExtendedVirtual: %llu\n", memoryStatus.ullAvailExtendedVirtual); + printf(" dwMemoryLoad: %u\n", memoryStatus.dwMemoryLoad); + + if (memoryStatus.ullTotalPhys == 0 || + memoryStatus.ullAvailPhys == 0 || + memoryStatus.ullTotalVirtual == 0 || + memoryStatus.ullAvailVirtual == 0 + ) + { + Fail("ERROR: GlobalMemoryStatusEx succeeded, but returned zero physical of virtual memory sizes."); + } + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/miscellaneous/GetVersionExA/test1/testinfo.dat b/src/pal/tests/palsuite/miscellaneous/GlobalMemoryStatusEx/test1/testinfo.dat index 1e9c570c60..7ae3b5142a 100644 --- a/src/pal/tests/palsuite/miscellaneous/GetVersionExA/test1/testinfo.dat +++ b/src/pal/tests/palsuite/miscellaneous/GlobalMemoryStatusEx/test1/testinfo.dat @@ -4,13 +4,11 @@ Version = 1.0 Section = Miscellaneous -Function = GetVersionExA -Name = Positive Test for GetVersionExA +Function = GlobalMemoryStatusEx +Name = Positive Test for GlobalMemoryStatusEx TYPE = DEFAULT EXE1 = test Description -= Test that all the values in the OSVERSION structure are set properly -= for the current environment. - - += Ensures that invocation of GlobalMemoryStatusEx succeeds and += that it returns nonzero virtual and physical memory sizes diff --git a/src/pal/tests/palsuite/pal_specific/pal_entrypoint/test1/palstartup.h b/src/pal/tests/palsuite/pal_specific/pal_entrypoint/test1/palstartup.h index 862870be99..1947b59b77 100644 --- a/src/pal/tests/palsuite/pal_specific/pal_entrypoint/test1/palstartup.h +++ b/src/pal/tests/palsuite/pal_specific/pal_entrypoint/test1/palstartup.h @@ -27,6 +27,11 @@ static DWORD PALAPI run_main(struct _mainargs *args) return (DWORD) PAL_startup_main(args->argc, args->argv); } +static void terminate(void) +{ + PAL_Terminate(); +} + int __cdecl main(int argc, char **argv) { struct _mainargs mainargs; @@ -34,9 +39,7 @@ int __cdecl main(int argc, char **argv) { return FAIL;; } - // PAL_Terminate is a stdcall function, but it takes no parameters - // so the difference doesn't matter. - atexit((void (__cdecl *)(void)) PAL_Terminate); + atexit(terminate); mainargs.argc = argc; mainargs.argv = argv; diff --git a/src/pal/tests/palsuite/paltestlist.txt b/src/pal/tests/palsuite/paltestlist.txt index 600c2a533b..f0dfe3f9ea 100644 --- a/src/pal/tests/palsuite/paltestlist.txt +++ b/src/pal/tests/palsuite/paltestlist.txt @@ -668,6 +668,7 @@ miscellaneous/GetEnvironmentVariableW/test5/paltest_getenvironmentvariablew_test miscellaneous/GetEnvironmentVariableW/test6/paltest_getenvironmentvariablew_test6 miscellaneous/GetLastError/test1/paltest_getlasterror_test1 miscellaneous/GetSystemInfo/test1/paltest_getsysteminfo_test1 +miscellaneous/GlobalMemoryStatusEx/test1/paltest_globalmemorystatusex_test1 miscellaneous/GetTickCount/test1/paltest_gettickcount_test1 miscellaneous/InterlockedCompareExchange/test1/paltest_interlockedcompareexchange_test1 miscellaneous/InterlockedCompareExchange/test2/paltest_interlockedcompareexchange_test2 @@ -687,7 +688,6 @@ miscellaneous/InterlockedIncrement64/test1/paltest_interlockedincrement64_test1 miscellaneous/InterlockedIncrement64/test2/paltest_interlockedincrement64_test2 miscellaneous/lstrlenA/test1/paltest_lstrlena_test1 miscellaneous/lstrlenW/test1/paltest_lstrlenw_test1 -miscellaneous/queryperformancecounter/test1/paltest_queryperformancecounter_test1 miscellaneous/queryperformancefrequency/test1/paltest_queryperformancefrequency_test1 miscellaneous/SetEnvironmentVariableA/test1/paltest_setenvironmentvariablea_test1 miscellaneous/SetEnvironmentVariableA/test2/paltest_setenvironmentvariablea_test2 @@ -763,9 +763,6 @@ threading/SetEvent/test1/paltest_setevent_test1 threading/SetEvent/test2/paltest_setevent_test2 threading/SetEvent/test3/paltest_setevent_test3 threading/SetEvent/test4/paltest_setevent_test4 -threading/Sleep/test1/paltest_sleep_test1 -threading/SleepEx/test1/paltest_sleepex_test1 -threading/SleepEx/test2/paltest_sleepex_test2 threading/SwitchToThread/test1/paltest_switchtothread_test1 threading/ThreadPriority/test1/paltest_threadpriority_test1 threading/TLS/test1/paltest_tls_test1 diff --git a/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt b/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt index 0e12ccbf55..3f9469d254 100644 --- a/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt +++ b/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt @@ -144,8 +144,6 @@ miscellaneous/GetDateFormatW/GetDateFormatW_neg1/paltest_getdateformatw_getdatef miscellaneous/GetDateFormatW/GetDateFormatW_neg2/paltest_getdateformatw_getdateformatw_neg2 miscellaneous/GetDateFormatW/test1/paltest_getdateformatw_test1 miscellaneous/GetUserNameW/test1/paltest_getusernamew_test1 -miscellaneous/GetVersionExA/test1/paltest_getversionexa_test1 -miscellaneous/GetVersionExW/test1/paltest_getversionexw_test1 miscellaneous/InterLockedExchangeAdd/test1/paltest_interlockedexchangeadd_test1 miscellaneous/IsBadCodePtr/test1/paltest_isbadcodeptr_test1 miscellaneous/IsBadReadPtr/test1/paltest_isbadreadptr_test1 @@ -154,6 +152,7 @@ miscellaneous/IsBadWritePtr/test2/paltest_isbadwriteptr_test2 miscellaneous/IsBadWritePtr/test3/paltest_isbadwriteptr_test3 miscellaneous/MessageBoxW/test1/paltest_messageboxw_test1 miscellaneous/MessageBoxW/test2/paltest_messageboxw_test2 +miscellaneous/queryperformancecounter/test1/paltest_queryperformancecounter_test1 miscellaneous/wsprintfW/test2/paltest_wsprintfw_test2 miscellaneous/wsprintfW/test7/paltest_wsprintfw_test7 pal_specific/PAL_GetMachineConfigurationDirectoryW/test1/paltest_pal_getmachineconfigurationdirectoryw_test1 @@ -191,6 +190,9 @@ threading/OpenEventW/test5/paltest_openeventw_test5 threading/OpenProcess/test1/paltest_openprocess_test1 threading/QueueUserAPC/test1/paltest_queueuserapc_test1 threading/setthreadcontext/test1/paltest_setthreadcontext_test1 +threading/Sleep/test1/paltest_sleep_test1 +threading/SleepEx/test1/paltest_sleepex_test1 +threading/SleepEx/test2/paltest_sleepex_test2 threading/SuspendThread/test2/paltest_suspendthread_test2 threading/SuspendThread/test3/paltest_suspendthread_test3 threading/TerminateProcess/test1/paltest_terminateprocess_test1 diff --git a/src/pal/tests/palsuite/palverify.dat b/src/pal/tests/palsuite/palverify.dat index 1872313a94..d4cb311010 100644 --- a/src/pal/tests/palsuite/palverify.dat +++ b/src/pal/tests/palsuite/palverify.dat @@ -753,6 +753,7 @@ miscellaneous/getenvironmentvariablew/test3,1 miscellaneous/getenvironmentvariablew/test4,1 miscellaneous/getlasterror/test1,1 miscellaneous/getsysteminfo/test1,1 +miscellaneous/getglobalmemorystatusex/test1,1 miscellaneous/gettickcount/test1,1 miscellaneous/getversionexa/test1,1 miscellaneous/getversionexw/test1,1 diff --git a/src/pal/tests/palsuite/threading/CreateMutexA_ReleaseMutex/test1/CreateMutexA.cpp b/src/pal/tests/palsuite/threading/CreateMutexA_ReleaseMutex/test1/CreateMutexA.cpp index 52bab351fb..3074fa03fc 100644 --- a/src/pal/tests/palsuite/threading/CreateMutexA_ReleaseMutex/test1/CreateMutexA.cpp +++ b/src/pal/tests/palsuite/threading/CreateMutexA_ReleaseMutex/test1/CreateMutexA.cpp @@ -169,8 +169,7 @@ FillBuffer() /* * Producer thread function. */ -DWORD -Producer(LPVOID lpParam) +DWORD PALAPI Producer(LPVOID lpParam) { int n = 0; int ret; @@ -202,7 +201,7 @@ Producer(LPVOID lpParam) /* * Consumer thread function. */ -DWORD Consumer( LPVOID lpParam ) +DWORD PALAPI Consumer( LPVOID lpParam ) { int n = 0; int ret; diff --git a/src/pal/tests/palsuite/threading/CreateMutexW_ReleaseMutex/test1/CreateMutexW.cpp b/src/pal/tests/palsuite/threading/CreateMutexW_ReleaseMutex/test1/CreateMutexW.cpp index c21bfb6a50..ec8e0c66b7 100644 --- a/src/pal/tests/palsuite/threading/CreateMutexW_ReleaseMutex/test1/CreateMutexW.cpp +++ b/src/pal/tests/palsuite/threading/CreateMutexW_ReleaseMutex/test1/CreateMutexW.cpp @@ -169,8 +169,7 @@ FillBuffer() /* * Producer thread function. */ -DWORD -Producer(LPVOID lpParam) +DWORD PALAPI Producer(LPVOID lpParam) { int n = 0; int ret; @@ -202,7 +201,7 @@ Producer(LPVOID lpParam) /* * Consumer thread function. */ -DWORD Consumer( LPVOID lpParam ) +DWORD PALAPI Consumer( LPVOID lpParam ) { int n = 0; int ret; diff --git a/src/pal/tests/palsuite/threading/DisableThreadLibraryCalls/test1/test1.cpp b/src/pal/tests/palsuite/threading/DisableThreadLibraryCalls/test1/test1.cpp index b64fd0c7d2..55251d46bf 100644 --- a/src/pal/tests/palsuite/threading/DisableThreadLibraryCalls/test1/test1.cpp +++ b/src/pal/tests/palsuite/threading/DisableThreadLibraryCalls/test1/test1.cpp @@ -26,7 +26,7 @@ #define GETCALLCOUNT "_GetCallCount@0" #endif -DWORD __stdcall ThreadFunc(LPVOID lpParam); +DWORD PALAPI ThreadFunc(LPVOID lpParam); int RunTest(int DisableThreadCalls); int __cdecl main(int argc, char **argv) @@ -78,7 +78,7 @@ int __cdecl main(int argc, char **argv) /* * Thread entry point. Doesn't do anything. */ -DWORD __stdcall ThreadFunc(LPVOID lpParam) +DWORD PALAPI ThreadFunc(LPVOID lpParam) { return 0; } diff --git a/src/pal/tests/palsuite/threading/DisableThreadLibraryCalls/test1/testlib.cpp b/src/pal/tests/palsuite/threading/DisableThreadLibraryCalls/test1/testlib.cpp index 53b66d1357..057dfde66d 100644 --- a/src/pal/tests/palsuite/threading/DisableThreadLibraryCalls/test1/testlib.cpp +++ b/src/pal/tests/palsuite/threading/DisableThreadLibraryCalls/test1/testlib.cpp @@ -15,7 +15,7 @@ static int Count; -BOOL __stdcall DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +BOOL PALAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { if (fdwReason == DLL_PROCESS_ATTACH) @@ -32,7 +32,7 @@ BOOL __stdcall DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) } #ifdef WIN32 -BOOL __stdcall _DllMainCRTStartup(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +BOOL PALAPI _DllMainCRTStartup(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { return DllMain(hinstDLL, fdwReason, lpvReserved); } @@ -41,7 +41,7 @@ BOOL __stdcall _DllMainCRTStartup(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lp #ifdef WIN32 __declspec(dllexport) #endif -int __stdcall GetCallCount() +int PALAPI GetCallCount() { return Count; } diff --git a/src/pal/tests/palsuite/threading/DisableThreadLibraryCalls/test2/dllmain1.cpp b/src/pal/tests/palsuite/threading/DisableThreadLibraryCalls/test2/dllmain1.cpp index 5010a27665..b65bb66a56 100644 --- a/src/pal/tests/palsuite/threading/DisableThreadLibraryCalls/test2/dllmain1.cpp +++ b/src/pal/tests/palsuite/threading/DisableThreadLibraryCalls/test2/dllmain1.cpp @@ -50,7 +50,7 @@ BOOL PALAPI DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID lpvReserved) #ifdef WIN32 -BOOL __stdcall _DllMainCRTStartup(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +BOOL PALAPI _DllMainCRTStartup(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { return DllMain(hinstDLL, fdwReason, lpvReserved); } diff --git a/src/pal/tests/palsuite/threading/DisableThreadLibraryCalls/test2/dllmain2.cpp b/src/pal/tests/palsuite/threading/DisableThreadLibraryCalls/test2/dllmain2.cpp index 4e3f8862a4..519083bbaf 100644 --- a/src/pal/tests/palsuite/threading/DisableThreadLibraryCalls/test2/dllmain2.cpp +++ b/src/pal/tests/palsuite/threading/DisableThreadLibraryCalls/test2/dllmain2.cpp @@ -50,7 +50,7 @@ BOOL PALAPI DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID lpvReserved) #ifdef WIN32 -BOOL __stdcall _DllMainCRTStartup(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +BOOL PALAPI _DllMainCRTStartup(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { return DllMain(hinstDLL, fdwReason, lpvReserved); } diff --git a/src/pal/tests/palsuite/threading/ExitThread/test3/dllmain.cpp b/src/pal/tests/palsuite/threading/ExitThread/test3/dllmain.cpp index 923650d1d3..862aff5f00 100644 --- a/src/pal/tests/palsuite/threading/ExitThread/test3/dllmain.cpp +++ b/src/pal/tests/palsuite/threading/ExitThread/test3/dllmain.cpp @@ -48,7 +48,7 @@ BOOL PALAPI DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID lpvReserved) } #ifdef WIN32 -BOOL __stdcall _DllMainCRTStartup(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +BOOL PALAPI _DllMainCRTStartup(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { return DllMain(hinstDLL, fdwReason, lpvReserved); } |