summaryrefslogtreecommitdiff
path: root/src/pal/tests/palsuite/threading/CreateEventW/test1
diff options
context:
space:
mode:
Diffstat (limited to 'src/pal/tests/palsuite/threading/CreateEventW/test1')
-rw-r--r--src/pal/tests/palsuite/threading/CreateEventW/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/threading/CreateEventW/test1/test1.c93
-rw-r--r--src/pal/tests/palsuite/threading/CreateEventW/test1/testinfo.dat14
3 files changed, 126 insertions, 0 deletions
diff --git a/src/pal/tests/palsuite/threading/CreateEventW/test1/CMakeLists.txt b/src/pal/tests/palsuite/threading/CreateEventW/test1/CMakeLists.txt
new file mode 100644
index 0000000000..0e8ba5bc2a
--- /dev/null
+++ b/src/pal/tests/palsuite/threading/CreateEventW/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_createeventw_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_createeventw_test1 coreclrpal)
+
+target_link_libraries(paltest_createeventw_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/threading/CreateEventW/test1/test1.c b/src/pal/tests/palsuite/threading/CreateEventW/test1/test1.c
new file mode 100644
index 0000000000..8d99e41934
--- /dev/null
+++ b/src/pal/tests/palsuite/threading/CreateEventW/test1/test1.c
@@ -0,0 +1,93 @@
+// 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: Test for CreateEventW
+**
+**
+**=========================================================*/
+
+/*
+ * Note: From the rotor_pal documentation: lpEventAttributes will
+ * always be NULL, bManualReset can be either TRUE or FALSE,
+ * bInitialState can be either TRUE or FALSE, the lpName may be
+ * non-NULL.
+*/
+#define UNICODE
+#include <palsuite.h>
+
+BOOL CreateEventTest()
+{
+ BOOL bRet = FALSE;
+ DWORD dwRet = 0;
+
+ LPSECURITY_ATTRIBUTES lpEventAttributes = NULL;
+ BOOL bManualReset = TRUE;
+ BOOL bInitialState = TRUE;
+
+ /*
+ * Call CreateEvent, and check to ensure the returned HANDLE is a
+ * valid event HANDLE
+ */
+
+ HANDLE hEvent = CreateEventW(lpEventAttributes,
+ bManualReset,
+ bInitialState,
+ NULL);
+
+ if (hEvent != NULL)
+ {
+ /*
+ * Wait for the Object (for 0 time) and ensure that it returns
+ * the value indicating that the event is signaled.
+ */
+ dwRet = WaitForSingleObject(hEvent,0);
+
+ if (dwRet != WAIT_OBJECT_0)
+ {
+ Trace("CreateEventTest:WaitForSingleObject failed (%x)\n", GetLastError());
+ }
+ else
+ {
+ /*
+ * If we make it here, and CloseHandle succeeds, then the
+ * entire test has passed. Otherwise bRet will still show
+ * failure
+ */
+ bRet = CloseHandle(hEvent);
+
+ if (!bRet)
+ {
+ Trace("CreateEventTest:CloseHandle failed (%x)\n", GetLastError());
+ }
+ }
+ }
+ else
+ {
+ Trace("CreateEventTest:CreateEvent failed (%x)\n", GetLastError());
+ }
+
+ return bRet;
+}
+
+int __cdecl main(int argc, char **argv)
+{
+
+ if(0 != (PAL_Initialize(argc, argv)))
+ {
+ return ( FAIL );
+ }
+
+ if(!CreateEventTest())
+ {
+ Fail ("Test failed\n");
+ }
+
+ PAL_Terminate();
+ return ( PASS );
+
+}
diff --git a/src/pal/tests/palsuite/threading/CreateEventW/test1/testinfo.dat b/src/pal/tests/palsuite/threading/CreateEventW/test1/testinfo.dat
new file mode 100644
index 0000000000..204ad1f4d4
--- /dev/null
+++ b/src/pal/tests/palsuite/threading/CreateEventW/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 = threading
+Function = CreateEventW
+Name = Positive Test for CreateEventW
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Test for CreateEventW. Create an event, ensure the
+= HANDLE is valid. Then check to ensure that the object is in the
+= signaled state. Close the HANDLE and done.