Only build and run tests in variant=coverage

This commit is contained in:
Vinnie Falco
2017-06-20 14:39:05 -07:00
parent 3cb1451a43
commit 9c4b3ed2a7
13 changed files with 123 additions and 96 deletions

View File

@@ -102,16 +102,21 @@ endfunction()
#-------------------------------------------------------------------------------
if ("${VARIANT}" STREQUAL "coverage")
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
set (CMAKE_BUILD_TYPE RELWITHDEBINFO)
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov")
if (MSVC)
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
set (CMAKE_BUILD_TYPE RELWITHDEBINFO)
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov")
endif()
elseif ("${VARIANT}" STREQUAL "ubasan")
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -DBEAST_NO_SLOW_TESTS=1 -funsigned-char -fno-omit-frame-pointer -fsanitize=address,undefined -fsanitize-blacklist=${PROJECT_SOURCE_DIR}/scripts/blacklist.supp")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address,undefined")
set(CMAKE_BUILD_TYPE RELWITHDEBINFO)
if (MSVC)
else()
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -DBEAST_NO_SLOW_TESTS=1 -funsigned-char -fno-omit-frame-pointer -fsanitize=address,undefined -fsanitize-blacklist=${PROJECT_SOURCE_DIR}/scripts/blacklist.supp")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address,undefined")
set(CMAKE_BUILD_TYPE RELWITHDEBINFO)
endif()
elseif ("${VARIANT}" STREQUAL "debug")
set(CMAKE_BUILD_TYPE DEBUG)
@@ -186,5 +191,8 @@ file(GLOB_RECURSE SERVER_INCLUDES
)
add_subdirectory (test)
add_subdirectory (example)
if (NOT "${VARIANT}" STREQUAL "coverage")
add_subdirectory (example)
endif()

11
Jamroot
View File

@@ -52,19 +52,18 @@ if [ os.name ] = MACOSX
using clang : : ;
}
variant coverage
:
variant coverage :
release
:
:
<cxxflags>"-fprofile-arcs -ftest-coverage"
<linkflags>"-lgcov"
;
;
variant ubasan
:
release
:
<cxxflags>"-DBEAST_NO_SLOW_TESTS=1 -funsigned-char -fno-omit-frame-pointer -fsanitize=address,undefined -fsanitize-blacklist=scripts/blacklist.supp"
<cxxflags>"-funsigned-char -fno-omit-frame-pointer -fsanitize=address,undefined -fsanitize-blacklist=scripts/blacklist.supp"
<linkflags>"-fsanitize=address,undefined"
;
@@ -112,4 +111,4 @@ project beast
;
build-project test ;
build-project example ;
#build-project example ;

View File

@@ -5,6 +5,8 @@
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
exe echo-op/echo-op :
exe echo-op :
echo_op.cpp
:
<variant>coverage:<build>no
;

View File

@@ -43,7 +43,8 @@ project
<library>crypto
;
exe http-client-ssl
:
exe http-client-ssl :
http_client_ssl.cpp
;
:
<variant>coverage:<build>no
;

View File

@@ -7,4 +7,6 @@
exe http-client :
http_client.cpp
:
<variant>coverage:<build>no
;

View File

@@ -8,4 +8,6 @@
exe http-crawl :
http_crawl.cpp
urls_large_data.cpp
:
<variant>coverage:<build>no
;

View File

@@ -7,4 +7,6 @@
exe server-framework :
main.cpp
:
<variant>coverage:<build>no
;

View File

@@ -43,7 +43,8 @@ project
<library>crypto
;
exe ssl-websocket-client
:
exe ssl-websocket-client :
ssl_websocket_client.cpp
;
:
<variant>coverage:<build>no
;

View File

@@ -7,4 +7,6 @@
exe websocket-client :
websocket_client.cpp
:
<variant>coverage:<build>no
;

View File

@@ -6,24 +6,26 @@ add_subdirectory (server)
add_subdirectory (websocket)
add_subdirectory (zlib)
GroupSources(extras/beast extras)
GroupSources(include/beast beast)
GroupSources(test "/")
if (NOT "${VARIANT}" STREQUAL "coverage")
GroupSources(extras/beast extras)
GroupSources(include/beast beast)
GroupSources(test "/")
add_executable (lib-tests
${BEAST_INCLUDES}
${EXTRAS_INCLUDES}
../extras/beast/unit_test/main.cpp
config.cpp
core.cpp
http.cpp
version.cpp
websocket.cpp
zlib.cpp
)
add_executable (lib-tests
${BEAST_INCLUDES}
${EXTRAS_INCLUDES}
../extras/beast/unit_test/main.cpp
config.cpp
core.cpp
http.cpp
version.cpp
websocket.cpp
zlib.cpp
)
target_link_libraries(lib-tests Beast ${Boost_PROGRAM_OPTIONS_LIBRARY})
target_link_libraries(lib-tests Beast ${Boost_PROGRAM_OPTIONS_LIBRARY})
if (MINGW)
set_target_properties(lib-tests PROPERTIES COMPILE_FLAGS "-Wa,-mbig-obj")
if (MINGW)
set_target_properties(lib-tests PROPERTIES COMPILE_FLAGS "-Wa,-mbig-obj")
endif()
endif()

View File

@@ -7,12 +7,12 @@
import os ;
compile config.cpp : : ;
compile core.cpp : : ;
compile http.cpp : : ;
compile version.cpp : : ;
compile websocket.cpp : : ;
compile zlib.cpp : : ;
compile config.cpp : <variant>coverage:<build>no : ;
compile core.cpp : <variant>coverage:<build>no : ;
compile http.cpp : <variant>coverage:<build>no : ;
compile version.cpp : <variant>coverage:<build>no : ;
compile websocket.cpp : <variant>coverage:<build>no : ;
compile zlib.cpp : <variant>coverage:<build>no : ;
build-project core ;
build-project http ;

View File

@@ -44,18 +44,20 @@ target_link_libraries(http-tests
${Boost_CONTEXT_LIBRARY}
)
add_executable (http-bench
${BEAST_INCLUDES}
${EXTRAS_INCLUDES}
nodejs_parser.hpp
message_fuzz.hpp
../../extras/beast/unit_test/main.cpp
nodejs_parser.cpp
parser_bench.cpp
)
target_link_libraries(http-bench
Beast
${Boost_PROGRAM_OPTIONS_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
if (NOT "${VARIANT}" STREQUAL "coverage")
add_executable (http-bench
${BEAST_INCLUDES}
${EXTRAS_INCLUDES}
nodejs_parser.hpp
message_fuzz.hpp
../../extras/beast/unit_test/main.cpp
nodejs_parser.cpp
parser_bench.cpp
)
target_link_libraries(http-bench
Beast
${Boost_PROGRAM_OPTIONS_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
)
endif()

View File

@@ -1,46 +1,50 @@
# Part of Beast
GroupSources(example/server-framework framework)
GroupSources(extras/beast extras)
GroupSources(include/beast beast)
if (NOT "${VARIANT}" STREQUAL "coverage")
GroupSources(test/server "/")
GroupSources(example/server-framework framework)
GroupSources(extras/beast extras)
GroupSources(include/beast beast)
if (OPENSSL_FOUND)
include_directories(${OPENSSL_INCLUDE_DIR})
endif()
GroupSources(test/server "/")
add_executable (server-test
${BEAST_INCLUDES}
${SERVER_INCLUDES}
../../extras/beast/unit_test/main.cpp
file_body.cpp
file_service.cpp
framework.cpp
http_async_port.cpp
http_base.cpp
http_sync_port.cpp
https_ports.cpp
multi_port.cpp
rfc7231.cpp
server.cpp
service_list.cpp
ssl_certificate
ssl_stream.cpp
tests.cpp
write_msg.cpp
ws_async_port.cpp
ws_sync_port.cpp
ws_upgrade_service.cpp
wss_ports.cpp
)
if (OPENSSL_FOUND)
include_directories(${OPENSSL_INCLUDE_DIR})
endif()
target_link_libraries(server-test
Beast
${Boost_PROGRAM_OPTIONS_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
add_executable (server-test
${BEAST_INCLUDES}
${SERVER_INCLUDES}
../../extras/beast/unit_test/main.cpp
file_body.cpp
file_service.cpp
framework.cpp
http_async_port.cpp
http_base.cpp
http_sync_port.cpp
https_ports.cpp
multi_port.cpp
rfc7231.cpp
server.cpp
service_list.cpp
ssl_certificate
ssl_stream.cpp
tests.cpp
write_msg.cpp
ws_async_port.cpp
ws_sync_port.cpp
ws_upgrade_service.cpp
wss_ports.cpp
)
if (OPENSSL_FOUND)
target_link_libraries(server-test ${OPENSSL_LIBRARIES})
target_link_libraries(server-test
Beast
${Boost_PROGRAM_OPTIONS_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
)
if (OPENSSL_FOUND)
target_link_libraries(server-test ${OPENSSL_LIBRARIES})
endif()
endif()