This repository has been archived by the owner on Feb 19, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfarm.medu.se.ctest
167 lines (142 loc) · 4.49 KB
/
farm.medu.se.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
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# =============================
# = farm.medu.se CTest script =
# =============================
# This file should be included from a project specific script
# ------------
# - Cleaning -
# ------------
if ("${MODEL}" STREQUAL "")
set(MODEL "Experimental")
endif()
if ("${PROJECT_NAME}" STREQUAL "")
message(FATAL_ERROR "Missing PROJECT_NAME")
endif()
if ("${GITHUB_PROJECT}" STREQUAL "")
set(GITHUB_PROJECT "${PROJECT_NAME}")
endif()
if ("${GITHUB_ACCOUNT}" STREQUAL "")
set(GITHUB_ACCOUNT "LaKabane")
endif()
if ("${GIT_BRANCH}" STREQUAL "")
set(GIT_BRANCH "master")
endif()
if ("${OS_NAME}" STREQUAL "")
message(FATAL_ERROR "Missing OS_NAME")
endif()
if ("${OS_VERSION}" STREQUAL "")
message(FATAL_ERROR "Missing OS_VERSION")
endif()
if ("${ARCH_NAME}" STREQUAL "")
message(FATAL_ERROR "Missing ARCH_NAME")
endif()
if ("${COMPILER_NAME}" STREQUAL "")
message(FATAL_ERROR "Missing COMPILER_NAME")
endif()
if ("${COMPILER_VERSION}" STREQUAL "")
message(FATAL_ERROR "Missing COMPILER_VERSION")
endif()
string(REPLACE "/" "_" CLEANED_GIT_BRANCH ${GIT_BRANCH})
# -----------------
# - CTest Options -
# -----------------
set(CTEST_DASHBOARD_ROOT "$ENV{HOME}/build")
set(CTEST_PROJECT_DIRECTORY "${PROJECT_NAME}-${CLEANED_GIT_BRANCH}")
set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_PROJECT_DIRECTORY}")
set(CTEST_BINARY_DIRECTORY
"${CTEST_DASHBOARD_ROOT}/${CTEST_PROJECT_DIRECTORY}-build")
# --------------------------
# - CTest Host Environment -
# --------------------------
set(${CMAKE_SYSTEM_NAME} True)
# Craft GitHub URL
set(GITHUB "git://github.com/${GITHUB_ACCOUNT}/${GITHUB_PROJECT}.git")
# Find make XXX: This UNIXish
find_program(MAKE NAMES make)
# Find git
find_program(CTEST_GIT_COMMAND NAMES git)
set(CTEST_CHECKOUT_COMMAND
"${CTEST_GIT_COMMAND} clone --branch ${GIT_BRANCH} ${GITHUB} ${CTEST_PROJECT_DIRECTORY}")
set(CTEST_UPDATE_COMMAND "${CTEST_GIT_COMMAND}")
# Find optional programs
if (Linux)
find_program(CTEST_COVERAGE_COMMAND NAMES gcov)
find_program(CTEST_MEMORYCHECK_COMMAND NAMES valgrind)
endif(Linux)
# Hostname
find_program(HOSTNAME_CMD NAMES hostname)
exec_program(${HOSTNAME_CMD} ARGS OUTPUT_VARIABLE HOSTNAME)
set(CTEST_SITE "${HOSTNAME}")
# Build name
set(CTEST_BUILD_NAME "${OS_NAME}-${OS_VERSION}-${ARCH_NAME}-${COMPILER_NAME}-${COMPILER_VERSION}-${GIT_BRANCH}")
# CMake generation
if (UNIX)
set(CTEST_CMAKE_GENERATOR "Unix Makefiles")
else (WIN32)
set(CTEST_CMAKE_GENERATOR "Visual Studio")
endif ()
set(CTEST_CONFIGURE_COMMAND
"${CMAKE_COMMAND} \"-DCMAKE_C_COMPILER=${COMPILER_NAME}\"")
set(CTEST_CONFIGURE_COMMAND "${CTEST_CONFIGURE_COMMAND} ${CONFIGURE_COMMAND}")
set(CTEST_CONFIGURE_COMMAND "${CTEST_CONFIGURE_COMMAND} \"-G${CTEST_CMAKE_GENERATOR}\"")
set(CTEST_CONFIGURE_COMMAND "${CTEST_CONFIGURE_COMMAND} \"${CTEST_SOURCE_DIRECTORY}\"")
# make options
set(CTEST_BUILD_COMMAND "${MAKE} ${OPTION_BUILD}")
# -----------------
# - CDash Options -
# -----------------
set(CTEST_PROJECT_NAME "${PROJECT_NAME}")
set(CTEST_NIGHTLY_START_TIME "00:00:00 EST")
set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "farm.medu.se")
set(CTEST_DROP_LOCATION "/submit.php?project=${PROJECT_NAME}")
set(CTEST_DROP_SITE_CDASH TRUE)
# ---------------
# - Ctest rules -
# ---------------
if (NOT EXISTS "${CTEST_SOURCE_DIRECTORY}")
message(" -- Clone ${GITHUB} branch ${GIT_BRANCH} --")
else()
# Prevent CTest from failling here
set(CTEST_CHECKOUT_COMMAND "true")
endif()
message(" -- Start ${MODEL}-${CTEST_BUILD_NAME} --")
ctest_start(${MODEL})
# This line totally wipe out the build directory
ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY})
message(" -- Update ${GIT_BRANCH} --")
ctest_update(RETURN_VALUE RET)
if (${RET} EQUAL -1)
message(" -- Can't update --")
endif()
if (${RET} EQUAL 0)
message(" -- Configure --")
ctest_configure(RETURN_VALUE RET)
if (${RET} EQUAL -1)
message(" -- Can't configure --")
endif()
endif()
if (${RET} EQUAL 0)
message(" -- Build --")
ctest_build(RETURN_VALUE RET)
if (${RET} EQUAL -1)
message(" -- Can't build --")
endif()
endif()
if (${RET} EQUAL 0)
message(" -- Test --")
ctest_test(RETURN_VALUE RET)
if (${RET} EQUAL -1)
message(" -- Can't test --")
endif()
endif()
if (WITH_MEMCHECK AND CTEST_COVERAGE_COMMAND)
message(" -- Coverage (optional) --")
ctest_coverage()
endif (WITH_MEMCHECK AND CTEST_COVERAGE_COMMAND)
if (WITH_MEMCHECK AND CTEST_MEMORYCHECK_COMMAND)
message(" -- Memcheck (optional) --")
ctest_memcheck()
endif()
message(" -- Submit --")
ctest_submit(RETURN_VALUE)
message(" -- Done --")