-
Notifications
You must be signed in to change notification settings - Fork 96
/
FairRoot_build_test.cmake
83 lines (71 loc) · 2.55 KB
/
FairRoot_build_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
################################################################################
# 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()
show_jenkins_info()
ctest_start(Continuous)
get_filename_component(test_install_prefix "${CTEST_BINARY_DIRECTORY}/install"
ABSOLUTE)
list(APPEND options
"-Werror=dev"
"-DDISABLE_COLOR=ON"
"-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()
fairroot_ctest_submit(FINAL)
fairroot_summary_cdash()
if(_ctest_test_ret_val)
Message(FATAL_ERROR "Some tests failed.")
endif()