-
Notifications
You must be signed in to change notification settings - Fork 36
/
.travis.ctest
52 lines (39 loc) · 1.52 KB
/
.travis.ctest
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
string(SUBSTRING "$ENV{TRAVIS_COMMIT}" 0 7 COMMIT_ID)
set(CTEST_SITE "travis")
set(CTEST_BUILD_NAME "$ENV{TRAVIS_JOB_NUMBER}-${COMMIT_ID}-$ENV{TRAVIS_OS_NAME}-$ENV{CXX}")
set(CTEST_SOURCE_DIRECTORY "$ENV{TRAVIS_BUILD_DIR}")
set(CTEST_BINARY_DIRECTORY "${CTEST_SOURCE_DIRECTORY}/build")
configure_file(${CTEST_SOURCE_DIRECTORY}/.travis.cfg.in ${CTEST_BINARY_DIRECTORY}/travis.cfg)
set(CTEST_NOTES_FILES ${CTEST_BINARY_DIRECTORY}/travis.cfg)
set(CTEST_CMAKE_GENERATOR "Unix Makefiles")
set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_BUILD_TYPE}")
set(CTEST_CONFIGURATION_TYPE "Debug")
find_program(CLANG_CHECK clang-check)
find_program(VALGRIND valgrind)
set(CTEST_MEMORYCHECK_COMMAND ${VALGRIND})
set(CTEST_MEMORYCHECK_COMMAND_OPTIONS "-q --track-origins=yes --leak-check=yes --show-reachable=yes --num-callers=50")
set(CTEST_MEMORYCHECK_SUPPRESSIONS_FILE ${CTEST_SOURCE_DIRECTORY}/.valgrind.supp)
if($ENV{CXX} MATCHES "g\\+\\+")
find_program(GCOV_BINARY $ENV{GCOV})
set(CTEST_COVERAGE_COMMAND ${GCOV_BINARY})
set(COVERAGE_EXTRA_FLAGS "-l -p")
set(BUILD_COVERAGE ON)
else()
set(BUILD_COVERAGE OFF)
endif()
ctest_start(Continuous)
ctest_configure(OPTIONS "-DBUILD_COVERAGE=$BUILD_COVERAGE")
ctest_build()
if(CLANG_CHECK AND $ENV{CXX} MATCHES "clang")
ctest_build(TARGET check)
endif()
ctest_test(RETURN_VALUE tests_ret)
if(VALGRIND AND $ENV{CXX} MATCHES "clang")
ctest_memcheck()
endif()
if(GCOV AND $ENV{CXX} MATCHES "g\\+\\+")
ctest_coverage()
endif()
if(NOT tests_ret EQUAL 0)
message(FATAL_ERROR "Test had failures!")
endif()