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") if ("${VARIANT}" STREQUAL "coverage")
set(CMAKE_CXX_FLAGS if (MSVC)
"${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage") else()
set (CMAKE_BUILD_TYPE RELWITHDEBINFO) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov") set (CMAKE_BUILD_TYPE RELWITHDEBINFO)
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov")
endif()
elseif ("${VARIANT}" STREQUAL "ubasan") elseif ("${VARIANT}" STREQUAL "ubasan")
set(CMAKE_CXX_FLAGS if (MSVC)
"${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") else()
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address,undefined") set(CMAKE_CXX_FLAGS
set(CMAKE_BUILD_TYPE RELWITHDEBINFO) "${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") elseif ("${VARIANT}" STREQUAL "debug")
set(CMAKE_BUILD_TYPE DEBUG) set(CMAKE_BUILD_TYPE DEBUG)
@@ -186,5 +191,8 @@ file(GLOB_RECURSE SERVER_INCLUDES
) )
add_subdirectory (test) 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 : : ; using clang : : ;
} }
variant coverage variant coverage :
:
release release
: :
<cxxflags>"-fprofile-arcs -ftest-coverage" <cxxflags>"-fprofile-arcs -ftest-coverage"
<linkflags>"-lgcov" <linkflags>"-lgcov"
; ;
variant ubasan variant ubasan
: :
release 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" <linkflags>"-fsanitize=address,undefined"
; ;
@@ -112,4 +111,4 @@ project beast
; ;
build-project test ; 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) # 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 echo_op.cpp
:
<variant>coverage:<build>no
; ;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,46 +1,50 @@
# Part of Beast # Part of Beast
GroupSources(example/server-framework framework) if (NOT "${VARIANT}" STREQUAL "coverage")
GroupSources(extras/beast extras)
GroupSources(include/beast beast)
GroupSources(test/server "/") GroupSources(example/server-framework framework)
GroupSources(extras/beast extras)
GroupSources(include/beast beast)
if (OPENSSL_FOUND) GroupSources(test/server "/")
include_directories(${OPENSSL_INCLUDE_DIR})
endif()
add_executable (server-test if (OPENSSL_FOUND)
${BEAST_INCLUDES} include_directories(${OPENSSL_INCLUDE_DIR})
${SERVER_INCLUDES} endif()
../../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
)
target_link_libraries(server-test add_executable (server-test
Beast ${BEAST_INCLUDES}
${Boost_PROGRAM_OPTIONS_LIBRARY} ${SERVER_INCLUDES}
${Boost_FILESYSTEM_LIBRARY} ../../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
target_link_libraries(server-test ${OPENSSL_LIBRARIES}) Beast
${Boost_PROGRAM_OPTIONS_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
)
if (OPENSSL_FOUND)
target_link_libraries(server-test ${OPENSSL_LIBRARIES})
endif()
endif() endif()