mirror of
https://github.com/boostorg/beast.git
synced 2025-07-30 04:47:29 +02:00
@ -1,3 +1,9 @@
|
||||
Version XXX:
|
||||
|
||||
* Add individual tests to CMake workflow.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 322:
|
||||
|
||||
* Fix typo in `_experimental::test::basic_stream` documentation.
|
||||
|
@ -43,6 +43,12 @@ set (ZLIB_SOURCES
|
||||
${CMAKE_CURRENT_LIST_DIR}/extern/zlib-1.2.11/zutil.c
|
||||
)
|
||||
|
||||
add_library (
|
||||
lib-zlib
|
||||
${ZLIB_SOURCES}
|
||||
)
|
||||
target_include_directories(lib-zlib PUBLIC "${CMAKE_CURRENT_LIST_DIR}/extern/zlib-1.2.11")
|
||||
|
||||
set (TEST_MAIN ${PROJECT_SOURCE_DIR}/test/lib_beast.cpp)
|
||||
|
||||
GroupSources (. "/")
|
||||
|
@ -7,6 +7,30 @@
|
||||
# Official repository: https://github.com/boostorg/beast
|
||||
#
|
||||
|
||||
function(build_individual_tests prefix)
|
||||
set(options )
|
||||
set(oneValueArgs )
|
||||
set(multiValueArgs EXCLUDE LIBS EXTRA)
|
||||
cmake_parse_arguments(bit "${options}"
|
||||
"${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
file(GLOB test_srcs "*.cpp")
|
||||
set(individual_tests)
|
||||
foreach(test_src IN LISTS test_srcs)
|
||||
get_filename_component(test_suffix "${test_src}" NAME_WE)
|
||||
if(NOT test_suffix IN_LIST bit_EXCLUDE)
|
||||
set(test_name "${prefix}-${test_suffix}")
|
||||
add_executable("${test_name}" EXCLUDE_FROM_ALL "${test_src}")
|
||||
foreach(lib IN LISTS bit_LIBS)
|
||||
target_link_libraries("${test_name}" "${lib}")
|
||||
endforeach()
|
||||
list(APPEND individual_tests COMMAND "${test_name}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
add_custom_target("${prefix}-all" ${individual_tests})
|
||||
endfunction()
|
||||
|
||||
add_definitions (-DBOOST_BEAST_ALLOW_DEPRECATED)
|
||||
|
||||
# For buffers_cat
|
||||
@ -44,3 +68,12 @@ target_link_libraries(tests-beast
|
||||
lib-test)
|
||||
|
||||
set_property(TARGET tests-beast PROPERTY FOLDER "tests")
|
||||
|
||||
add_custom_target(tests-beast-all
|
||||
DEPENDS
|
||||
tests-beast-_experimental-all
|
||||
tests-beast-core-all
|
||||
tests-beast-http-all
|
||||
tests-beast-ssl-all
|
||||
tests-beast-websocket-all
|
||||
tests-beast-zlib-all )
|
@ -26,3 +26,10 @@ target_link_libraries(tests-beast-_experimental
|
||||
)
|
||||
|
||||
set_property(TARGET tests-beast-_experimental PROPERTY FOLDER "tests")
|
||||
|
||||
#
|
||||
# Individual tests
|
||||
#
|
||||
build_individual_tests(tests-beast-_experimental
|
||||
EXCLUDE
|
||||
LIBS lib-asio lib-asio-ssl lib-beast lib-test)
|
||||
|
@ -72,3 +72,10 @@ target_link_libraries(tests-beast-core
|
||||
)
|
||||
|
||||
set_property(TARGET tests-beast-core PROPERTY FOLDER "tests")
|
||||
|
||||
#
|
||||
# Individual tests
|
||||
#
|
||||
build_individual_tests(tests-beast-core
|
||||
EXCLUDE _detail_static_const close_socket zlib make_strand prepare_buffers
|
||||
LIBS lib-asio lib-asio-ssl lib-beast lib-test)
|
||||
|
@ -162,6 +162,8 @@ struct legacy_handler
|
||||
asio_handler_is_continuation(&h);
|
||||
BEAST_EXPECT(hook_invoked);
|
||||
}
|
||||
#else // !defined(BOOST_ASIO_NO_DEPRECATED)
|
||||
boost::ignore_unused(f);
|
||||
#endif // !defined(BOOST_ASIO_NO_DEPRECATED)
|
||||
}
|
||||
};
|
||||
|
@ -51,3 +51,8 @@ target_link_libraries(tests-beast-http
|
||||
)
|
||||
|
||||
set_property(TARGET tests-beast-http PROPERTY FOLDER "tests")
|
||||
|
||||
#
|
||||
# Individual tests
|
||||
#
|
||||
build_individual_tests(tests-beast-http LIBS lib-asio lib-asio-ssl lib-beast lib-test)
|
||||
|
@ -24,3 +24,5 @@ target_link_libraries(tests-beast-ssl
|
||||
)
|
||||
|
||||
set_property(TARGET tests-beast-ssl PROPERTY FOLDER "tests")
|
||||
|
||||
build_individual_tests(tests-beast-ssl LIBS lib-asio lib-asio-ssl lib-beast lib-test)
|
||||
|
@ -50,3 +50,7 @@ target_link_libraries(tests-beast-websocket
|
||||
)
|
||||
|
||||
set_property(TARGET tests-beast-websocket PROPERTY FOLDER "tests")
|
||||
|
||||
build_individual_tests(tests-beast-websocket
|
||||
EXCLUDE doc_snippets
|
||||
LIBS lib-asio lib-asio-ssl lib-beast lib-test)
|
||||
|
@ -32,3 +32,5 @@ target_link_libraries(tests-beast-zlib
|
||||
)
|
||||
|
||||
set_property(TARGET tests-beast-zlib PROPERTY FOLDER "tests")
|
||||
|
||||
build_individual_tests(tests-beast-zlib LIBS lib-asio lib-beast lib-test lib-zlib)
|
||||
|
Reference in New Issue
Block a user