-
Notifications
You must be signed in to change notification settings - Fork 89
/
Copy pathdashboard_script.cmake
95 lines (83 loc) · 3.08 KB
/
dashboard_script.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
# DO NOT CUSTOMIZE THIS FILE DIRECTLY!
# You can provide overrides/customizations in the file
# dashboardCustomSettings.cmake.
# parse var=val options
foreach(var_val IN LISTS CTEST_SCRIPT_ARG)
if(var_val MATCHES "([^=]+)=(.*)")
set(${CMAKE_MATCH_1} "${CMAKE_MATCH_2}")
else()
message(FATAL_ERROR
"Invalid argument ${var_val}. "
"Arguments must be of the form <var>=<value>")
endif()
endforeach()
foreach(var CTEST_BUILD_NAME DASHBOARD_TYPE CTEST_NIGHTLY_START_TIME)
if(NOT DEFINED "${var}")
message(FATAL_ERROR
"The variable ${var} is not defined on the command line.")
endif()
endforeach()
# convenience variables
set(_custom_settings_file
"${CTEST_SCRIPT_DIRECTORY}/dashboardCustomSettings.cmake")
set(_initcache_file
"${CTEST_SCRIPT_DIRECTORY}/dashboardInitialCache.cmake")
set(_custom_initcache_file
"${CTEST_SCRIPT_DIRECTORY}/dashboardCustomInitialCache.cmake")
# basic default settings
set(CTEST_SITE "$ENV{HOST}")
get_filename_component(CTEST_SOURCE_DIRECTORY "${CTEST_SCRIPT_DIRECTORY}" PATH)
set(CTEST_BINARY_DIRECTORY "${CTEST_SOURCE_DIRECTORY}/dashboard-build")
set(CTEST_CMAKE_GENERATOR "Unix Makefiles")
set(CTEST_CONFIGURATION_TYPE Release)
set(CTEST_COMMAND "/usr/bin/ctest")
#set(CTEST_UPDATE_COMMAND "/usr/bin/git")
# include the settings customization file
include("${_custom_settings_file}" OPTIONAL)
if(NOT EXISTS "${_initcache_file}")
message(FATAL_ERROR "${_initcache_file} does not exist.")
endif()
set(CTEST_NOTES_FILES
"${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}"
"${_initcache_file}")
if(EXISTS "${_custom_initcache_file}")
list(APPEND CTEST_NOTES_FILES "${_custom_initcache_file}")
endif()
set(CTEST_USE_LAUNCHERS TRUE)
# Want en_US ASCII output from tools
set(ENV{LC_ALL} C)
while(1)
ctest_empty_binary_directory("${CTEST_BINARY_DIRECTORY}")
ctest_start("${DASHBOARD_TYPE}")
if(CTEST_UPDATE_COMMAND AND NOT DASHBOARD_TYPE STREQUAL "Experimental")
ctest_update(SOURCE "${CTEST_SOURCE_DIRECTORY}" RETURN_VALUE result)
endif()
# Only proceed if we updated a file or if we're not a continuous build
set(BUILD_AND_TEST FALSE)
if(NOT DASHBOARD_TYPE STREQUAL "Continuous")
message(STATUS "Not a continuous dashboard, will build and test.")
set(BUILD_AND_TEST TRUE)
elseif(result GREATER 0)
message(STATUS "One or more files were updated, will build and test.")
set(BUILD_AND_TEST TRUE)
endif()
if(BUILD_AND_TEST)
ctest_configure(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE result
OPTIONS "-DCTEST_BUILD_NAME=${CTEST_BUILD_NAME};-C${_initcache_file}")
if(result EQUAL 0)
# Only try to build if we could configure
ctest_build(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE result)
endif()
if(result EQUAL 0)
# Only try to test if we could build
ctest_test(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE result)
endif()
# Always submit results
ctest_submit()
endif()
if(DASHBOARD_TYPE STREQUAL "Continuous")
ctest_sleep(300)
else()
break()
endif()
endwhile()