2014-08-05 13:24:32 +02:00
|
|
|
# CMake build script for ZeroMQ tests
|
2016-03-05 21:01:21 +01:00
|
|
|
cmake_minimum_required(VERSION "2.8.1")
|
2016-03-05 18:23:23 +01:00
|
|
|
|
2016-04-18 17:33:34 +02:00
|
|
|
# On Windows: solution file will be called tests.sln
|
2016-03-05 18:23:23 +01:00
|
|
|
PROJECT(tests)
|
2014-08-05 13:24:32 +02:00
|
|
|
|
|
|
|
set(tests
|
2016-05-08 19:25:03 +02:00
|
|
|
test_ancillaries
|
2014-08-05 13:24:32 +02:00
|
|
|
test_system
|
|
|
|
test_pair_inproc
|
|
|
|
test_pair_tcp
|
|
|
|
test_reqrep_inproc
|
|
|
|
test_reqrep_tcp
|
|
|
|
test_hwm
|
2014-08-08 19:36:00 +02:00
|
|
|
test_hwm_pubsub
|
2014-08-05 13:24:32 +02:00
|
|
|
test_reqrep_device
|
|
|
|
test_sub_forward
|
|
|
|
test_invalid_rep
|
|
|
|
test_msg_flags
|
2015-06-08 22:16:50 +02:00
|
|
|
test_msg_ffn
|
2014-08-05 13:24:32 +02:00
|
|
|
test_connect_resolve
|
|
|
|
test_immediate
|
|
|
|
test_last_endpoint
|
|
|
|
test_term_endpoint
|
|
|
|
test_router_mandatory
|
|
|
|
test_probe_router
|
|
|
|
test_stream
|
|
|
|
test_stream_empty
|
|
|
|
test_stream_disconnect
|
|
|
|
test_disconnect_inproc
|
2015-06-29 04:23:25 +02:00
|
|
|
test_unbind_inproc
|
|
|
|
test_unbind_wildcard
|
2014-08-05 13:24:32 +02:00
|
|
|
test_ctx_options
|
|
|
|
test_ctx_destroy
|
|
|
|
test_security_null
|
|
|
|
test_security_plain
|
2017-08-17 11:45:18 +02:00
|
|
|
test_security_zap
|
2014-08-05 13:24:32 +02:00
|
|
|
test_iov
|
|
|
|
test_spec_req
|
|
|
|
test_spec_rep
|
|
|
|
test_spec_dealer
|
|
|
|
test_spec_router
|
|
|
|
test_spec_pushpull
|
|
|
|
test_req_correlate
|
|
|
|
test_req_relaxed
|
|
|
|
test_conflate
|
|
|
|
test_inproc_connect
|
|
|
|
test_issue_566
|
|
|
|
test_shutdown_stress
|
|
|
|
test_timeo
|
|
|
|
test_many_sockets
|
|
|
|
test_diffserv
|
|
|
|
test_connect_rid
|
2014-08-12 21:34:30 +02:00
|
|
|
test_xpub_nodrop
|
2015-01-26 15:59:19 +01:00
|
|
|
test_pub_invert_matching
|
2015-11-13 10:41:00 +01:00
|
|
|
test_setsockopt
|
2015-10-23 00:33:27 +02:00
|
|
|
test_sockopt_hwm
|
2015-03-17 02:39:16 +01:00
|
|
|
test_heartbeats
|
2015-10-23 16:14:30 +02:00
|
|
|
test_atomics
|
|
|
|
test_bind_src_address
|
|
|
|
test_capabilities
|
|
|
|
test_metadata
|
|
|
|
test_router_handover
|
|
|
|
test_srcfd
|
|
|
|
test_stream_timeout
|
|
|
|
test_xpub_manual
|
|
|
|
test_xpub_welcome_msg
|
2018-02-25 21:20:44 +01:00
|
|
|
test_xpub_verbose
|
2016-05-19 12:46:15 +02:00
|
|
|
test_base85
|
2016-09-24 19:06:08 +02:00
|
|
|
test_bind_after_connect_tcp
|
2016-05-19 12:46:15 +02:00
|
|
|
test_sodium
|
2017-08-20 22:43:11 +02:00
|
|
|
test_monitor
|
2017-08-22 15:54:33 +02:00
|
|
|
test_socket_null
|
2017-09-19 01:14:10 +02:00
|
|
|
test_reconnect_ivl
|
2014-08-05 13:24:32 +02:00
|
|
|
)
|
2017-08-15 16:28:24 +02:00
|
|
|
if(ZMQ_HAVE_CURVE)
|
|
|
|
list(APPEND tests
|
|
|
|
test_security_curve)
|
|
|
|
endif()
|
2014-08-05 13:24:32 +02:00
|
|
|
if(NOT WIN32)
|
|
|
|
list(APPEND tests
|
2016-04-21 14:39:21 +02:00
|
|
|
test_ipc_wildcard
|
2014-08-05 13:24:32 +02:00
|
|
|
test_pair_ipc
|
2017-10-05 23:29:25 +02:00
|
|
|
test_rebind_ipc
|
2014-08-05 13:24:32 +02:00
|
|
|
test_reqrep_ipc
|
|
|
|
test_proxy
|
2015-06-07 06:05:55 +02:00
|
|
|
test_proxy_single_socket
|
2015-04-24 23:01:20 +02:00
|
|
|
test_proxy_terminate
|
2015-08-11 21:37:50 +02:00
|
|
|
test_getsockopt_memset
|
2014-08-05 13:24:32 +02:00
|
|
|
test_filter_ipc
|
2015-10-23 16:14:30 +02:00
|
|
|
test_stream_exceeds_buffer
|
|
|
|
test_router_mandatory_hwm
|
2016-02-09 10:36:14 +01:00
|
|
|
test_use_fd_ipc
|
|
|
|
test_use_fd_tcp
|
2016-12-26 19:20:09 +01:00
|
|
|
test_zmq_poll_fd
|
2014-08-05 13:24:32 +02:00
|
|
|
)
|
|
|
|
if(HAVE_FORK)
|
|
|
|
list(APPEND tests test_fork)
|
|
|
|
endif()
|
2016-04-15 00:44:17 +02:00
|
|
|
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
|
|
|
list(APPEND tests
|
|
|
|
test_abstract_ipc
|
|
|
|
)
|
2016-04-21 12:33:20 +02:00
|
|
|
if(ZMQ_HAVE_TIPC)
|
|
|
|
list(APPEND tests
|
2018-03-07 18:31:26 +01:00
|
|
|
test_address_tipc
|
2016-04-21 12:33:20 +02:00
|
|
|
test_pair_tipc
|
|
|
|
test_reqrep_device_tipc
|
|
|
|
test_reqrep_tipc
|
|
|
|
test_router_mandatory_tipc
|
|
|
|
test_sub_forward_tipc
|
|
|
|
test_connect_delay_tipc
|
|
|
|
test_shutdown_stress_tipc
|
|
|
|
test_term_endpoint_tipc
|
|
|
|
)
|
|
|
|
endif()
|
2016-04-15 00:44:17 +02:00
|
|
|
endif()
|
2014-08-05 13:24:32 +02:00
|
|
|
endif()
|
2015-12-07 13:19:45 +01:00
|
|
|
|
|
|
|
if(WITH_VMCI)
|
|
|
|
list(APPEND tests
|
|
|
|
test_pair_vmci
|
|
|
|
test_reqrep_vmci
|
|
|
|
)
|
|
|
|
endif()
|
2014-08-05 13:24:32 +02:00
|
|
|
|
2016-05-02 20:44:35 +02:00
|
|
|
|
|
|
|
IF (ENABLE_DRAFTS)
|
|
|
|
list(APPEND tests
|
2016-05-02 20:54:31 +02:00
|
|
|
test_poller
|
2016-05-02 20:50:33 +02:00
|
|
|
test_thread_safe
|
|
|
|
test_client_server
|
2016-05-02 20:56:30 +02:00
|
|
|
test_timers
|
2016-05-02 20:59:34 +02:00
|
|
|
test_radio_dish
|
|
|
|
test_udp
|
2016-05-02 21:00:00 +02:00
|
|
|
test_scatter_gather
|
2016-05-13 15:46:07 +02:00
|
|
|
test_dgram
|
2018-03-12 01:41:33 +01:00
|
|
|
test_app_meta
|
2016-05-02 20:44:35 +02:00
|
|
|
)
|
|
|
|
ENDIF (ENABLE_DRAFTS)
|
|
|
|
|
2016-03-05 18:23:23 +01:00
|
|
|
# add location of platform.hpp for Windows builds
|
|
|
|
if(WIN32)
|
|
|
|
add_definitions(-DZMQ_CUSTOM_PLATFORM_HPP)
|
2016-03-06 13:23:26 +01:00
|
|
|
add_definitions(-D_WINSOCK_DEPRECATED_NO_WARNINGS)
|
2016-07-12 15:54:55 +02:00
|
|
|
# Same name on 64bit systems
|
2017-06-14 15:54:03 +02:00
|
|
|
link_libraries(ws2_32.lib)
|
2016-03-05 18:23:23 +01:00
|
|
|
endif()
|
|
|
|
|
2018-02-04 10:18:11 +01:00
|
|
|
add_library (unity
|
|
|
|
STATIC
|
|
|
|
"${CMAKE_CURRENT_LIST_DIR}/../external/unity/unity.c"
|
|
|
|
"${CMAKE_CURRENT_LIST_DIR}/../external/unity/unity.h"
|
|
|
|
"${CMAKE_CURRENT_LIST_DIR}/../external/unity/unity_internals.h")
|
|
|
|
set_target_properties (unity PROPERTIES
|
|
|
|
PUBLIC_HEADER "${CMAKE_CURRENT_LIST_DIR}/../external/unity/unity.h")
|
2018-03-15 11:28:50 +01:00
|
|
|
target_compile_definitions (unity PUBLIC "UNITY_USE_COMMAND_LINE_ARGS" "UNITY_EXCLUDE_FLOAT")
|
2018-02-04 10:18:11 +01:00
|
|
|
target_include_directories (unity
|
|
|
|
PUBLIC "${CMAKE_CURRENT_LIST_DIR}/../external/unity")
|
|
|
|
|
2016-03-05 18:23:23 +01:00
|
|
|
# add library and include dirs for all targets
|
2017-11-18 14:46:49 +01:00
|
|
|
if (BUILD_SHARED)
|
2018-02-04 10:18:11 +01:00
|
|
|
link_libraries(libzmq ${OPTIONAL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} unity)
|
2017-11-18 14:46:49 +01:00
|
|
|
else ()
|
2018-02-04 10:18:11 +01:00
|
|
|
link_libraries(libzmq-static ${OPTIONAL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} unity)
|
2017-11-18 14:46:49 +01:00
|
|
|
endif ()
|
|
|
|
include_directories("${CMAKE_SOURCE_DIR}/../include" "${CMAKE_BINARY_DIR}")
|
2016-03-05 18:23:23 +01:00
|
|
|
|
2014-08-05 13:24:32 +02:00
|
|
|
foreach(test ${tests})
|
2017-09-01 11:59:48 +02:00
|
|
|
# target_sources not supported before CMake 3.1
|
|
|
|
if (ZMQ_HAVE_CURVE AND ${test} MATCHES test_security_curve)
|
|
|
|
add_executable(${test} ${test}.cpp
|
|
|
|
"../src/tweetnacl.c"
|
|
|
|
"../src/err.cpp"
|
|
|
|
"../src/random.cpp"
|
|
|
|
"../src/clock.cpp"
|
|
|
|
"testutil_security.hpp")
|
|
|
|
elseif (${test} MATCHES test_security_zap)
|
|
|
|
add_executable(${test} ${test}.cpp
|
|
|
|
"testutil_security.hpp")
|
|
|
|
else ()
|
2018-03-13 12:00:41 +01:00
|
|
|
add_executable(${test} ${test}.cpp "testutil.hpp" "testutil_unity.hpp")
|
2017-09-01 11:59:48 +02:00
|
|
|
endif ()
|
2016-03-05 18:23:23 +01:00
|
|
|
if(WIN32)
|
2016-07-12 15:54:55 +02:00
|
|
|
# This is the output for Debug dynamic builds on Visual Studio 6.0
|
|
|
|
# You should provide the correct directory, don't know how to do it automatically
|
|
|
|
find_path(LIBZMQ_PATH "libzmq.lib" PATHS "../bin/Win32/Debug/v120/dynamic")
|
|
|
|
if(NOT ${LIBZMQ_PATH} STREQUAL "LIBZMQ_PATH-NOTFOUND")
|
|
|
|
SET_TARGET_PROPERTIES( ${test} PROPERTIES LINK_FLAGS "/LIBPATH:${LIBZMQ_PATH}" )
|
|
|
|
endif()
|
2016-03-05 18:23:23 +01:00
|
|
|
else()
|
2016-04-19 13:20:59 +02:00
|
|
|
# per-test directories not generated on OS X / Darwin
|
2016-04-21 23:32:15 +02:00
|
|
|
if (NOT ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang.*")
|
2016-04-19 13:20:59 +02:00
|
|
|
link_directories(${test} PRIVATE "${CMAKE_SOURCE_DIR}/../lib")
|
|
|
|
endif()
|
2016-03-05 18:23:23 +01:00
|
|
|
endif()
|
2014-08-05 13:24:32 +02:00
|
|
|
|
2016-11-01 12:31:40 +01:00
|
|
|
|
2014-08-05 13:24:32 +02:00
|
|
|
if(RT_LIBRARY)
|
2015-02-12 20:29:09 +01:00
|
|
|
target_link_libraries(${test} ${RT_LIBRARY} )
|
2014-08-05 13:24:32 +02:00
|
|
|
endif()
|
|
|
|
if(WIN32)
|
2015-02-12 20:29:09 +01:00
|
|
|
add_test(NAME ${test} WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH} COMMAND ${test})
|
2014-08-05 13:24:32 +02:00
|
|
|
else()
|
2015-02-12 20:29:09 +01:00
|
|
|
add_test(NAME ${test} COMMAND ${test})
|
2014-08-05 13:24:32 +02:00
|
|
|
endif()
|
2015-10-23 00:33:27 +02:00
|
|
|
set_tests_properties(${test} PROPERTIES TIMEOUT 10)
|
2018-03-09 17:47:42 +01:00
|
|
|
set_tests_properties(${test} PROPERTIES SKIP_RETURN_CODE 77)
|
2014-08-05 13:24:32 +02:00
|
|
|
endforeach()
|
|
|
|
|
2017-08-04 12:07:41 +02:00
|
|
|
#override timeout for these tests
|
2017-08-15 16:28:24 +02:00
|
|
|
if(ZMQ_HAVE_CURVE)
|
|
|
|
set_tests_properties(test_security_curve PROPERTIES TIMEOUT 60)
|
|
|
|
endif()
|
|
|
|
|
2018-02-13 10:08:57 +01:00
|
|
|
if(WIN32 AND ${POLLER} MATCHES "poll")
|
|
|
|
set_tests_properties(test_many_sockets PROPERTIES TIMEOUT 30)
|
|
|
|
set_tests_properties(test_immediate PROPERTIES TIMEOUT 30)
|
|
|
|
endif()
|
|
|
|
|
2017-09-01 11:59:48 +02:00
|
|
|
#add additional required flags
|
2017-11-18 14:54:32 +01:00
|
|
|
#ZMQ_USE_TWEETNACL will already be defined when not using sodium
|
|
|
|
if(ZMQ_HAVE_CURVE AND NOT ZMQ_USE_TWEETNACL)
|
2017-08-15 16:28:24 +02:00
|
|
|
target_compile_definitions(test_security_curve PRIVATE "-DZMQ_USE_TWEETNACL")
|
|
|
|
endif()
|
2017-08-04 12:07:41 +02:00
|
|
|
|
2017-08-17 11:45:18 +02:00
|
|
|
set_tests_properties(test_security_zap PROPERTIES TIMEOUT 60)
|
|
|
|
|
2015-10-23 16:14:30 +02:00
|
|
|
#Check whether all tests in the current folder are present
|
|
|
|
file(READ "${CMAKE_CURRENT_LIST_FILE}" CURRENT_LIST_FILE_CONTENT)
|
|
|
|
file(GLOB ALL_TEST_SOURCES "test_*.cpp")
|
|
|
|
foreach(TEST_SOURCE ${ALL_TEST_SOURCES})
|
|
|
|
get_filename_component(TESTNAME "${TEST_SOURCE}" NAME_WE)
|
|
|
|
string(REGEX MATCH "${TESTNAME}" MATCH_TESTNAME "${CURRENT_LIST_FILE_CONTENT}")
|
|
|
|
if (NOT MATCH_TESTNAME)
|
|
|
|
message(AUTHOR_WARNING "Test '${TESTNAME}' is not known to CTest.")
|
|
|
|
endif()
|
|
|
|
endforeach()
|