@@ -12,82 +12,93 @@ if (OPENSSL_FOUND)
1212endif ()
1313
1414if (Boost_FOUND)
15- set ( TESTS
16- response_incremental_parser_test
17- request_incremental_parser_test
18- request_linearize_test
19- )
15+ set (TESTS response_incremental_parser_test request_incremental_parser_test
16+ request_linearize_test)
2017 foreach (test ${TESTS} )
2118 add_executable (cpp-netlib-http-${test} ${test} .cpp)
22- add_dependencies (cpp-netlib-http-${test}
19+ add_dependencies (cpp-netlib-http-${test} gtest_main
2320 cppnetlib-uri)
2421 target_link_libraries (cpp-netlib-http-${test}
25- ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}
22+ ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} gtest_main
2623 cppnetlib-uri)
27- if (${CMAKE_CXX_COMPILER_ID} MATCHES GNUAND ${CMAKE_SYSTEM_NAME} MATCHES "Windows" )
24+ if (${CMAKE_CXX_COMPILER_ID} MATCHES GNUAND ${CMAKE_SYSTEM_NAME} MATCHES "Windows" )
2825 target_link_libraries (cpp-netlib-http-${test} ws2_32)
2926 endif ()
30- if (${CMAKE_SYSTEM_NAME} MATCHES "Linux" )
31- target_link_libraries (cpp-netlib-http-${test} rt)
32- endif ()
27+ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux" )
28+ target_link_libraries (cpp-netlib-http-${test} rt)
29+ endif ()
3330 set_target_properties (cpp-netlib-http-${test}
3431 PROPERTIESRUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR }/tests)
3532 add_test (cpp-netlib-http-${test}
3633 ${CPP-NETLIB_BINARY_DIR }/tests/cpp-netlib-http-${test} )
3734 endforeach (test )
38- set ( TESTS
39- client_constructor_test
40- client_get_test
41- client_get_different_port_test
42- client_get_timeout_test
43- client_get_streaming_test
44- )
35+ set (TESTS client_constructor_test client_get_test
36+ client_get_different_port_test client_get_timeout_test
37+ client_get_streaming_test)
4538 foreach (test ${TESTS} )
4639 add_executable (cpp-netlib-http-${test} ${test} .cpp)
47- add_dependencies (cpp-netlib-http-${test}
48- cppnetlib-uri
49- cppnetlib-client-connections)
50- target_link_libraries (cpp-netlib-http-${test}
51- ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}
52- cppnetlib-uri
53- cppnetlib-client-connections)
40+ add_dependencies (cpp-netlib-http-${test} cppnetlib-uri
41+ cppnetlib-client-connections gtest_main)
42+ target_link_libraries (cpp-netlib-http-${test} ${Boost_LIBRARIES}
43+ ${CMAKE_THREAD_LIBS_INIT} cppnetlib-uri gtest_main cppnetlib-client-connections)
5444 if (OPENSSL_FOUND)
5545 target_link_libraries (cpp-netlib-http-${test} ${OPENSSL_LIBRARIES} )
5646 endif ()
57- if (${CMAKE_CXX_COMPILER_ID} MATCHES GNUAND ${CMAKE_SYSTEM_NAME} MATCHES "Windows" )
47+ if (${CMAKE_CXX_COMPILER_ID} MATCHES GNUAND ${CMAKE_SYSTEM_NAME} MATCHES "Windows" )
5848 target_link_libraries (cpp-netlib-http-${test} ws2_32)
5949 endif ()
60- if (${CMAKE_SYSTEM_NAME} MATCHES "Linux" )
61- target_link_libraries (cpp-netlib-http-${test} rt)
62- endif ()
50+ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux" )
51+ target_link_libraries (cpp-netlib-http-${test} rt)
52+ endif ()
6353 set_target_properties (cpp-netlib-http-${test}
6454 PROPERTIESRUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR }/tests)
6555 add_test (cpp-netlib-http-${test}
6656 ${CPP-NETLIB_BINARY_DIR }/tests/cpp-netlib-http-${test} )
6757 endforeach (test )
6858
69- set ( SERVER_API_TESTS
70- server_constructor_test
71- server_async_run_stop_concurrency
72- server_header_parser_test
73- )
74- foreach (test ${SERVER_API_TESTS} )
59+ set (SERVER_API_TESTS server_constructor_test
60+ server_header_parser_test)
61+ foreach (test ${SERVER_API_TESTS} )
7562 add_executable (cpp-netlib-http-${test} ${test} .cpp)
7663 add_dependencies (cpp-netlib-http-${test} cppnetlib-server-parsers)
77- target_link_libraries (cpp-netlib-http-${test} ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} cppnetlib-server-parsers)
64+ target_link_libraries (cpp-netlib-http-${test} ${Boost_LIBRARIES}
65+ ${CMAKE_THREAD_LIBS_INIT} cppnetlib-server-parsers gtest_main)
7866 if (OPENSSL_FOUND)
7967 target_link_libraries (cpp-netlib-http-${test} ${OPENSSL_LIBRARIES} )
8068 endif ()
81- if (${CMAKE_CXX_COMPILER_ID} MATCHES GNUAND ${CMAKE_SYSTEM_NAME} MATCHES "Windows" )
69+ if (${CMAKE_CXX_COMPILER_ID} MATCHES GNUAND ${CMAKE_SYSTEM_NAME} MATCHES "Windows" )
8270 target_link_libraries (cpp-netlib-http-${test} ws2_32 wsock32)
8371 endif ()
84- if (${CMAKE_SYSTEM_NAME} MATCHES "Linux" )
85- target_link_libraries (cpp-netlib-http-${test} rt)
86- endif ()
72+ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux" )
73+ target_link_libraries (cpp-netlib-http-${test} rt)
74+ endif ()
8775 set_target_properties (cpp-netlib-http-${test}
8876 PROPERTIESRUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR }/tests)
8977 add_test (cpp-netlib-http-${test}
9078 ${CPP-NETLIB_BINARY_DIR }/tests/cpp-netlib-http-${test} )
9179 endforeach (test )
9280
81+ # Add the server start/stop concurrency test
82+ add_executable (cpp-netlib-http-server_async_run_stop_concurrency
83+ server_async_run_stop_concurrency.cpp)
84+ add_dependencies (cpp-netlib-http-server_async_run_stop_concurrency
85+ cppnetlib-server-parsers)
86+ target_link_libraries (cpp-netlib-http-server_async_run_stop_concurrency
87+ ${Boost_LIBRARIES} cppnetlib-server-parsers)
88+ if (OPENSSL_FOUND)
89+ target_link_libraries (cpp-netlib-http-server_async_run_stop_concurrency
90+ ${OPENSSL_LIBRARIES} )
91+ endif ()
92+ if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU
93+ AND ${CMAKE_SYSTEM_NAME} MATCHES "Windows" )
94+ target_link_libraries (cpp-netlib-http-server_async_run_stop_concurrency
95+ ws2_32 wsock32)
96+ endif ()
97+ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux" )
98+ target_link_libraries (cpp-netlib-http-server_async_run_stop_concurrency rt)
99+ endif ()
100+ set_target_properties (cpp-netlib-http-server_async_run_stop_concurrency
101+ PROPERTIESRUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR }/tests)
102+ add_test (cpp-netlib-http-server_async_run_stop_concurrency
103+ ${CPP-NETLIB_BINARY_DIR }/tests/cpp-netlib-http-server_async_run_stop_concurrency)
93104endif ()