diff options
Diffstat (limited to 'src/pal/tests/palsuite/threading/ExitProcess')
10 files changed, 206 insertions, 0 deletions
diff --git a/src/pal/tests/palsuite/threading/ExitProcess/CMakeLists.txt b/src/pal/tests/palsuite/threading/ExitProcess/CMakeLists.txt new file mode 100644 index 0000000000..1962ade358 --- /dev/null +++ b/src/pal/tests/palsuite/threading/ExitProcess/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +add_subdirectory(test1) +add_subdirectory(test2) +add_subdirectory(test3) + diff --git a/src/pal/tests/palsuite/threading/ExitProcess/test1/CMakeLists.txt b/src/pal/tests/palsuite/threading/ExitProcess/test1/CMakeLists.txt new file mode 100644 index 0000000000..decddb8512 --- /dev/null +++ b/src/pal/tests/palsuite/threading/ExitProcess/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + ExitProcess.c +) + +add_executable(paltest_exitprocess_test1 + ${SOURCES} +) + +add_dependencies(paltest_exitprocess_test1 coreclrpal) + +target_link_libraries(paltest_exitprocess_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/threading/ExitProcess/test1/ExitProcess.c b/src/pal/tests/palsuite/threading/ExitProcess/test1/ExitProcess.c new file mode 100644 index 0000000000..2b089a0b83 --- /dev/null +++ b/src/pal/tests/palsuite/threading/ExitProcess/test1/ExitProcess.c @@ -0,0 +1,32 @@ +// 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: exitprocess/test1/exitprocess.c +** +** Purpose: Test to ensure ExitProcess returns the argument given +** to it. +** +** +**=========================================================*/ + +#include <palsuite.h> + +int __cdecl main( int argc, char **argv ) + +{ + + if(0 != (PAL_Initialize(argc, argv))) + { + return ( FAIL ); + } + + ExitProcess(PASS); + + Fail ("ExitProcess(0) failed to exit.\n Test Failed.\n"); + + return ( FAIL); + +} diff --git a/src/pal/tests/palsuite/threading/ExitProcess/test1/testinfo.dat b/src/pal/tests/palsuite/threading/ExitProcess/test1/testinfo.dat new file mode 100644 index 0000000000..d8b85abad6 --- /dev/null +++ b/src/pal/tests/palsuite/threading/ExitProcess/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 = threading +Function = ExitProcess +Name = Positive Test for ExitProcess +TYPE = DEFAULT +EXE1 = exitprocess +Description += Test the ExitProcess function. The test runs the ExitProcess function += with the TEST_RETURN enumeration value PASS diff --git a/src/pal/tests/palsuite/threading/ExitProcess/test2/CMakeLists.txt b/src/pal/tests/palsuite/threading/ExitProcess/test2/CMakeLists.txt new file mode 100644 index 0000000000..881c7d0eee --- /dev/null +++ b/src/pal/tests/palsuite/threading/ExitProcess/test2/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test2.c +) + +add_executable(paltest_exitprocess_test2 + ${SOURCES} +) + +add_dependencies(paltest_exitprocess_test2 coreclrpal) + +target_link_libraries(paltest_exitprocess_test2 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/threading/ExitProcess/test2/test2.c b/src/pal/tests/palsuite/threading/ExitProcess/test2/test2.c new file mode 100644 index 0000000000..8023ad7bab --- /dev/null +++ b/src/pal/tests/palsuite/threading/ExitProcess/test2/test2.c @@ -0,0 +1,30 @@ +// 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: test2.c +** +** Purpose: Positive test for ExitProcess. +** +** Dependencies: none +** + +** +**===========================================================================*/ +#include <palsuite.h> + + + +int __cdecl main( int argc, char **argv ) + +{ + /* call ExitProcess() -- should work without PAL_Initialize() */ + ExitProcess(PASS); + + + /* return failure if we reach here -- note no attempt at */ + /* meaningful output because we never called PAL_Initialize(). */ + return FAIL; +} diff --git a/src/pal/tests/palsuite/threading/ExitProcess/test2/testinfo.dat b/src/pal/tests/palsuite/threading/ExitProcess/test2/testinfo.dat new file mode 100644 index 0000000000..0aa07eb15a --- /dev/null +++ b/src/pal/tests/palsuite/threading/ExitProcess/test2/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 = threading +Function = ExitProcess +Name = Positive test for ExitProcess +TYPE = DEFAULT +EXE1 = test2 +Description += Test to ensure proper operation of the ExitProcess() += API by ensuring it works before PAL_Initialize() is += called. diff --git a/src/pal/tests/palsuite/threading/ExitProcess/test3/CMakeLists.txt b/src/pal/tests/palsuite/threading/ExitProcess/test3/CMakeLists.txt new file mode 100644 index 0000000000..638408e986 --- /dev/null +++ b/src/pal/tests/palsuite/threading/ExitProcess/test3/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test3.c +) + +add_executable(paltest_exitprocess_test3 + ${SOURCES} +) + +add_dependencies(paltest_exitprocess_test3 coreclrpal) + +target_link_libraries(paltest_exitprocess_test3 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/threading/ExitProcess/test3/test3.c b/src/pal/tests/palsuite/threading/ExitProcess/test3/test3.c new file mode 100644 index 0000000000..aea485e5e3 --- /dev/null +++ b/src/pal/tests/palsuite/threading/ExitProcess/test3/test3.c @@ -0,0 +1,40 @@ +// 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: test3.c +** +** Purpose: Positive test for ExitProcess. +** +** Dependencies: PAL_Initialize +** PAL_Terminate +** + +** +**===========================================================================*/ +#include <palsuite.h> + + + +int __cdecl main( int argc, char **argv ) + +{ + /* initialize the PAL */ + if( PAL_Initialize(argc, argv) != 0 ) + { + return( FAIL ); + } + + /* terminate the PAL */ + PAL_Terminate(); + + /* call ExitProcess() -- should work after PAL_Terminate() */ + ExitProcess( PASS ); + + + /* return failure if we reach here -- note no attempt at */ + /* meaningful output because we've called PAL_Terminte(). */ + return FAIL; +} diff --git a/src/pal/tests/palsuite/threading/ExitProcess/test3/testinfo.dat b/src/pal/tests/palsuite/threading/ExitProcess/test3/testinfo.dat new file mode 100644 index 0000000000..c857d885cc --- /dev/null +++ b/src/pal/tests/palsuite/threading/ExitProcess/test3/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 = threading +Function = ExitProcess +Name = Positive test for ExitProcess +TYPE = DEFAULT +EXE1 = test3 +Description += Test to ensure proper operation of the ExitProcess() += API by ensuring it works after PAL_Terminate() is += called. |