2013-04-17 00:00:27 -04:00
|
|
|
## some functions for getting system info so we can construct BUILDNAME
|
2013-04-17 00:00:25 -04:00
|
|
|
|
|
|
|
## given an executable, follows symlinks and resolves paths until it runs
|
|
|
|
## out of symlinks, then gives you the basename
|
|
|
|
macro(real_executable_name filename_input out)
|
|
|
|
set(res 0)
|
|
|
|
set(filename ${filename_input})
|
|
|
|
while(NOT(res))
|
|
|
|
execute_process(
|
|
|
|
COMMAND which ${filename}
|
|
|
|
RESULT_VARIABLE res
|
|
|
|
OUTPUT_VARIABLE full_filename
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
if(NOT(res))
|
|
|
|
execute_process(
|
|
|
|
COMMAND readlink ${full_filename}
|
|
|
|
RESULT_VARIABLE res
|
|
|
|
OUTPUT_VARIABLE link_target
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
if(NOT(res))
|
|
|
|
execute_process(
|
|
|
|
COMMAND dirname ${full_filename}
|
|
|
|
OUTPUT_VARIABLE filepath
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
set(filename "${filepath}/${link_target}")
|
|
|
|
else()
|
|
|
|
set(filename ${full_filename})
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
set(filename ${filename})
|
|
|
|
endif()
|
|
|
|
endwhile()
|
|
|
|
execute_process(
|
|
|
|
COMMAND basename ${filename}
|
|
|
|
OUTPUT_VARIABLE real_filename
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
set(${out} ${real_filename})
|
|
|
|
endmacro(real_executable_name)
|
|
|
|
|
|
|
|
## gives you `uname ${flag}`
|
|
|
|
macro(uname flag out)
|
|
|
|
execute_process(
|
|
|
|
COMMAND uname ${flag}
|
|
|
|
OUTPUT_VARIABLE ${out}
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
endmacro(uname)
|
|
|
|
|
2013-04-17 00:00:31 -04:00
|
|
|
## gives the current username
|
|
|
|
macro(whoami out)
|
|
|
|
execute_process(
|
|
|
|
COMMAND whoami
|
|
|
|
OUTPUT_VARIABLE ${out}
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
endmacro(whoami)
|
|
|
|
|
|
|
|
## gives the current hostname, minus .tokutek.com if it's there
|
|
|
|
macro(hostname out)
|
|
|
|
execute_process(
|
|
|
|
COMMAND hostname
|
|
|
|
OUTPUT_VARIABLE fullhostname
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
string(REGEX REPLACE "\\.tokutek\\.com$" "" ${out} ${fullhostname})
|
|
|
|
endmacro(hostname)
|
|
|
|
|
2013-04-17 00:00:25 -04:00
|
|
|
## gather machine info
|
|
|
|
uname("-m" machine_type)
|
2013-04-17 00:00:59 -04:00
|
|
|
real_executable_name("${CMAKE_CXX_COMPILER}" real_cxx_compiler)
|
2013-04-17 00:00:25 -04:00
|
|
|
get_filename_component(branchname "${CMAKE_CURRENT_SOURCE_DIR}" NAME)
|
2013-04-17 00:00:31 -04:00
|
|
|
hostname(host)
|
|
|
|
whoami(user)
|
2013-04-17 00:00:25 -04:00
|
|
|
|
2013-04-17 00:00:31 -04:00
|
|
|
## construct SITE, seems to have to happen before include(CTest)
|
|
|
|
set(SITE "${user}@${host}")
|
2013-04-17 00:01:03 -04:00
|
|
|
if (USE_GCOV)
|
|
|
|
set(buildname_build_type "Coverage")
|
|
|
|
else (USE_GCOV)
|
|
|
|
set(buildname_build_type "${CMAKE_BUILD_TYPE}")
|
|
|
|
endif (USE_GCOV)
|
2013-04-17 00:00:27 -04:00
|
|
|
## construct BUILDNAME, seems to have to happen before include(CTest)
|
2013-04-17 00:01:03 -04:00
|
|
|
set(BUILDNAME "${branchname} ${buildname_build_type} ${CMAKE_SYSTEM} ${machine_type} ${CMAKE_CXX_COMPILER_ID} ${real_cxx_compiler} ${CMAKE_CXX_COMPILER_VERSION}" CACHE STRING "CTest build name" FORCE)
|
2013-04-17 00:00:25 -04:00
|
|
|
|
|
|
|
include(CTest)
|
|
|
|
|
2013-04-17 00:01:05 -04:00
|
|
|
if (BUILD_TESTING OR BUILD_FT_TESTS)
|
2013-04-17 00:00:25 -04:00
|
|
|
## set up full valgrind suppressions file (concatenate the suppressions files)
|
2013-04-17 00:00:35 -04:00
|
|
|
file(READ ft/valgrind.suppressions valgrind_suppressions)
|
2013-04-17 00:00:27 -04:00
|
|
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/valgrind.suppressions" "${valgrind_suppressions}")
|
2013-04-17 00:00:25 -04:00
|
|
|
file(READ src/tests/bdb.suppressions bdb_suppressions)
|
|
|
|
file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/valgrind.suppressions" "${bdb_suppressions}")
|
|
|
|
file(READ bash.suppressions bash_suppressions)
|
|
|
|
file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/valgrind.suppressions" "${bash_suppressions}")
|
|
|
|
|
|
|
|
## setup a function to write tests that will run with helgrind
|
2013-04-17 00:00:31 -04:00
|
|
|
set(CMAKE_HELGRIND_COMMAND_STRING "valgrind --quiet --tool=helgrind --error-exitcode=1 --suppressions=${TokuDB_SOURCE_DIR}/src/tests/helgrind.suppressions --trace-children=yes --trace-children-skip=sh,*/sh,basename,*/basename,dirname,*/dirname,rm,*/rm,cp,*/cp,mv,*/mv,cat,*/cat,diff,*/diff,grep,*/grep,date,*/date,test,*/tokudb_dump* --trace-children-skip-by-arg=--only_create,--test,--no-shutdown,novalgrind")
|
2013-04-17 00:00:25 -04:00
|
|
|
function(add_helgrind_test name)
|
|
|
|
if (CMAKE_SYSTEM_NAME MATCHES Darwin OR
|
2013-04-17 00:00:59 -04:00
|
|
|
((CMAKE_CXX_COMPILER_ID MATCHES Intel) AND
|
2013-04-17 00:00:27 -04:00
|
|
|
(CMAKE_BUILD_TYPE MATCHES Release)) OR
|
2013-04-17 00:00:25 -04:00
|
|
|
USE_GCOV)
|
2013-04-17 00:00:27 -04:00
|
|
|
## can't use helgrind on osx or with optimized intel, no point in
|
|
|
|
## using it if we're doing coverage
|
2013-04-17 00:00:25 -04:00
|
|
|
add_test(
|
|
|
|
NAME ${name}
|
|
|
|
COMMAND ${ARGN}
|
|
|
|
)
|
|
|
|
else ()
|
|
|
|
separate_arguments(CMAKE_HELGRIND_COMMAND_STRING)
|
|
|
|
add_test(
|
|
|
|
NAME ${name}
|
|
|
|
COMMAND ${CMAKE_HELGRIND_COMMAND_STRING} ${ARGN}
|
|
|
|
)
|
|
|
|
endif ()
|
|
|
|
endfunction(add_helgrind_test)
|
|
|
|
|
|
|
|
## setup a function to write tests that will run with drd
|
2013-04-17 00:00:31 -04:00
|
|
|
set(CMAKE_DRD_COMMAND_STRING "valgrind --quiet --tool=drd --error-exitcode=1 --suppressions=${TokuDB_SOURCE_DIR}/src/tests/drd.suppressions --trace-children=yes --trace-children-skip=sh,*/sh,basename,*/basename,dirname,*/dirname,rm,*/rm,cp,*/cp,mv,*/mv,cat,*/cat,diff,*/diff,grep,*/grep,date,*/date,test,*/tokudb_dump* --trace-children-skip-by-arg=--only_create,--test,--no-shutdown,novalgrind")
|
2013-04-17 00:00:25 -04:00
|
|
|
function(add_drd_test name)
|
|
|
|
if (CMAKE_SYSTEM_NAME MATCHES Darwin OR
|
2013-04-17 00:00:59 -04:00
|
|
|
((CMAKE_CXX_COMPILER_ID MATCHES Intel) AND
|
2013-04-17 00:00:27 -04:00
|
|
|
(CMAKE_BUILD_TYPE MATCHES Release)) OR
|
2013-04-17 00:00:25 -04:00
|
|
|
USE_GCOV)
|
2013-04-17 00:00:27 -04:00
|
|
|
## can't use drd on osx or with optimized intel, no point in
|
|
|
|
## using it if we're doing coverage
|
2013-04-17 00:00:25 -04:00
|
|
|
add_test(
|
|
|
|
NAME ${name}
|
|
|
|
COMMAND ${ARGN}
|
|
|
|
)
|
2013-04-17 00:00:27 -04:00
|
|
|
else ()
|
2013-04-17 00:00:25 -04:00
|
|
|
separate_arguments(CMAKE_DRD_COMMAND_STRING)
|
|
|
|
add_test(
|
|
|
|
NAME ${name}
|
|
|
|
COMMAND ${CMAKE_DRD_COMMAND_STRING} ${ARGN}
|
|
|
|
)
|
2013-04-17 00:00:27 -04:00
|
|
|
endif ()
|
2013-04-17 00:00:25 -04:00
|
|
|
endfunction(add_drd_test)
|
|
|
|
|
|
|
|
option(RUN_LONG_TESTS "If set, run all tests, even the ones that take a long time to complete." OFF)
|
|
|
|
option(RUN_STRESS_TESTS "If set, run the stress tests." OFF)
|
|
|
|
option(RUN_PERF_TESTS "If set, run the perf tests." OFF)
|
|
|
|
|
|
|
|
configure_file(CTestCustom.cmake . @ONLY)
|
2013-04-17 00:01:05 -04:00
|
|
|
endif (BUILD_TESTING OR BUILD_FT_TESTS)
|