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_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
set (CMAKE_BUILD_TYPE RELWITHDEBINFO) set (CMAKE_BUILD_TYPE RELWITHDEBINFO)
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov") set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov")
endif()
elseif ("${VARIANT}" STREQUAL "ubasan") elseif ("${VARIANT}" STREQUAL "ubasan")
if (MSVC)
else()
set(CMAKE_CXX_FLAGS 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") "${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_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address,undefined")
set(CMAKE_BUILD_TYPE RELWITHDEBINFO) 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)
if (NOT "${VARIANT}" STREQUAL "coverage")
add_subdirectory (example) add_subdirectory (example)
endif()

View File

@@ -52,8 +52,7 @@ if [ os.name ] = MACOSX
using clang : : ; using clang : : ;
} }
variant coverage variant coverage :
:
release release
: :
<cxxflags>"-fprofile-arcs -ftest-coverage" <cxxflags>"-fprofile-arcs -ftest-coverage"
@@ -64,7 +63,7 @@ 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,6 +6,7 @@ add_subdirectory (server)
add_subdirectory (websocket) add_subdirectory (websocket)
add_subdirectory (zlib) add_subdirectory (zlib)
if (NOT "${VARIANT}" STREQUAL "coverage")
GroupSources(extras/beast extras) GroupSources(extras/beast extras)
GroupSources(include/beast beast) GroupSources(include/beast beast)
GroupSources(test "/") GroupSources(test "/")
@@ -27,3 +28,4 @@ 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,6 +44,7 @@ target_link_libraries(http-tests
${Boost_CONTEXT_LIBRARY} ${Boost_CONTEXT_LIBRARY}
) )
if (NOT "${VARIANT}" STREQUAL "coverage")
add_executable (http-bench add_executable (http-bench
${BEAST_INCLUDES} ${BEAST_INCLUDES}
${EXTRAS_INCLUDES} ${EXTRAS_INCLUDES}
@@ -59,3 +60,4 @@ target_link_libraries(http-bench
${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY}
${Boost_FILESYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY}
) )
endif()

View File

@@ -1,5 +1,7 @@
# Part of Beast # Part of Beast
if (NOT "${VARIANT}" STREQUAL "coverage")
GroupSources(example/server-framework framework) GroupSources(example/server-framework framework)
GroupSources(extras/beast extras) GroupSources(extras/beast extras)
GroupSources(include/beast beast) GroupSources(include/beast beast)
@@ -44,3 +46,5 @@ target_link_libraries(server-test
if (OPENSSL_FOUND) if (OPENSSL_FOUND)
target_link_libraries(server-test ${OPENSSL_LIBRARIES}) target_link_libraries(server-test ${OPENSSL_LIBRARIES})
endif() endif()
endif()