forked from FairRootGroup/FairRoot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FairRoot_profile_test.cmake
99 lines (82 loc) · 2.9 KB
/
FairRoot_profile_test.cmake
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
################################################################################
# Copyright (C) 2021-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
# #
# This software is distributed under the terms of the #
# GNU Lesser General Public Licence (LGPL) version 3, #
# copied verbatim in the file "LICENSE" #
################################################################################
list(PREPEND CMAKE_MODULE_PATH "cmake/private")
include(Testlib)
fairroot_ctest_setup()
set(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 102400)
set(CTEST_CONFIGURATION_TYPE "RelWithDebInfo")
get_NCPUS()
get_os_name_release()
if ("$ENV{LABEL}" STREQUAL "")
set(CTEST_BUILD_NAME "build")
else()
set(CTEST_BUILD_NAME $ENV{LABEL})
endif()
find_program(GCOV_COMMAND gcov)
if(GCOV_COMMAND)
message("Found GCOV: ${GCOV_COMMAND}")
set(CTEST_COVERAGE_COMMAND ${GCOV_COMMAND})
endif(GCOV_COMMAND)
show_jenkins_info()
ctest_read_custom_files(${CTEST_SOURCE_DIRECTORY})
ctest_start(Continuous)
get_filename_component(test_install_prefix "${CTEST_BINARY_DIRECTORY}/install"
ABSOLUTE)
list(APPEND options
"-Werror=dev"
"-DDISABLE_COLOR=ON"
"-DCMAKE_BUILD_TYPE=PROFILE"
"-DBUILD_EXAMPLES=OFF"
"-DCMAKE_INSTALL_PREFIX:PATH=${test_install_prefix}"
)
if ((NOT DEFINED BUILD_MBS) OR BUILD_MBS)
list(APPEND options "-DBUILD_MBS=ON")
endif()
if ((NOT DEFINED BUILD_PROOF_SUPPORT) OR BUILD_PROOF_SUPPORT)
list(APPEND options "-DBUILD_PROOF_SUPPORT=ON")
endif()
if ((NOT DEFINED BUILD_EVENT_BUILDER) OR BUILD_EVENT_BUILDER)
list(APPEND options "-DBUILD_EVENT_BUILDER=ON")
endif()
if (USE_CLANG_TIDY)
list(APPEND options "-DCMAKE_CXX_CLANG_TIDY=clang-tidy")
endif()
if (ENABLE_GEANT3_TESTING)
list(APPEND options "-DENABLE_GEANT3_TESTING=ON")
endif()
ctest_configure(OPTIONS "${options}")
ctest_build(FLAGS "-j${NCPUS}" TARGET install
NUMBER_ERRORS _ctest_build_num_errs
RETURN_VALUE _ctest_build_ret_val)
unset(repeat)
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.17)
if ("$ENV{CHANGE_ID}" STREQUAL "")
# Branch build
set(repeat REPEAT UNTIL_PASS:7)
endif()
endif()
if(_ctest_build_ret_val OR _ctest_build_num_errs)
message(STATUS "Skipping tests, because build failed"
" (return value: ${_ctest_build_ret_val},"
" number of errors: ${_ctest_build_num_errs})")
set(_ctest_test_ret_val -1)
else()
ctest_test(BUILD "${CTEST_BINARY_DIRECTORY}"
PARALLEL_LEVEL 4
SCHEDULE_RANDOM ON
${repeat}
RETURN_VALUE _ctest_test_ret_val)
endif()
If(GCOV_COMMAND)
ctest_coverage(BUILD "${CTEST_BINARY_DIRECTORY}")
EndIf()
fairroot_ctest_submit(FINAL)
fairroot_summary_cdash()
if(_ctest_test_ret_val)
Message(FATAL_ERROR "Some tests failed.")
endif()