5 ${CMAKE_CURRENT_SOURCE_DIR}
6 ${CMAKE_SOURCE_DIR}/src
10 set(TORTURE_LIBRARY torture)
13 add_executable(echo_srv echo_srv.c)
14 target_link_libraries(echo_srv ${SWRAP_REQUIRED_LIBRARIES})
16 add_library(${TORTURE_LIBRARY} STATIC torture.c)
17 target_link_libraries(${TORTURE_LIBRARY}
19 ${SWRAP_REQUIRED_LIBRARIES}
20 ${CMAKE_THREAD_LIBS_INIT})
22 set(SWRAP_THREADED_TESTS
24 test_thread_echo_tcp_connect
25 test_thread_echo_tcp_write_read
26 test_thread_echo_tcp_sendmsg_recvmsg
27 test_thread_echo_udp_send_recv)
36 test_echo_tcp_socket_options
37 test_echo_tcp_sendmsg_recvmsg
38 test_echo_tcp_write_read
39 test_echo_tcp_writev_readv
40 test_echo_tcp_get_peer_sock_name
41 test_echo_udp_sendto_recvfrom
42 test_echo_udp_send_recv
43 test_echo_udp_sendmsg_recvmsg
47 test_fork_thread_deadlock
48 test_tcp_socket_overwrite
49 ${SWRAP_THREADED_TESTS})
51 if (HAVE_STRUCT_MSGHDR_MSG_CONTROL)
52 set(SWRAP_TESTS ${SWRAP_TESTS} test_sendmsg_recvmsg_fd)
53 endif (HAVE_STRUCT_MSGHDR_MSG_CONTROL)
55 foreach(_SWRAP_TEST ${SWRAP_TESTS})
56 add_cmocka_test(${_SWRAP_TEST} ${_SWRAP_TEST}.c ${TORTURE_LIBRARY})
63 ENVIRONMENT DYLD_FORCE_FLAT_NAMESPACE=1;DYLD_INSERT_LIBRARIES=${SOCKET_WRAPPER_LOCATION})
69 ENVIRONMENT LD_PRELOAD=${SOCKET_WRAPPER_LOCATION})
74 find_program(VALGRIND_EXECUTABLE valgrind)
75 if (VALGRIND_EXECUTABLE)
76 set(VALGRIND_HELGRIND_OPTIONS -v -trace-children=yes --tool=helgrind --read-var-info=yes)
78 foreach(_TEST ${SWRAP_THREADED_TESTS})
79 set(_HELGRIND_TEST "helgrind_${_TEST}")
81 add_test(NAME ${_HELGRIND_TEST} COMMAND ${VALGRIND_EXECUTABLE} ${VALGRIND_HELGRIND_OPTIONS} ${CMAKE_CURRENT_BINARY_DIR}/${_TEST})
87 ENVIRONMENT DYLD_FORCE_FLAT_NAMESPACE=1;DYLD_INSERT_LIBRARIES=${SOCKET_WRAPPER_LOCATION})
93 ENVIRONMENT LD_PRELOAD=${SOCKET_WRAPPER_LOCATION})
100 add_library(thread_deadlock SHARED thread_deadlock.c)
101 target_link_libraries(thread_deadlock ${CMAKE_THREAD_LIBS_INIT})
102 target_link_libraries(test_fork_thread_deadlock thread_deadlock)