diff options
Diffstat (limited to 'src/pal/tests/palsuite/pal_specific')
48 files changed, 1141 insertions, 0 deletions
diff --git a/src/pal/tests/palsuite/pal_specific/CMakeLists.txt b/src/pal/tests/palsuite/pal_specific/CMakeLists.txt new file mode 100644 index 0000000000..aaf1f27182 --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +# TODO: make these tests compile +# add_subdirectory(PAL_get_stderr) +# add_subdirectory(PAL_get_stdin) +# add_subdirectory(PAL_get_stdout) + +add_subdirectory(pal_entrypoint) +add_subdirectory(PAL_errno) +add_subdirectory(PAL_GetPALDirectoryW) +add_subdirectory(pal_initializedebug) +add_subdirectory(PAL_Initialize_Terminate) + diff --git a/src/pal/tests/palsuite/pal_specific/PAL_GetPALDirectoryW/CMakeLists.txt b/src/pal/tests/palsuite/pal_specific/PAL_GetPALDirectoryW/CMakeLists.txt new file mode 100644 index 0000000000..f6aa0cb2d9 --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_GetPALDirectoryW/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +add_subdirectory(test1) + diff --git a/src/pal/tests/palsuite/pal_specific/PAL_GetPALDirectoryW/test1/CMakeLists.txt b/src/pal/tests/palsuite/pal_specific/PAL_GetPALDirectoryW/test1/CMakeLists.txt new file mode 100644 index 0000000000..bf1d3a91e7 --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_GetPALDirectoryW/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + PAL_GetPALDirectoryW.c +) + +add_executable(paltest_pal_getpaldirectoryw_test1 + ${SOURCES} +) + +add_dependencies(paltest_pal_getpaldirectoryw_test1 coreclrpal) + +target_link_libraries(paltest_pal_getpaldirectoryw_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/pal_specific/PAL_GetPALDirectoryW/test1/PAL_GetPALDirectoryW.c b/src/pal/tests/palsuite/pal_specific/PAL_GetPALDirectoryW/test1/PAL_GetPALDirectoryW.c new file mode 100644 index 0000000000..2c67aa4954 --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_GetPALDirectoryW/test1/PAL_GetPALDirectoryW.c @@ -0,0 +1,78 @@ +// 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: pal_getpaldirectoryw.c +** +** Purpose: Positive test the PAL_GetPALDirectoryW API. +** Call this API to retrieve a fully-qualified +** directory name where the PAL DLL is loaded from. +** +** +**============================================================*/ +#define UNICODE +#include <palsuite.h> + +int __cdecl main(int argc, char *argv[]) +{ + int err; + BOOL bValue; + DWORD dwFileAttribute; + WCHAR *wpDirectoryName = NULL; + char *pDirectoryName = NULL; + + /*Initialize the PAL environment*/ + err = PAL_Initialize(argc, argv); + if(0 != err) + { + return FAIL; + } + + /*allocate momory to store the directory name*/ + wpDirectoryName = malloc(MAX_PATH*sizeof(WCHAR)); + if(NULL == wpDirectoryName) + { + Fail("\nFailed to allocate memory for storing directory name!\n"); + } + + UINT size = MAX_PATH; + /*retrieve the machine configuration directory*/ + bValue = PAL_GetPALDirectoryW(wpDirectoryName, &size); + if(FALSE == bValue) + { + free(wpDirectoryName); + Fail("Failed to call PAL_GetPALDirectoryW API, " + "error code =%u\n", GetLastError()); + } + + + /*convert wide char string to a standard one*/ + pDirectoryName = convertC(wpDirectoryName); + if(0 == strlen(pDirectoryName)) + { + free(wpDirectoryName); + free(pDirectoryName); + Fail("The retrieved directory name string is empty!\n"); + } + + /*free the memory*/ + free(pDirectoryName); + + /*retrieve the attribute of a file or directory*/ + dwFileAttribute = GetFileAttributesW(wpDirectoryName); + + /*free the memory*/ + free(wpDirectoryName); + + /*check if the attribute indicates a directory*/ + if(FILE_ATTRIBUTE_DIRECTORY != + (dwFileAttribute & FILE_ATTRIBUTE_DIRECTORY)) + { + Fail("The retrieved directory name is not a valid directory!\n"); + } + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/pal_specific/PAL_GetPALDirectoryW/test1/testinfo.dat b/src/pal/tests/palsuite/pal_specific/PAL_GetPALDirectoryW/test1/testinfo.dat new file mode 100644 index 0000000000..dca92b0462 --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_GetPALDirectoryW/test1/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = PAL_Specific +Function = PAL_GetPALDirectoryW +Name = Positive test for PAL_GetPALDirectoryW to retrieve fully-qualified directory name. +TYPE = DEFAULT +EXE1 = pal_getpaldirectoryw +Description +=Retrieve the fully-qualified directory name where the PAL DLL is loaded from diff --git a/src/pal/tests/palsuite/pal_specific/PAL_GetUserTempDirectoryW/CMakeLists.txt b/src/pal/tests/palsuite/pal_specific/PAL_GetUserTempDirectoryW/CMakeLists.txt new file mode 100644 index 0000000000..f6aa0cb2d9 --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_GetUserTempDirectoryW/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +add_subdirectory(test1) + diff --git a/src/pal/tests/palsuite/pal_specific/PAL_GetUserTempDirectoryW/test1/CMakeLists.txt b/src/pal/tests/palsuite/pal_specific/PAL_GetUserTempDirectoryW/test1/CMakeLists.txt new file mode 100644 index 0000000000..e8d3c40565 --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_GetUserTempDirectoryW/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + PAL_GetUserTempDirectoryW.c +) + +add_executable(paltest_pal_getusertempdirectoryw_test1 + ${SOURCES} +) + +add_dependencies(paltest_pal_getusertempdirectoryw_test1 coreclrpal) + +target_link_libraries(paltest_pal_getusertempdirectoryw_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/pal_specific/PAL_GetUserTempDirectoryW/test1/PAL_GetUserTempDirectoryW.c b/src/pal/tests/palsuite/pal_specific/PAL_GetUserTempDirectoryW/test1/PAL_GetUserTempDirectoryW.c new file mode 100644 index 0000000000..65cc426c74 --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_GetUserTempDirectoryW/test1/PAL_GetUserTempDirectoryW.c @@ -0,0 +1,58 @@ +// 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: pal_getusertempdirectoryw.c +** +** Purpose: Positive test the PAL_GetUserTempDirectoryW API. +** Call PAL_GetUserTempDirectoryW to retrieve the user +** temp directory. +** +** +**============================================================*/ +#define UNICODE +#include <palsuite.h> + +#define DIRECTORYLENGTH 1024 + +int __cdecl main(int argc, char *argv[]) +{ + int err; + DWORD dwFileAttribute; + DWORD cch = DIRECTORYLENGTH; + WCHAR wDirectoryName[DIRECTORYLENGTH]; + + //Initialize the PAL environment + err = PAL_Initialize(argc, argv); + if(0 != err) + { + ExitProcess(FAIL); + } + + //retrieve the user temp directory + err = PAL_GetUserTempDirectory(ddtInstallationDependentDirectory, wDirectoryName, &cch); + + if(0 == err || 0 == strlen(convertC(wDirectoryName))) + { + Fail("Failed to call PAL_GetUserTempDirectoryW API!\n"); + } + + + //retrieve the attributes of a file or directory + dwFileAttribute = GetFileAttributesW(wDirectoryName); + + + //check if the retrieved attribute indicates a directory + if( FILE_ATTRIBUTE_DIRECTORY != (FILE_ATTRIBUTE_DIRECTORY & dwFileAttribute)) + { + Fail("PAL_GetUserTempDirectoryW API returned a non-directory name!\n"); + } + + printf ("PAL_GetUserTempDirectoryW returns %S\n", wDirectoryName); + + PAL_Terminate(); + return PASS; + +} diff --git a/src/pal/tests/palsuite/pal_specific/PAL_GetUserTempDirectoryW/test1/testinfo.dat b/src/pal/tests/palsuite/pal_specific/PAL_GetUserTempDirectoryW/test1/testinfo.dat new file mode 100644 index 0000000000..d530ca5fc7 --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_GetUserTempDirectoryW/test1/testinfo.dat @@ -0,0 +1,13 @@ +# 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 = pal_specific +Function = PAL_GetUserTempDirectoryW +Name = Positive test for PAL_GetUserTempDirectoryW API +TYPE = DEFAULT +EXE1 = pal_getusertempdirectoryw +Description +=Test the PAL_GetUserTempDirectoryW to retrieve the user temp +=directory name diff --git a/src/pal/tests/palsuite/pal_specific/PAL_Initialize_Terminate/CMakeLists.txt b/src/pal/tests/palsuite/pal_specific/PAL_Initialize_Terminate/CMakeLists.txt new file mode 100644 index 0000000000..ef14ea5352 --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_Initialize_Terminate/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +add_subdirectory(test1) +add_subdirectory(test2) + diff --git a/src/pal/tests/palsuite/pal_specific/PAL_Initialize_Terminate/test1/CMakeLists.txt b/src/pal/tests/palsuite/pal_specific/PAL_Initialize_Terminate/test1/CMakeLists.txt new file mode 100644 index 0000000000..416439d650 --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_Initialize_Terminate/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + PAL_Initialize_Terminate.c +) + +add_executable(paltest_pal_initialize_terminate_test1 + ${SOURCES} +) + +add_dependencies(paltest_pal_initialize_terminate_test1 coreclrpal) + +target_link_libraries(paltest_pal_initialize_terminate_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/pal_specific/PAL_Initialize_Terminate/test1/PAL_Initialize_Terminate.c b/src/pal/tests/palsuite/pal_specific/PAL_Initialize_Terminate/test1/PAL_Initialize_Terminate.c new file mode 100644 index 0000000000..29bb2c3b4f --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_Initialize_Terminate/test1/PAL_Initialize_Terminate.c @@ -0,0 +1,33 @@ +// 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: pal_initialize_terminate.c +** +** Purpose: Positive test the PAL_Initialize and PAL_Terminate API. +** Call PAL_Initialize to initialize the PAL +** environment and call PAL_Terminate to clean up the PAL +** environment. +** + +** +**============================================================*/ +#include <palsuite.h> + +int __cdecl main(int argc, char *argv[]) +{ + int err; + + /* Initialize the PAL environment */ + err = PAL_Initialize(argc, argv); + + if(0 != err) + { + ExitProcess(1); + } + + PAL_Terminate(); + return 0; +} diff --git a/src/pal/tests/palsuite/pal_specific/PAL_Initialize_Terminate/test1/testinfo.dat b/src/pal/tests/palsuite/pal_specific/PAL_Initialize_Terminate/test1/testinfo.dat new file mode 100644 index 0000000000..8ffe3bb7c7 --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_Initialize_Terminate/test1/testinfo.dat @@ -0,0 +1,13 @@ +# 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 = PAL_Specific +Function = PAL_Initialize and PAL_Terminate +Name = Positive test for PAL_Initialize and PAL_Terminate +TYPE = DEFAULT +EXE1 = pal_initialize_terminate +Description +=Test the PAL_Initialize to initialize the PAL environment +=Test the PAL_Terminate to clean up the PAL environment diff --git a/src/pal/tests/palsuite/pal_specific/PAL_Initialize_Terminate/test2/CMakeLists.txt b/src/pal/tests/palsuite/pal_specific/PAL_Initialize_Terminate/test2/CMakeLists.txt new file mode 100644 index 0000000000..b7661fd240 --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_Initialize_Terminate/test2/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + pal_initialize_twice.c +) + +add_executable(paltest_pal_initialize_terminate_test2 + ${SOURCES} +) + +add_dependencies(paltest_pal_initialize_terminate_test2 coreclrpal) + +target_link_libraries(paltest_pal_initialize_terminate_test2 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/pal_specific/PAL_Initialize_Terminate/test2/pal_initialize_twice.c b/src/pal/tests/palsuite/pal_specific/PAL_Initialize_Terminate/test2/pal_initialize_twice.c new file mode 100644 index 0000000000..fc460bc1ad --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_Initialize_Terminate/test2/pal_initialize_twice.c @@ -0,0 +1,41 @@ +// 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: pal_initialize_twice.c +** +** Purpose: Positive test of PAL_Initialize and PAL_Terminate APIs. +** Calls PAL_Initialize twice to ensure that doing so +** will not cause unexpected failures in the PAL. +** Calls PAL_Terminate twice to clean up the PAL. +** + +** +**============================================================*/ +#include <palsuite.h> + +int __cdecl main(int argc, char *argv[]) +{ + /* Initialize the PAL environment */ + if (0 != (PAL_Initialize(argc, argv))) + { + return FAIL; + } + + /* Try calling PAL_Initialize again - should just increment the init_count. */ + if (0 != (PAL_Initialize(argc, argv))) + { + // Call terminate due to the first PAL initialization. + PAL_TerminateEx(FAIL); + return FAIL; + } + + /* If both calls to PAL_Initialize succeed, then PAL_Terminate must be + called twice. The first call just decrements the init_count to 1. */ + + PAL_Terminate(); + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/pal_specific/PAL_Initialize_Terminate/test2/testinfo.dat b/src/pal/tests/palsuite/pal_specific/PAL_Initialize_Terminate/test2/testinfo.dat new file mode 100644 index 0000000000..31ceaf054d --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_Initialize_Terminate/test2/testinfo.dat @@ -0,0 +1,15 @@ +# 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 = PAL_Specific +Function = PAL_Initialize and PAL_Terminate +Name = Positive test for calling PAL_Initialize twice +TYPE = DEFAULT +EXE1 = pal_initialize_twice +Description +=Test calling PAL_Initialize twice to initialize the PAL environment +=and increment the init_count. +=Test calling PAL_Terminate twice to decrement the init_count +=and then clean up the PAL environment. diff --git a/src/pal/tests/palsuite/pal_specific/PAL_RegisterLibraryW_UnregisterLibraryW/CMakeLists.txt b/src/pal/tests/palsuite/pal_specific/PAL_RegisterLibraryW_UnregisterLibraryW/CMakeLists.txt new file mode 100644 index 0000000000..37b29c0d6d --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_RegisterLibraryW_UnregisterLibraryW/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +add_subdirectory(test1) +add_subdirectory(test2_neg) + diff --git a/src/pal/tests/palsuite/pal_specific/PAL_RegisterLibraryW_UnregisterLibraryW/test1/CMakeLists.txt b/src/pal/tests/palsuite/pal_specific/PAL_RegisterLibraryW_UnregisterLibraryW/test1/CMakeLists.txt new file mode 100644 index 0000000000..2379694b24 --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_RegisterLibraryW_UnregisterLibraryW/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + PAL_RegisterLibraryW_UnregisterLibraryW.c +) + +add_executable(paltest_pal_registerlibraryw_unregisterlibraryw_test1 + ${SOURCES} +) + +add_dependencies(paltest_pal_registerlibraryw_unregisterlibraryw_test1 coreclrpal) + +target_link_libraries(paltest_pal_registerlibraryw_unregisterlibraryw_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/pal_specific/PAL_RegisterLibraryW_UnregisterLibraryW/test1/PAL_RegisterLibraryW_UnregisterLibraryW.c b/src/pal/tests/palsuite/pal_specific/PAL_RegisterLibraryW_UnregisterLibraryW/test1/PAL_RegisterLibraryW_UnregisterLibraryW.c new file mode 100644 index 0000000000..ff0d33879c --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_RegisterLibraryW_UnregisterLibraryW/test1/PAL_RegisterLibraryW_UnregisterLibraryW.c @@ -0,0 +1,64 @@ +// 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: pal_registerlibrary_unregisterlibrary +** +** Purpose: Positive test the PAL_RegisterLibrary API and +** PAL_UnRegisterLibrary. +** Call PAL_RegisterLibrary to map a module into the calling +** process address space and call PAL_UnRegisterLibrary +** to unmap this module. +** +** +**============================================================*/ +#define UNICODE +#include <palsuite.h> + +int __cdecl main(int argc, char *argv[]) +{ + HMODULE ModuleHandle; + char ModuleName[64]; + WCHAR *wpModuleName = NULL; + int err; + + /*Initialize the PAL environment*/ + err = PAL_Initialize(argc, argv); + if(0 != err) + { + return FAIL; + } + + /*zero the buffer*/ + memset(ModuleName,0,64); + sprintf(ModuleName, "%s", "rotor_pal"); + + /*convert a normal string to a wide one*/ + wpModuleName = convert(ModuleName); + + /*load a module*/ + ModuleHandle = PAL_RegisterLibrary(wpModuleName); + + /*free the memory*/ + free(wpModuleName); + + if(!ModuleHandle) + { + Fail("Failed to call PAL_RegisterLibrary API to map a module " + "into calling process, error code=%u!\n", GetLastError()); + } + + /*decrement the reference count of the loaded DLL*/ + err = PAL_UnregisterLibrary(ModuleHandle); + if(0 == err) + { + Fail("\nFailed to call PAL_UnregisterLibrary API to " + "decrement the count of the loaded DLL module, " + "error code=%u!\n", GetLastError()); + } + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/pal_specific/PAL_RegisterLibraryW_UnregisterLibraryW/test1/testinfo.dat b/src/pal/tests/palsuite/pal_specific/PAL_RegisterLibraryW_UnregisterLibraryW/test1/testinfo.dat new file mode 100644 index 0000000000..abbd28c238 --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_RegisterLibraryW_UnregisterLibraryW/test1/testinfo.dat @@ -0,0 +1,13 @@ +# 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 = pal_specific +Function = PAL_RegisterLibraryW and PAL_UnregisterLibraryW API +Name = Positive test PAL_RegisterLibraryW and PAL_UnregisterLibaryW API +TYPE = DEFAULT +EXE1 = pal_registerlibraryw_unregisterlibraryw +Description +=Test the PAL_RegisterLibraryW and PAL_UnregisterLibraryW to map an executable +=module into calling process address space and unmap this module diff --git a/src/pal/tests/palsuite/pal_specific/PAL_RegisterLibraryW_UnregisterLibraryW/test2_neg/CMakeLists.txt b/src/pal/tests/palsuite/pal_specific/PAL_RegisterLibraryW_UnregisterLibraryW/test2_neg/CMakeLists.txt new file mode 100644 index 0000000000..bbcb35933e --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_RegisterLibraryW_UnregisterLibraryW/test2_neg/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + reg_unreg_libraryw_neg.c +) + +add_executable(paltest_reg_unreg_libraryw_neg + ${SOURCES} +) + +add_dependencies(paltest_reg_unreg_libraryw_neg coreclrpal) + +target_link_libraries(paltest_reg_unreg_libraryw_neg + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/pal_specific/PAL_RegisterLibraryW_UnregisterLibraryW/test2_neg/reg_unreg_libraryw_neg.c b/src/pal/tests/palsuite/pal_specific/PAL_RegisterLibraryW_UnregisterLibraryW/test2_neg/reg_unreg_libraryw_neg.c new file mode 100644 index 0000000000..a15ff5745b --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_RegisterLibraryW_UnregisterLibraryW/test2_neg/reg_unreg_libraryw_neg.c @@ -0,0 +1,62 @@ +// 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: pal_registerlibraryw_unregisterlibraryw_neg.c +** +** Purpose: Negative test the PAL_RegisterLibrary API. +** Call PAL_RegisterLibrary to map a non-existant module +** into the calling process address space. +** +** +**============================================================*/ +#define UNICODE +#include <palsuite.h> + +int __cdecl main(int argc, char *argv[]) +{ + HMODULE ModuleHandle; + char ModuleName[64]; + WCHAR *wpModuleName = NULL; + int err; + + /*Initialize the PAL environment*/ + err = PAL_Initialize(argc, argv); + if(0 != err) + { + return FAIL; + } + + memset(ModuleName, 0, 64); + sprintf(ModuleName, "%s", "not_exist_module_name"); + + /*convert a normal string to a wide one*/ + wpModuleName = convert(ModuleName); + + /*load a not exist module*/ + ModuleHandle = PAL_RegisterLibrary(wpModuleName); + + /*free the memory*/ + free(wpModuleName); + + if(NULL != ModuleHandle) + { + Trace("ERROR: PAL_RegisterLibrary successfully mapped " + "a module that does not exist into the calling process\n"); + + /*decrement the reference count of the loaded DLL*/ + err = PAL_UnregisterLibrary(ModuleHandle); + if(0 == err) + { + Trace("\nFailed to call PAL_UnregisterLibrary API to decrement the " + "count of the loaded DLL module!\n"); + } + Fail(""); + + } + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/pal_specific/PAL_RegisterLibraryW_UnregisterLibraryW/test2_neg/testinfo.dat b/src/pal/tests/palsuite/pal_specific/PAL_RegisterLibraryW_UnregisterLibraryW/test2_neg/testinfo.dat new file mode 100644 index 0000000000..3322633291 --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_RegisterLibraryW_UnregisterLibraryW/test2_neg/testinfo.dat @@ -0,0 +1,14 @@ +# 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 = pal_specific +Function = PAL_RegisterLibraryW and PAL_UnregisterLibraryW API +Name = Negative test for PAL_RegisterLibraryW and PAL_UnregisterLibaryW API to map and unmap a non-existant module +TYPE = DEFAULT +EXE1 = pal_registerlibraryw_unregisterlibraryw_neg +Description +=Test the PAL_RegisterLibraryW and PAL_UnregisterLibraryW to map a non-existant +=module into calling process address space + diff --git a/src/pal/tests/palsuite/pal_specific/PAL_errno/CMakeLists.txt b/src/pal/tests/palsuite/pal_specific/PAL_errno/CMakeLists.txt new file mode 100644 index 0000000000..f6aa0cb2d9 --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_errno/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +add_subdirectory(test1) + diff --git a/src/pal/tests/palsuite/pal_specific/PAL_errno/test1/CMakeLists.txt b/src/pal/tests/palsuite/pal_specific/PAL_errno/test1/CMakeLists.txt new file mode 100644 index 0000000000..59922b194b --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_errno/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + PAL_errno.c +) + +add_executable(paltest_pal_errno_test1 + ${SOURCES} +) + +add_dependencies(paltest_pal_errno_test1 coreclrpal) + +target_link_libraries(paltest_pal_errno_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/pal_specific/PAL_errno/test1/PAL_errno.c b/src/pal/tests/palsuite/pal_specific/PAL_errno/test1/PAL_errno.c new file mode 100644 index 0000000000..32e8487d07 --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_errno/test1/PAL_errno.c @@ -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: pal_errno.c +** +** Purpose: Positive test the PAL_errno API. +** call PAL_errno to retrieve the pointer to +** the per-thread errno value. +** +** +**============================================================*/ +#include <palsuite.h> + +int __cdecl main(int argc, char *argv[]) +{ + int err; + FILE *pFile = NULL; + + /*Initialize the PAL environment*/ + err = PAL_Initialize(argc, argv); + if( 0 != err) + { + return FAIL; + } + + /*Try to open a not-exist file to read to generate an error*/ + pFile = fopen( "no_exist_file_name", "r" ); + + if( NULL != pFile ) + { + Trace("\nFailed to call fopen to open a not exist for reading, " + "an error is expected, but no error occurred\n"); + + if( EOF == fclose( pFile ) ) + { + Trace("\nFailed to call fclose to close a file stream\n"); + } + Fail( "Test failed! fopen() Should not have worked!" ); + } + + /*retrieve the per-thread error value pointer*/ + if( 2 != errno ) + { + Fail("\nFailed to call PAL_errno API, this value is not correct." + " The correct value is ENOENT[2] ( No such file or directory.).\n"); + } + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/pal_specific/PAL_errno/test1/testinfo.dat b/src/pal/tests/palsuite/pal_specific/PAL_errno/test1/testinfo.dat new file mode 100644 index 0000000000..a35e1d23fc --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_errno/test1/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = PAL_Specific +Function = PAL_errno +Name = Positive test PAL_errno API to retrieve the pre-thread errno value +TYPE = DEFAULT +EXE1 = pal_errno +Description +=Test the PAL_errno to retrieve a pointer to per-thread errno value diff --git a/src/pal/tests/palsuite/pal_specific/PAL_get_stderr/CMakeLists.txt b/src/pal/tests/palsuite/pal_specific/PAL_get_stderr/CMakeLists.txt new file mode 100644 index 0000000000..f6aa0cb2d9 --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_get_stderr/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +add_subdirectory(test1) + diff --git a/src/pal/tests/palsuite/pal_specific/PAL_get_stderr/test1/CMakeLists.txt b/src/pal/tests/palsuite/pal_specific/PAL_get_stderr/test1/CMakeLists.txt new file mode 100644 index 0000000000..3436a2dfdb --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_get_stderr/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + PAL_get_stderr.c +) + +add_executable(paltest_pal_get_stderr_test1 + ${SOURCES} +) + +add_dependencies(paltest_pal_get_stderr_test1 coreclrpal) + +target_link_libraries(paltest_pal_get_stderr_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/pal_specific/PAL_get_stderr/test1/PAL_get_stderr.c b/src/pal/tests/palsuite/pal_specific/PAL_get_stderr/test1/PAL_get_stderr.c new file mode 100644 index 0000000000..da53460101 --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_get_stderr/test1/PAL_get_stderr.c @@ -0,0 +1,52 @@ +// 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: pal_get_stderr.c +** +** Purpose: Positive test the PAL_get_stderr API. +** Call PAL_get_stderr to retrieve the PAL standard error +** output stream pointer. +** This test case should be run manually and automatically. +** + +** +**============================================================*/ +#include <palsuite.h> + +int __cdecl main(int argc, char *argv[]) +{ + int err; + FILE *pPAL_stderr = NULL; + const char *pMsg = "\nThis is a PAL_get_stderr test message, " + "not an error message!\n"; + + /*Initialize the PAL environment*/ + err = PAL_Initialize(argc, argv); + if(0 != err) + { + return FAIL; + } + + /*retrieve the PAL standard error output stream pointer*/ + pPAL_stderr = PAL_get_stderr(); + + if(NULL == pPAL_stderr) + { + Fail("\nFailed to call PAL_get_stderr API, error code = %u\n", + GetLastError()); + } + + /*output a test message through PAL standard error stream*/ + err = fputs(pMsg, pPAL_stderr); + if(EOF == err) + { + Fail("\nFailed to call fputs to output message to PAL stdandard " + "error stream, error code=%u\n", GetLastError()); + } + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/pal_specific/PAL_get_stderr/test1/testinfo.dat b/src/pal/tests/palsuite/pal_specific/PAL_get_stderr/test1/testinfo.dat new file mode 100644 index 0000000000..a633c68e34 --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_get_stderr/test1/testinfo.dat @@ -0,0 +1,14 @@ +# 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 = PAL_Specific +Function = PAL_get_stderr +Name = Positive test PAL_get_stderr to retrieve the PAL standard error stream pointer +TYPE = DEFAULT +EXE1 = pal_get_stderr +Description +=Test the PAL_get_stderr to retrieve the PAL standard error output stream pointer and +=output a test message to this error stream +=this test case will be run both manually and automatically diff --git a/src/pal/tests/palsuite/pal_specific/PAL_get_stdin/CMakeLists.txt b/src/pal/tests/palsuite/pal_specific/PAL_get_stdin/CMakeLists.txt new file mode 100644 index 0000000000..f6aa0cb2d9 --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_get_stdin/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +add_subdirectory(test1) + diff --git a/src/pal/tests/palsuite/pal_specific/PAL_get_stdin/test1/CMakeLists.txt b/src/pal/tests/palsuite/pal_specific/PAL_get_stdin/test1/CMakeLists.txt new file mode 100644 index 0000000000..592895b18c --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_get_stdin/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + PAL_get_stdin.c +) + +add_executable(paltest_pal_get_stdin_test1 + ${SOURCES} +) + +add_dependencies(paltest_pal_get_stdin_test1 coreclrpal) + +target_link_libraries(paltest_pal_get_stdin_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/pal_specific/PAL_get_stdin/test1/PAL_get_stdin.c b/src/pal/tests/palsuite/pal_specific/PAL_get_stdin/test1/PAL_get_stdin.c new file mode 100644 index 0000000000..5d1fd23f92 --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_get_stdin/test1/PAL_get_stdin.c @@ -0,0 +1,68 @@ +// 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: pal_get_stdin.c +** +** Purpose: Positive test the PAL_get_stdout API. +** Call PAL_get_stdin to retrieve the PAL standard input +** stream pointer. +** This test case should be run manually. +** + +** +**============================================================*/ +#include <palsuite.h> + +int __cdecl main(int argc, char *argv[]) +{ + int err; + FILE *pPAL_stdin = NULL; + char Buffer[256]; + + /*Initialize the PAL environment*/ + err = PAL_Initialize(argc, argv); + if(0 != err) + { + return FAIL; + } + + /*retrieve the PAL standard input stream pointer*/ + pPAL_stdin = PAL_get_stdin(); + if(NULL == pPAL_stdin) + { + Fail("\nFailed to call PAL_get_stdin API to retrieve the " + "PAL standard input stream pointer, " + "error code = %u\n", GetLastError()); + } + + /*zero the buffer*/ + memset(Buffer, 0, 256); + + printf("\nPlease input some words: (less than 255 characters)\n"); + + /*further test the input stream*/ + /*read message from the PAL standard input stream*/ + if(NULL == fgets(Buffer, 255, pPAL_stdin)) + { + Fail( "Failed to call fgets to get a string from PAL standard " + "input stream, error code=%u\n", GetLastError()); + } + else + { + if(1 == strlen(Buffer) && Buffer[0] == '\n') + { + printf("\nEmpty input!\n"); + } + else + { + printf("\nYour input words are:\n%s\n", Buffer); + } + } + + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/pal_specific/PAL_get_stdin/test1/testinfo.dat b/src/pal/tests/palsuite/pal_specific/PAL_get_stdin/test1/testinfo.dat new file mode 100644 index 0000000000..d1c5723236 --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_get_stdin/test1/testinfo.dat @@ -0,0 +1,14 @@ +# 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 = PAL_Specific +Function = PAL_get_stdin +Name = Positive test PAL_get_stdin to retrieve the PAL standard stdin stream pointer +TYPE = DEFAULT +EXE1 = pal_get_stdin +Description +=Test the PAL_get_stdin to retrieve the PAL standard input stream pointer +=if success, display the input string to screen +=this test case should be run manually diff --git a/src/pal/tests/palsuite/pal_specific/PAL_get_stdout/CMakeLists.txt b/src/pal/tests/palsuite/pal_specific/PAL_get_stdout/CMakeLists.txt new file mode 100644 index 0000000000..f6aa0cb2d9 --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_get_stdout/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +add_subdirectory(test1) + diff --git a/src/pal/tests/palsuite/pal_specific/PAL_get_stdout/test1/CMakeLists.txt b/src/pal/tests/palsuite/pal_specific/PAL_get_stdout/test1/CMakeLists.txt new file mode 100644 index 0000000000..865dd52f16 --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_get_stdout/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + PAL_get_stdout.c +) + +add_executable(paltest_pal_get_stdout_test1 + ${SOURCES} +) + +add_dependencies(paltest_pal_get_stdout_test1 coreclrpal) + +target_link_libraries(paltest_pal_get_stdout_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/pal_specific/PAL_get_stdout/test1/PAL_get_stdout.c b/src/pal/tests/palsuite/pal_specific/PAL_get_stdout/test1/PAL_get_stdout.c new file mode 100644 index 0000000000..ebfee47ae9 --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_get_stdout/test1/PAL_get_stdout.c @@ -0,0 +1,52 @@ +// 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: pal_get_stdout.c +** +** Purpose: Positive test the PAL_get_stdout API. +** Call PAL_get_stdout to retrieve the PAL standard output +** stream pointer. +** This test case should be run manually and automatically. +** + +** +**============================================================*/ +#include <palsuite.h> + +int __cdecl main(int argc, char *argv[]) +{ + int err; + FILE *pPAL_stdout = NULL; + const char *pMsg = "\nThis is a PAL_get_stdout test output message, " + "not an error message!\n"; + + /*Initialize the PAL environment*/ + err = PAL_Initialize(argc, argv); + if(0 != err) + { + return FAIL; + } + + /*retrieve the PAL output stream pointer*/ + pPAL_stdout = PAL_get_stdout(); + if(NULL == pPAL_stdout) + { + Fail("\nFailed to call PAL_get_stdout API to retrieve the " + "standard PAL output stream pointer, error code=%u\n", + GetLastError()); + } + + /*output a test message through PAL standard output stream*/ + err = fputs(pMsg, pPAL_stdout); + if(EOF == err) + { + Fail("\nFailed to call fputs to output message to PAL stdandard " + "output stream, error code=%u\n", GetLastError()); + } + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/pal_specific/PAL_get_stdout/test1/testinfo.dat b/src/pal/tests/palsuite/pal_specific/PAL_get_stdout/test1/testinfo.dat new file mode 100644 index 0000000000..ed370981aa --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_get_stdout/test1/testinfo.dat @@ -0,0 +1,13 @@ +# 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 = PAL_Specific +Function = PAL_get_stdout +Name = Positive test PAL_get_stdout to retrieve PAL standard output stream pointer +TYPE = DEFAULT +EXE1 = pal_get_stdout +Description +=Test the PAL_get_stdout to retrieve the PAL standard output stream pointer +=This test case will be run both manually and automatically diff --git a/src/pal/tests/palsuite/pal_specific/pal_entrypoint/CMakeLists.txt b/src/pal/tests/palsuite/pal_specific/pal_entrypoint/CMakeLists.txt new file mode 100644 index 0000000000..f6aa0cb2d9 --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/pal_entrypoint/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +add_subdirectory(test1) + diff --git a/src/pal/tests/palsuite/pal_specific/pal_entrypoint/test1/CMakeLists.txt b/src/pal/tests/palsuite/pal_specific/pal_entrypoint/test1/CMakeLists.txt new file mode 100644 index 0000000000..cd18b76958 --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/pal_entrypoint/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + pal_entrypoint.c +) + +add_executable(paltest_pal_entrypoint_test1 + ${SOURCES} +) + +add_dependencies(paltest_pal_entrypoint_test1 coreclrpal) + +target_link_libraries(paltest_pal_entrypoint_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/pal_specific/pal_entrypoint/test1/pal_entrypoint.c b/src/pal/tests/palsuite/pal_specific/pal_entrypoint/test1/pal_entrypoint.c new file mode 100644 index 0000000000..c1b66944aa --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/pal_entrypoint/test1/pal_entrypoint.c @@ -0,0 +1,54 @@ +// 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: pal_entrypoint.c +** +** Purpose: Positive test the PAL_EntryPoint API. +** +** Test the PAL_EntryPoint, Call a PAL function, and let main return +** as expected.. +** + +** +**============================================================*/ + +#include "palstartup.h" + +/* Test case copied and stream lined from isalpha\test1*/ +struct testCase +{ + int CorrectResult; + int character; +}; + +int __cdecl main(int argc, char *argv[]) +{ + int result; + int i; + + struct testCase testCases[] = + { + {1, 'a'} + }; + + + i = 0; + result = isalpha(testCases[i].character); + /* The return value is 'non-zero' for success. This if condition + * will still work if that non-zero isn't just 1 + */ + if ( ((testCases[i].CorrectResult == 1) && (result == 0)) || + ( (testCases[i].CorrectResult == 0) && (result != 0) )) + { + Fail("ERROR: isalpha returned %i instead of %i for character " + "%c.\n", + result, + testCases[i].CorrectResult, + testCases[i].character); + } + + return PASS; +} 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 new file mode 100644 index 0000000000..862870be99 --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/pal_entrypoint/test1/palstartup.h @@ -0,0 +1,49 @@ +// 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. +// =========================================================================== +// File: palstartup.h +// +// An implementation of startup code for Rotor's Unix PAL. This file should +// be included by any file in a PAL application that defines main. +// we have added palsuite.h to include test related macros etc... +// =========================================================================== + +#ifndef __PALSTARTUP_H__ +#define __PALSTARTUP_H__ + +#include <palsuite.h> + +int __cdecl PAL_startup_main(int argc, char **argv); + +struct _mainargs +{ + int argc; + char ** argv; +}; + +static DWORD PALAPI run_main(struct _mainargs *args) +{ + return (DWORD) PAL_startup_main(args->argc, args->argv); +} + +int __cdecl main(int argc, char **argv) { + struct _mainargs mainargs; + + if (PAL_Initialize(argc, 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); + + mainargs.argc = argc; + mainargs.argv = argv; + exit((int)PAL_EntryPoint((PTHREAD_START_ROUTINE)run_main, &mainargs)); + return 0; // Quiet a compiler warning +} + +#define main PAL_startup_main + +#endif // __PALSTARTUP_H__ diff --git a/src/pal/tests/palsuite/pal_specific/pal_entrypoint/test1/testinfo.dat b/src/pal/tests/palsuite/pal_specific/pal_entrypoint/test1/testinfo.dat new file mode 100644 index 0000000000..01ac3d6f9f --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/pal_entrypoint/test1/testinfo.dat @@ -0,0 +1,12 @@ +# 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 = PAL_Specific +Function = PAL_entrypoint +Name = Positive test entrypoint API +TYPE = DEFAULT +EXE1 = pal_errno +Description +=Test the PAL_entrypoint to call a PAL api diff --git a/src/pal/tests/palsuite/pal_specific/pal_initializedebug/CMakeLists.txt b/src/pal/tests/palsuite/pal_specific/pal_initializedebug/CMakeLists.txt new file mode 100644 index 0000000000..f6aa0cb2d9 --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/pal_initializedebug/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +add_subdirectory(test1) + diff --git a/src/pal/tests/palsuite/pal_specific/pal_initializedebug/test1/CMakeLists.txt b/src/pal/tests/palsuite/pal_specific/pal_initializedebug/test1/CMakeLists.txt new file mode 100644 index 0000000000..f6e243d0c4 --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/pal_initializedebug/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + pal_initializedebug.c +) + +add_executable(paltest_pal_initializedebug_test1 + ${SOURCES} +) + +add_dependencies(paltest_pal_initializedebug_test1 coreclrpal) + +target_link_libraries(paltest_pal_initializedebug_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/pal_specific/pal_initializedebug/test1/pal_initializedebug.c b/src/pal/tests/palsuite/pal_specific/pal_initializedebug/test1/pal_initializedebug.c new file mode 100644 index 0000000000..d14c316013 --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/pal_initializedebug/test1/pal_initializedebug.c @@ -0,0 +1,36 @@ +// 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: pal_initializedebug.c +** +** Purpose: Positive test the PAL_InitializeDebug API. +** +** Test the PAL_InitializeDebug, it will be NOPs for all +** platforms other than Mac. There is no other way of testing it +** currently +** + +** +**============================================================*/ +#include <palsuite.h> + +int __cdecl main(int argc, char *argv[]) +{ + int err; + + /* Initialize the PAL environment */ + err = PAL_Initialize(argc, argv); + + if(0 != err) + { + return FAIL; + } + + PAL_InitializeDebug(); + + PAL_Terminate(); + return 0; +} diff --git a/src/pal/tests/palsuite/pal_specific/pal_initializedebug/test1/testinfo.dat b/src/pal/tests/palsuite/pal_specific/pal_initializedebug/test1/testinfo.dat new file mode 100644 index 0000000000..45c40e50d2 --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/pal_initializedebug/test1/testinfo.dat @@ -0,0 +1,13 @@ +# 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 = PAL_Specific +Function = PAL_InitializeDebug +Name = Positive test for PAL_InitializeDebug +TYPE = DEFAULT +EXE1 = pal_initializedebug +Description +=Test the PAL_InitializeDebug, it will be NOPs for all +=platforms other than Mac |