summaryrefslogtreecommitdiff
path: root/src/pal/tests/palsuite/c_runtime/exit
diff options
context:
space:
mode:
Diffstat (limited to 'src/pal/tests/palsuite/c_runtime/exit')
-rw-r--r--src/pal/tests/palsuite/c_runtime/exit/CMakeLists.txt5
-rw-r--r--src/pal/tests/palsuite/c_runtime/exit/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/exit/test1/test1.c37
-rw-r--r--src/pal/tests/palsuite/c_runtime/exit/test1/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/exit/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/exit/test2/test2.c38
-rw-r--r--src/pal/tests/palsuite/c_runtime/exit/test2/testinfo.dat13
7 files changed, 143 insertions, 0 deletions
diff --git a/src/pal/tests/palsuite/c_runtime/exit/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/exit/CMakeLists.txt
new file mode 100644
index 0000000000..ef14ea5352
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/exit/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/c_runtime/exit/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/exit/test1/CMakeLists.txt
new file mode 100644
index 0000000000..eb9ca4e780
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/exit/test1/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test1.c
+)
+
+add_executable(paltest_exit_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_exit_test1 coreclrpal)
+
+target_link_libraries(paltest_exit_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/exit/test1/test1.c b/src/pal/tests/palsuite/c_runtime/exit/test1/test1.c
new file mode 100644
index 0000000000..87c9d22b8a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/exit/test1/test1.c
@@ -0,0 +1,37 @@
+// 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: test1.c
+**
+** Purpose: Calls exit, and verifies that it actually stops program execution.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+ /*
+ * Initialize the PAL and return FAIL if this fails
+ */
+ if (0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ /*should return 0*/
+ exit(0);
+
+ Fail ("Exit didn't actually stop execution.\n");
+
+ return FAIL;
+}
+
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/exit/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/exit/test1/testinfo.dat
new file mode 100644
index 0000000000..3d9583bf96
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/exit/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 = C Runtime
+Function = exit
+Name = Positive Test for exit
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Calls exit, and verifies that it actually stops program execution.
diff --git a/src/pal/tests/palsuite/c_runtime/exit/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/exit/test2/CMakeLists.txt
new file mode 100644
index 0000000000..47d3a44c85
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/exit/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_exit_test2
+ ${SOURCES}
+)
+
+add_dependencies(paltest_exit_test2 coreclrpal)
+
+target_link_libraries(paltest_exit_test2
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/exit/test2/test2.c b/src/pal/tests/palsuite/c_runtime/exit/test2/test2.c
new file mode 100644
index 0000000000..16fbdfed2f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/exit/test2/test2.c
@@ -0,0 +1,38 @@
+// 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: Calls exit on fail, and verifies that it actually
+** stops program execution and return 1.
+
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char **argv)
+{
+ /*
+ * Initialize the PAL and return FAIL if this fails
+ */
+ if (0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ /*should return 1*/
+ exit(1);
+
+}
+
+
+
+
+
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/exit/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/exit/test2/testinfo.dat
new file mode 100644
index 0000000000..6887f27c36
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/exit/test2/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 = C Runtime
+Function = exit
+Name = Positive Test for exit
+TYPE = DEFAULT
+EXE1 = test2
+Description
+= Calls exit on fail, and verifies that it actually stops program execution,
+= and return 1.