Currently disabled for FreeBSD.
cmake_minimum_required(VERSION 2.8.12.2)
+add_subdirectory(pal_sxs)
#add_subdirectory(pal_except)
#add_subdirectory(PAL_EXCEPT_FILTER)
#add_subdirectory(PAL_EXCEPT_FILTER_EX)
--- /dev/null
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
--- /dev/null
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+if(CLR_CMAKE_PLATFORM_UNIX)
+ add_compile_options(-fPIC)
+endif(CLR_CMAKE_PLATFORM_UNIX)
+
+# Test DLL1
+
+set(DEF_SOURCES1 dlltest1.src)
+convert_to_absolute_path(DEF_SOURCES1 ${DEF_SOURCES1})
+set(EXPORTS_FILE1 ${CMAKE_CURRENT_BINARY_DIR}/dlltest1.exports)
+generate_exports_file(${DEF_SOURCES1} ${EXPORTS_FILE1})
+
+if(CMAKE_SYSTEM_NAME STREQUAL Linux OR CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
+ set(EXPORTS_LINKER_OPTION1 -Wl,--version-script=${EXPORTS_FILE1})
+endif(CMAKE_SYSTEM_NAME STREQUAL Linux OR CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
+
+if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
+ set(EXPORTS_LINKER_OPTION1 -Wl,-exported_symbols_list,${EXPORTS_FILE1})
+endif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
+
+set(DLL1SOURCES dlltest1.cpp)
+add_library(paltest_pal_sxs_test1_dll1 SHARED ${DLL1SOURCES})
+add_custom_target(dlltest1_exports DEPENDS ${EXPORTS_FILE1})
+set_property(TARGET paltest_pal_sxs_test1_dll1 APPEND_STRING PROPERTY LINK_FLAGS ${EXPORTS_LINKER_OPTION1})
+set_property(TARGET paltest_pal_sxs_test1_dll1 APPEND_STRING PROPERTY LINK_DEPENDS ${EXPORTS_FILE1})
+
+add_dependencies(paltest_pal_sxs_test1_dll1
+ dlltest1_exports
+ coreclrpal
+)
+
+target_link_libraries(paltest_pal_sxs_test1_dll1
+ pthread
+ m
+ coreclrpal
+)
+
+# Test DLL2
+
+set(DEF_SOURCES2 dlltest2.src)
+convert_to_absolute_path(DEF_SOURCES2 ${DEF_SOURCES2})
+set(EXPORTS_FILE2 ${CMAKE_CURRENT_BINARY_DIR}/dlltest2.exports)
+generate_exports_file(${DEF_SOURCES2} ${EXPORTS_FILE2})
+
+if(CMAKE_SYSTEM_NAME STREQUAL Linux OR CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
+ set(EXPORTS_LINKER_OPTION2 -Wl,--version-script=${EXPORTS_FILE2})
+endif(CMAKE_SYSTEM_NAME STREQUAL Linux OR CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
+
+if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
+ set(EXPORTS_LINKER_OPTION2 -Wl,-exported_symbols_list,${EXPORTS_FILE2})
+endif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
+
+set(DLL2SOURCES dlltest2.cpp)
+add_library(paltest_pal_sxs_test1_dll2 SHARED ${DLL2SOURCES})
+add_custom_target(dlltest2_exports DEPENDS ${EXPORTS_FILE2})
+set_property(TARGET paltest_pal_sxs_test1_dll2 APPEND_STRING PROPERTY LINK_FLAGS ${EXPORTS_LINKER_OPTION2})
+set_property(TARGET paltest_pal_sxs_test1_dll2 APPEND_STRING PROPERTY LINK_DEPENDS ${EXPORTS_FILE2})
+
+add_dependencies(paltest_pal_sxs_test1_dll2
+ dlltest2_exports
+ coreclrpal
+)
+
+target_link_libraries(paltest_pal_sxs_test1_dll2
+ pthread
+ m
+ coreclrpal
+)
+
+# Main program
+
+set(TESTSOURCES exceptionsxs.cpp)
+
+add_executable(paltest_pal_sxs_test1 ${TESTSOURCES})
+
+add_dependencies(paltest_pal_sxs_test1
+ paltest_pal_sxs_test1_dll1
+ paltest_pal_sxs_test1_dll2
+)
+
+target_link_libraries(paltest_pal_sxs_test1
+ paltest_pal_sxs_test1_dll1
+ paltest_pal_sxs_test1_dll2
+)
+
--- /dev/null
+//
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+//
+
+/*=====================================================================
+**
+** Source: dlltest1.c (exception_handling\pal_sxs\test1)
+**
+** Purpose: Test to make sure the PAL_EXCEPT block is executed
+** after an exception occurs in the PAL_TRY block with
+** multiple PALs in the process.
+**
+**
+**===================================================================*/
+#include <palsuite.h>
+
+extern "C"
+int InitializeDllTest1()
+{
+ return PAL_InitializeDLL();
+}
+
+BOOL bTry = FALSE;
+BOOL bExcept = FALSE;
+
+extern "C"
+int DllTest1()
+{
+ Trace("Starting pal_sxs test1 DllTest1\n");
+
+ PAL_TRY(VOID*, unused, NULL)
+ {
+ volatile int* p = 0x00000000; /* NULL pointer */
+
+ bTry = TRUE; /* indicate we hit the PAL_TRY block */
+ *p = 13; /* causes an access violation exception */
+
+ Fail("ERROR: code was executed after the access violation.\n");
+ }
+ PAL_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ if (!bTry)
+ {
+ Fail("ERROR: PAL_EXCEPT was hit without PAL_TRY being hit.\n");
+ }
+
+ bExcept = TRUE; /* indicate we hit the PAL_EXCEPT block */
+ }
+ PAL_ENDTRY;
+
+ if (!bTry)
+ {
+ Trace("ERROR: the code in the PAL_TRY block was not executed.\n");
+ }
+
+ if (!bExcept)
+ {
+ Trace("ERROR: the code in the PAL_EXCEPT block was not executed.\n");
+ }
+
+ /* did we hit all the code blocks? */
+ if(!bTry || !bExcept)
+ {
+ Fail("DllTest1 FAILED\n");
+ }
+
+ Trace("DLLTest1 PASSED\n");
+
+ return PASS;
+}
--- /dev/null
+InitializeDllTest1
+DllTest1
+
--- /dev/null
+//
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+//
+
+/*=====================================================================
+**
+** Source: dlltest2.c (exception_handling\pal_sxs\test1)
+**
+** Purpose: Test to make sure the PAL_EXCEPT block is executed
+** after an exception occurs in the PAL_TRY block with
+** multiple PALs in the process.
+**
+**
+**===================================================================*/
+#include <palsuite.h>
+
+extern "C"
+int InitializeDllTest2()
+{
+ return PAL_InitializeDLL();
+}
+
+BOOL bTry = FALSE;
+BOOL bExcept = FALSE;
+
+extern "C"
+int DllTest2()
+{
+ Trace("Starting pal_sxs test1 DllTest2\n");
+
+ PAL_TRY(VOID*, unused, NULL)
+ {
+ volatile int* p = 0x00000000; /* NULL pointer */
+
+ bTry = TRUE; /* indicate we hit the PAL_TRY block */
+ *p = 13; /* causes an access violation exception */
+
+ Fail("ERROR: code was executed after the access violation.\n");
+ }
+ PAL_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ if (!bTry)
+ {
+ Fail("ERROR: PAL_EXCEPT was hit without PAL_TRY being hit.\n");
+ }
+
+ bExcept = TRUE; /* indicate we hit the PAL_EXCEPT block */
+ }
+ PAL_ENDTRY;
+
+ if (!bTry)
+ {
+ Trace("ERROR: the code in the PAL_TRY block was not executed.\n");
+ }
+
+ if (!bExcept)
+ {
+ Trace("ERROR: the code in the PAL_EXCEPT block was not executed.\n");
+ }
+
+ /* did we hit all the code blocks? */
+ if(!bTry || !bExcept)
+ {
+ Fail("DllTest2 FAILED\n");
+ }
+
+ Trace("DLLTest2 PASSED\n");
+
+ return PASS;
+}
--- /dev/null
+InitializeDllTest2
+DllTest2
+
--- /dev/null
+//
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+//
+
+/*=====================================================================
+**
+** Source: exceptionsxs.c (exception_handling\pal_sxs\test1)
+**
+** Purpose: Test to make sure the PAL_EXCEPT block is executed
+** after an exception occurs in the PAL_TRY block with
+** multiple PALs in the process.
+**
+**
+**===================================================================*/
+
+extern "C" int InitializeDllTest1();
+extern "C" int InitializeDllTest2();
+extern "C" int DllTest1();
+extern "C" int DllTest2();
+
+int __cdecl main(int argc, char *argv[])
+{
+#ifndef __FreeBSD__
+ if (0 != InitializeDllTest1())
+ {
+ return 1;
+ }
+
+ if (0 != InitializeDllTest2())
+ {
+ return 1;
+ }
+
+ DllTest2();
+ DllTest1();
+ DllTest2();
+#endif
+ return 0;
+}
--- /dev/null
+#
+# Copyright (c) Microsoft Corporation. All rights reserved.
+#
+
+Version = 1.0
+Section = exception_handling
+Function = test1
+Name = pal_sxs test #1
+TYPE = DEFAULT
+EXE1 = test1
+LANG = cpp
+Description
+=Tests that exceptions across multiples pals work correctly
exception_handling/RaiseException/test1/paltest_raiseexception_test1
exception_handling/RaiseException/test2/paltest_raiseexception_test2
exception_handling/RaiseException/test3/paltest_raiseexception_test3
+exception_handling/pal_sxs/test1/paltest_pal_sxs_test1
filemapping_memmgt/CreateFileMappingA/test1/paltest_createfilemappinga_test1
filemapping_memmgt/CreateFileMappingA/test3/paltest_createfilemappinga_test3
filemapping_memmgt/CreateFileMappingA/test4/paltest_createfilemappinga_test4