mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 01:08:35 +00:00
feature(testing-automation): unit tests with Google Framework (#3273)
This commit is contained in:
@@ -33,8 +33,8 @@ set(AC_PATH_ROOT "${CMAKE_SOURCE_DIR}")
|
||||
|
||||
# set macro-directory
|
||||
list(APPEND CMAKE_MODULE_PATH
|
||||
"${CMAKE_SOURCE_DIR}/src/cmake/macros"
|
||||
"${CMAKE_SOURCE_DIR}/deps/cotire/CMake")
|
||||
"${CMAKE_SOURCE_DIR}/src/cmake/macros"
|
||||
"${CMAKE_SOURCE_DIR}/deps/cotire/CMake")
|
||||
|
||||
include(CheckCXXSourceRuns)
|
||||
include(CheckIncludeFiles)
|
||||
@@ -49,7 +49,7 @@ include(conf/dist/config.cmake)
|
||||
|
||||
# load custom configurations for cmake if exists
|
||||
if(EXISTS "${CMAKE_SOURCE_DIR}/conf/config.cmake")
|
||||
include(conf/config.cmake)
|
||||
include(conf/config.cmake)
|
||||
endif()
|
||||
|
||||
#
|
||||
@@ -63,7 +63,7 @@ FOREACH(subdir ${sub_DIRS})
|
||||
get_filename_component(MODULENAME ${subdir} NAME)
|
||||
|
||||
if (";${DISABLED_AC_MODULES};" MATCHES ";${MODULENAME};")
|
||||
continue()
|
||||
continue()
|
||||
endif()
|
||||
|
||||
STRING(REGEX REPLACE "^${CMAKE_SOURCE_DIR}/" "" subdir_rel ${subdir})
|
||||
@@ -77,13 +77,13 @@ CU_RUN_HOOK("AFTER_LOAD_CONF")
|
||||
|
||||
# build in Release-mode by default if not explicitly set
|
||||
if( NOT CMAKE_BUILD_TYPE )
|
||||
set(CMAKE_BUILD_TYPE "Release")
|
||||
set(CMAKE_BUILD_TYPE "Release")
|
||||
endif()
|
||||
|
||||
# turn off PCH totally if enabled (hidden setting, mainly for devs)
|
||||
if( NOPCH )
|
||||
set(USE_COREPCH 0)
|
||||
set(USE_SCRIPTPCH 0)
|
||||
set(USE_COREPCH 0)
|
||||
set(USE_SCRIPTPCH 0)
|
||||
endif()
|
||||
|
||||
include(ConfigureBaseTargets)
|
||||
@@ -101,11 +101,11 @@ find_package(ACE REQUIRED)
|
||||
find_package(MySQL REQUIRED)
|
||||
|
||||
if(UNIX AND WITH_PERFTOOLS)
|
||||
find_package(Gperftools)
|
||||
find_package(Gperftools)
|
||||
endif()
|
||||
|
||||
if(NOT WITHOUT_GIT)
|
||||
find_package(Git)
|
||||
find_package(Git)
|
||||
endif()
|
||||
|
||||
# Find revision ID and hash of the sourcetree
|
||||
@@ -121,11 +121,11 @@ include(src/cmake/showoptions.cmake)
|
||||
add_subdirectory(deps)
|
||||
|
||||
if( SERVERS OR TOOLS)
|
||||
add_subdirectory(src/common)
|
||||
add_subdirectory(src/common)
|
||||
endif()
|
||||
|
||||
if( TOOLS )
|
||||
add_subdirectory(src/tools)
|
||||
add_subdirectory(src/tools)
|
||||
endif()
|
||||
|
||||
#
|
||||
@@ -138,3 +138,19 @@ CU_RUN_HOOK("BEFORE_SRC_LOAD")
|
||||
add_subdirectory(src)
|
||||
|
||||
CU_RUN_HOOK("AFTER_SRC_LOAD")
|
||||
|
||||
if( UNIT_TESTS )
|
||||
# we use this to get code coverage
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES GNU)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
|
||||
endif()
|
||||
|
||||
include(src/cmake/googletest.cmake)
|
||||
fetch_googletest(
|
||||
${PROJECT_SOURCE_DIR}/src/cmake
|
||||
${PROJECT_BINARY_DIR}/googletest
|
||||
)
|
||||
|
||||
enable_testing()
|
||||
add_subdirectory(src/test)
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user