vtk_common.cmake 19.2 KB
Newer Older
Brad King's avatar
Brad King committed
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
# VTK Common Dashboard Script
#
# This script contains basic dashboard driver code common to all
# clients.
#
# Put this script in a directory such as "~/Dashboards/Scripts" or
# "c:/Dashboards/Scripts".  Create a file next to this script, say
# 'my_dashboard.cmake', with code of the following form:
#
#   # Client maintainer: me@mydomain.net
#   set(CTEST_SITE "machine.site")
#   set(CTEST_BUILD_NAME "Platform-Compiler")
#   set(CTEST_CONFIGURATION_TYPE Debug)
#   set(CTEST_CMAKE_GENERATOR "Unix Makefiles")
#   include(${CTEST_SCRIPT_DIRECTORY}/vtk_common.cmake)
#
# Then run a scheduled task (cron job) with a command line such as
#
#   ctest -S ~/Dashboards/Scripts/my_dashboard.cmake -V
#
# By default the source and build trees will be placed in the path
# "../My Tests/" relative to your script location.
#
# The following variables may be set before including this script
# to configure it:
#
#   dashboard_model           = Nightly | Experimental | Continuous
28
#   dashboard_branch_type     = master (default) | release | 5.10
Brad King's avatar
Brad King committed
29
30
31
32
33
34
35
36
#   dashboard_disable_loop    = For continuous dashboards, disable loop.
#   dashboard_root_name       = Change name of "My Tests" directory
#   dashboard_source_name     = Name of source directory (VTK)
#   dashboard_binary_name     = Name of binary directory (VTK-build)
#   dashboard_cache           = Initial CMakeCache.txt file content
#   dashboard_cvs_tag         = CVS tag to checkout (ex: VTK-5-6)
#   dashboard_do_coverage     = True to enable coverage (ex: gcov)
#   dashboard_do_memcheck     = True to enable memcheck (ex: valgrind)
37
#   dashboard_do_superbuild   = True to do a superbuild dashboard.
Brad King's avatar
Brad King committed
38
39
40
41
42
43
44
#   CTEST_UPDATE_COMMAND      = path to svn command-line client
#   CTEST_BUILD_FLAGS         = build tool arguments (ex: -j2)
#   CTEST_DASHBOARD_ROOT      = Where to put source and build trees
#   CTEST_TEST_CTEST          = Whether to run long CTestTest* tests
#   CTEST_TEST_TIMEOUT        = Per-test timeout length
#   CTEST_TEST_ARGS           = ctest_test args (ex: PARALLEL_LEVEL 4)
#   CMAKE_MAKE_PROGRAM        = Path to "make" tool to use
45
46
47
48
#
# These variables may also be set dependent on dashboard_branch setting
# Applicable when dashboard_branch == master
#   dashboard_store_name      = Name of ExternalData store (ExternalData)
49
#   VTK_USE_LARGE_DATA        = True to enable tests using "large" data
50
# Applicable when dashboard_branch == 5.10
51
52
53
54
55
56
#   dashboard_data_name       = Name of data directory (VTKData)
#   dashboard_large_data_name = Name of data directory (VTKLargeData)
#   VTK_DATA_ROOT             = Where to put data tree
#   VTK_LARGE_DATA_ROOT       = Where to put large data tree
#   NO_DATA                   = Don't insist on checking out data trees

Brad King's avatar
Brad King committed
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#
# Options to configure builds from experimental git repository:
#   dashboard_git_url      = Custom git clone url
#   dashboard_git_branch   = Custom remote branch to track
#   dashboard_git_crlf     = Value of core.autocrlf for repository
#
# For Makefile generators the script may be executed from an
# environment already configured to use the desired compilers.
# Alternatively the environment may be set at the top of the script:
#
#   set(ENV{CC}  /path/to/cc)   # C compiler
#   set(ENV{CXX} /path/to/cxx)  # C++ compiler
#   set(ENV{FC}  /path/to/fc)   # Fortran compiler (optional)
#   set(ENV{LD_LIBRARY_PATH} /path/to/vendor/lib) # (if necessary)

#=============================================================================
73
# Copyright 2010-2013 Kitware, Inc.
Brad King's avatar
Brad King committed
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
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
#   notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
#   notice, this list of conditions and the following disclaimer in the
#   documentation and/or other materials provided with the distribution.
#
# * Neither the names of Kitware, Inc., the Insight Software Consortium,
#   nor the names of their contributors may be used to endorse or promote
#   products derived from this software without specific prior written
#   permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================

cmake_minimum_required(VERSION 2.8 FATAL_ERROR)

set(CTEST_PROJECT_NAME VTK)
set(dashboard_user_home "$ENV{HOME}")

110
111
112
113
114
115
116
117
118
119
120
121
122
123
# prepare to do things appropriately for the chosen VTK branch
if (NOT DEFINED dashboard_branch_type)
  set(dashboard_branch_type "master")
endif()
if (dashboard_branch_type STREQUAL "master")
  set(branch_needs_data_repo FALSE)
  if(NOT DEFINED dashboard_git_branch)
    if("${dashboard_model}" STREQUAL "Nightly")
      set(dashboard_git_branch nightly-master )
    else()
      set(dashboard_git_branch master)
    endif()
  endif()
endif()
124
125
if (dashboard_branch_type STREQUAL "release")
  set(branch_needs_data_repo FALSE)
126
127
128
129
130
131
132
133
134
135
136
137
  set (dashboard_branch_type "release")
  if(NOT DEFINED dashboard_git_branch)
    set (dashboard_git_branch "release")
  endif()
endif()
if (dashboard_branch_type STREQUAL "5.10")
  set(branch_needs_data_repo TRUE)
  set (dashboard_branch_type "release-5.10")
  if(NOT DEFINED dashboard_git_branch)
    set (dashboard_git_branch "release-5.10")
  endif()
endif()
138
139
140
141
if(dashboard_do_superbuild)
  set(branch_needs_data_repo FALSE)
  set(dashboard_git_branch unified)
endif()
142

Brad King's avatar
Brad King committed
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# Select the top dashboard directory.
if(NOT DEFINED dashboard_root_name)
  set(dashboard_root_name "My Tests")
endif()
if(NOT DEFINED CTEST_DASHBOARD_ROOT)
  get_filename_component(CTEST_DASHBOARD_ROOT "${CTEST_SCRIPT_DIRECTORY}/../${dashboard_root_name}" ABSOLUTE)
endif()

# Select the model (Nightly, Experimental, Continuous).
if(NOT DEFINED dashboard_model)
  set(dashboard_model Nightly)
endif()
if(NOT "${dashboard_model}" MATCHES "^(Nightly|Experimental|Continuous)$")
  message(FATAL_ERROR "dashboard_model must be Nightly, Experimental, or Continuous")
endif()

# Default to a Debug build.
if(NOT DEFINED CTEST_CONFIGURATION_TYPE AND DEFINED CTEST_BUILD_CONFIGURATION)
  set(CTEST_CONFIGURATION_TYPE ${CTEST_BUILD_CONFIGURATION})
endif()

if(NOT DEFINED CTEST_CONFIGURATION_TYPE)
  set(CTEST_CONFIGURATION_TYPE Debug)
endif()

# Choose CTest reporting mode.
if(NOT "${CTEST_CMAKE_GENERATOR}" MATCHES "Make")
  # Launchers work only with Makefile generators.
  set(CTEST_USE_LAUNCHERS 0)
elseif(NOT DEFINED CTEST_USE_LAUNCHERS)
  # The setting is ignored by CTest < 2.8 so we need no version test.
  set(CTEST_USE_LAUNCHERS 1)
endif()

# Configure testing.
if(NOT DEFINED CTEST_TEST_CTEST)
  set(CTEST_TEST_CTEST 1)
endif()
if(NOT CTEST_TEST_TIMEOUT)
  set(CTEST_TEST_TIMEOUT 1500)
endif()

# Select Git source to use.
if(NOT DEFINED dashboard_git_url)
187
188
189
190
191
  if (dashboard_do_superbuild)
    set(dashboard_git_url "https://github.com/demarle/VTK-superbuild.git")
  else()
    set(dashboard_git_url "git://vtk.org/VTK.git")
  endif()
Brad King's avatar
Brad King committed
192
193
endif()

194
195
196
197
198
199
200
201
202
if (branch_needs_data_repo)
  # Select Git source to use.
  if(NOT DEFINED dashboard_git_data_url)
    set(dashboard_git_data_url "git://vtk.org/VTKData.git")
  endif()

  # Select Git source to use.
  if(NOT DEFINED dashboard_git_large_data_url)
    set(dashboard_git_large_data_url "git://vtk.org/VTKLargeData.git")
Brad King's avatar
Brad King committed
203
204
  endif()
endif()
205

Brad King's avatar
Brad King committed
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
if(NOT DEFINED dashboard_git_crlf)
  if(UNIX)
    set(dashboard_git_crlf false)
  else(UNIX)
    set(dashboard_git_crlf true)
  endif(UNIX)
endif()

# Look for a GIT command-line client.
if(NOT DEFINED CTEST_GIT_COMMAND)
  find_program(CTEST_GIT_COMMAND NAMES git git.exe git.cmd)
endif()

if(NOT EXISTS ${CTEST_GIT_COMMAND})
  message(FATAL_ERROR "No Git Found.")
endif()

# Select a source directory name.
if(NOT DEFINED CTEST_SOURCE_DIRECTORY)
  if(DEFINED dashboard_source_name)
    set(CTEST_SOURCE_DIRECTORY ${CTEST_DASHBOARD_ROOT}/${dashboard_source_name})
  else()
    set(CTEST_SOURCE_DIRECTORY ${CTEST_DASHBOARD_ROOT}/VTK)
  endif()
endif()

# Select a build directory name.
if(NOT DEFINED CTEST_BINARY_DIRECTORY)
  if(DEFINED dashboard_binary_name)
    set(CTEST_BINARY_DIRECTORY ${CTEST_DASHBOARD_ROOT}/${dashboard_binary_name})
236
237
  elseif(dashboard_do_superbuild)
    set(CTEST_SOURCE_DIRECTORY ${CTEST_DASHBOARD_ROOT}/VTKSuperbuild)
Brad King's avatar
Brad King committed
238
239
240
241
242
  else()
    set(CTEST_BINARY_DIRECTORY ${CTEST_SOURCE_DIRECTORY}-build)
  endif()
endif()

243
244
245
246
247
248
249
250
251
# Select a regression test data location
if (NOT branch_needs_data_repo)
  # Select a data store.
  if(NOT DEFINED ExternalData_OBJECT_STORES)
    if(DEFINED dashboard_store_name)
      set(ExternalData_OBJECT_STORES ${CTEST_DASHBOARD_ROOT}/${dashboard_store_name})
    else()
      set(ExternalData_OBJECT_STORES ${CTEST_DASHBOARD_ROOT}/ExternalData)
    endif()
252
253
  endif()

254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
  if(NOT DEFINED VTK_USE_LARGE_DATA)
    set(VTK_USE_LARGE_DATA ON)
  endif()

else (NOT branch_needs_data_repo)
  # find/checkout data repositories
  if (DEFINED NO_DATA)

    set(VTK_DATA_ROOT "VTK_DATA_ROOT-NOTFOUND")
    set(VTK_LARGE_DATA_ROOT "VTK_DATA_ROOT-NOTFOUND")

  else(DEFINED NO_DATA)

    # VTK data
    if(NOT DEFINED VTK_DATA_ROOT)
      if(DEFINED dashboard_data_name)
        set(VTK_DATA_ROOT ${CTEST_DASHBOARD_ROOT}/${dashboard_data_name})
      else()
        set(VTK_DATA_ROOT ${CTEST_SOURCE_DIRECTORY}Data)
      endif()
    endif()
    # Do initial checkout if doesn't exist yet
    if(DEFINED VTK_DATA_ROOT AND NOT EXISTS "${VTK_DATA_ROOT}")
      get_filename_component(_name "${VTK_DATA_ROOT}" NAME)
      execute_process(
        COMMAND "${CTEST_GIT_COMMAND}" clone "${dashboard_git_data_url}" "${VTK_DATA_ROOT}")
      execute_process(
        COMMAND "${CTEST_GIT_COMMAND}" checkout -b
	"${dashboard_branch_type}" "origin/${dashboard_branch_type}"
        WORKING_DIRECTORY "${VTK_DATA_ROOT}")
    endif()

    # Large Data
    if(NOT DEFINED VTK_LARGE_DATA_ROOT AND NOT DEFINED NO_DATA)
      if(DEFINED dashboard_data_name)
        set(VTK_LARGE_DATA_ROOT ${CTEST_DASHBOARD_ROOT}/${dashboard_large_data_name})
      else()
        set(VTK_LARGE_DATA_ROOT ${CTEST_SOURCE_DIRECTORY}LargeData)
      endif()
    endif()
    # Do initial checkout if doesn't exist yet
    if(DEFINED VTK_LARGE_DATA_ROOT AND NOT EXISTS "${VTK_LARGE_DATA_ROOT}")
      get_filename_component(_name "${VTK_LARGE_DATA_ROOT}" NAME)
      execute_process(
        COMMAND "${CTEST_GIT_COMMAND}" clone "${dashboard_git_large_data_url}" "${VTK_LARGE_DATA_ROOT}")
      execute_process(
        COMMAND "${CTEST_GIT_COMMAND}" checkout -b
	"${dashboard_branch_type}" "origin/${dashboard_branch_type}"
        WORKING_DIRECTORY "${VTK_LARGE_DATA_ROOT}")
    endif()
  endif(DEFINED NO_DATA)

endif (NOT branch_needs_data_repo)
307

Brad King's avatar
Brad King committed
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
# Delete source tree if it is incompatible with current VCS.
if(EXISTS ${CTEST_SOURCE_DIRECTORY})
  if(CTEST_GIT_COMMAND)
    if(NOT EXISTS "${CTEST_SOURCE_DIRECTORY}/.git")
      set(vcs_refresh "because it is not managed by git.")
    endif()
  endif()
  if(vcs_refresh AND "${CTEST_SOURCE_DIRECTORY}" MATCHES "/VTK[^/]*")
    message("Deleting source tree\n  ${CTEST_SOURCE_DIRECTORY}\n${vcs_refresh}")
    file(REMOVE_RECURSE "${CTEST_SOURCE_DIRECTORY}")
  endif()
endif()

# Support initial checkout if necessary.
if(NOT EXISTS "${CTEST_SOURCE_DIRECTORY}" AND NOT DEFINED CTEST_CHECKOUT_COMMAND)
  get_filename_component(_name "${CTEST_SOURCE_DIRECTORY}" NAME)
  if(CTEST_GIT_COMMAND)
    execute_process(COMMAND ${CTEST_GIT_COMMAND} --version OUTPUT_VARIABLE output)
    string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+(\\.[0-9]+(\\.g[0-9a-f]+)?)?" GIT_VERSION "${output}")
    if(NOT "${GIT_VERSION}" VERSION_LESS "1.6.5")
      # Have "git clone -b <branch>" option.
      set(git_branch_new "-b ${dashboard_git_branch}")
      set(git_branch_old)
    else()
      # No "git clone -b <branch>" option.
      set(git_branch_new)
      set(git_branch_old "-b ${dashboard_git_branch} origin/${dashboard_git_branch}")
    endif()

    # Generate an initial checkout script.
    set(ctest_checkout_script ${CTEST_DASHBOARD_ROOT}/${_name}-init.cmake)
    file(WRITE ${ctest_checkout_script} "# git repo init script for ${_name}
execute_process(
  COMMAND \"${CTEST_GIT_COMMAND}\" clone -n ${git_branch_new} \"${dashboard_git_url}\"
          \"${CTEST_SOURCE_DIRECTORY}\"
  )
if(EXISTS \"${CTEST_SOURCE_DIRECTORY}/.git\")
  execute_process(
    COMMAND \"${CTEST_GIT_COMMAND}\" config core.autocrlf ${dashboard_git_crlf}
    WORKING_DIRECTORY \"${CTEST_SOURCE_DIRECTORY}\"
    )
  execute_process(
    COMMAND \"${CTEST_GIT_COMMAND}\" checkout ${git_branch_old}
    WORKING_DIRECTORY \"${CTEST_SOURCE_DIRECTORY}\"
    )
  execute_process(
    COMMAND \"${CTEST_GIT_COMMAND}\" submodule init
    WORKING_DIRECTORY \"${CTEST_SOURCE_DIRECTORY}\"
    )
  execute_process(
    COMMAND \"${CTEST_GIT_COMMAND}\" submodule update --
    WORKING_DIRECTORY \"${CTEST_SOURCE_DIRECTORY}\"
    )
endif()
")
    set(CTEST_CHECKOUT_COMMAND "\"${CMAKE_COMMAND}\" -P \"${ctest_checkout_script}\"")
  endif()
  # CTest delayed initialization is broken, so we put the
  # CTestConfig.cmake info here.
  set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC")
  set(CTEST_DROP_METHOD "http")
369
370
  set(CTEST_DROP_SITE "open.cdash.org")
  set(CTEST_DROP_LOCATION "/submit.php?project=VTK")
Brad King's avatar
Brad King committed
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
  set(CTEST_DROP_SITE_CDASH TRUE)
endif()

#-----------------------------------------------------------------------------

# Send the main script as a note.
list(APPEND CTEST_NOTES_FILES
  "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}"
  "${CMAKE_CURRENT_LIST_FILE}"
  )

# Check for required variables.
foreach(req
    CTEST_CMAKE_GENERATOR
    CTEST_SITE
    CTEST_BUILD_NAME
    )
  if(NOT DEFINED ${req})
    message(FATAL_ERROR "The containing script must set ${req}")
  endif()
endforeach(req)

# Print summary information.
foreach(v
    CTEST_SITE
    CTEST_BUILD_NAME
    CTEST_SOURCE_DIRECTORY
    CTEST_BINARY_DIRECTORY
    CTEST_CMAKE_GENERATOR
    CTEST_CONFIGURATION_TYPE
    CTEST_CVS_COMMAND
    CTEST_GIT_COMMAND
    CTEST_CHECKOUT_COMMAND
    CTEST_SCRIPT_DIRECTORY
    CTEST_USE_LAUNCHERS
406
    ExternalData_OBJECT_STORES
407
408
409
    VTK_DATA_ROOT
    VTK_LARGE_DATA_ROOT
    NO_DATA
Brad King's avatar
Brad King committed
410
    )
411
412
413
  if (DEFINED ${v})
    set(vars "${vars}  ${v}=[${${v}}]\n")
  endif()
Brad King's avatar
Brad King committed
414
415
416
417
418
419
420
421
422
423
endforeach(v)
message("Dashboard script configuration:\n${vars}\n")

# Avoid non-ascii characters in tool output.
set(ENV{LC_ALL} C)

# Helper macro to write the initial cache.
macro(write_cache)
  set(cache_build_type "")
  set(cache_make_program "")
424
425
426
427
428
429
430
431
432
433
434
  if (NOT branch_needs_data_repo)
    set(data_options"
ExternalData_OBJECT_STORES:STRING=${ExternalData_OBJECT_STORES}
VTK_USE_LARGE_DATA:BOOL=${VTK_USE_LARGE_DATA}
")
  else()
    set(data_options"
VTK_DATA_ROOT:PATH=${VTK_DATA_ROOT}
VTK_LARGE_DATA_ROOT:PATH=${VTK_LARGE_DATA_ROOT}
")
  endif()
Brad King's avatar
Brad King committed
435
436
437
438
439
440
441
442
443
444
445
  if(CTEST_CMAKE_GENERATOR MATCHES "Make")
    set(cache_build_type CMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE})
    if(CMAKE_MAKE_PROGRAM)
      set(cache_make_program CMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_MAKE_PROGRAM})
    endif()
  endif()
  file(WRITE ${CTEST_BINARY_DIRECTORY}/CMakeCache.txt "
SITE:STRING=${CTEST_SITE}
BUILDNAME:STRING=${CTEST_BUILD_NAME}
CTEST_USE_LAUNCHERS:BOOL=${CTEST_USE_LAUNCHERS}
DART_TESTING_TIMEOUT:STRING=${CTEST_TEST_TIMEOUT}
446
${data_options}
Brad King's avatar
Brad King committed
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
${cache_build_type}
${cache_make_program}
${dashboard_cache}
")
endmacro(write_cache)

# Start with a fresh build tree.
file(MAKE_DIRECTORY "${CTEST_BINARY_DIRECTORY}")
if(NOT "${CTEST_SOURCE_DIRECTORY}" STREQUAL "${CTEST_BINARY_DIRECTORY}")
  message("Clearing build tree...")
  ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY})
endif()

set(dashboard_continuous 0)
if("${dashboard_model}" STREQUAL "Continuous")
  set(dashboard_continuous 1)
endif()

# CTest 2.6 crashes with message() after ctest_test.
macro(safe_message)
  if(NOT "${CMAKE_VERSION}" VERSION_LESS 2.8 OR NOT safe_message_skip)
    message(${ARGN})
  endif()
endmacro()

if(COMMAND dashboard_hook_init)
  dashboard_hook_init()
endif()

set(dashboard_done 0)
while(NOT dashboard_done)
  if(dashboard_continuous)
    set(START_TIME ${CTEST_ELAPSED_TIME})
  endif()
  set(ENV{HOME} "${dashboard_user_home}")

  # Start a new submission.
  if(COMMAND dashboard_hook_start)
    dashboard_hook_start()
  endif()
  ctest_start(${dashboard_model})
488
489
490
  if(COMMAND dashboard_hook_started)
    dashboard_hook_started()
  endif()
Brad King's avatar
Brad King committed
491
492
493
494
495
496
497
498

  # Always build if the tree is fresh.
  set(dashboard_fresh 0)
  if(NOT EXISTS "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt")
    set(dashboard_fresh 1)
    safe_message("Starting fresh build...")
    write_cache()
  endif()
499

Brad King's avatar
Brad King committed
500
  # Look for updates.
501
502
503
504
505
506
507
508
509
  if(branch_needs_data_repo AND NOT DEFINED NO_DATA)
    if(DEFINED VTK_DATA_ROOT)
      ctest_update(SOURCE "${VTK_DATA_ROOT}")
    endif()
    if(DEFINED VTK_LARGE_DATA_ROOT)
      ctest_update(SOURCE "${VTK_LARGE_DATA_ROOT}")
    endif()
  endif()

Brad King's avatar
Brad King committed
510
511
512
513
514
  ctest_update(RETURN_VALUE count)
  set(CTEST_CHECKOUT_COMMAND) # checkout on first iteration only
  safe_message("Found ${count} changed files")

  if(dashboard_fresh OR NOT dashboard_continuous OR count GREATER 0)
515

Brad King's avatar
Brad King committed
516
    ctest_configure()
517

Brad King's avatar
Brad King committed
518
519
520
521
522
523
524
525
526
527
528
529
530
531
    ctest_submit(PARTS Update Configure Notes)
    ctest_read_custom_files(${CTEST_BINARY_DIRECTORY})

    if(COMMAND dashboard_hook_build)
      dashboard_hook_build()
    endif()
    ctest_build(APPEND)
    ctest_submit(PARTS Build)

    if(COMMAND dashboard_hook_test)
      dashboard_hook_test()
    endif()
    ctest_test(${CTEST_TEST_ARGS} APPEND)
    ctest_submit(PARTS Test)
532
    set(safe_message_skip 1) # Block further messages
Brad King's avatar
Brad King committed
533
534
535
536
537

    if(dashboard_do_coverage)
      ctest_coverage()
      ctest_submit(PARTS Coverage)
    endif()
538

Brad King's avatar
Brad King committed
539
540
541
542
    if(dashboard_do_memcheck)
      ctest_memcheck(${CTEST_TEST_ARGS})
      ctest_submit(PARTS MemCheck)
    endif()
543

544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
    if(dashboard_do_superbuild)
      # not sure if I can make platform tests here so just globbing
      # for all expected archive types.
      file(GLOB tar_balls ${CTEST_BINARY_DIRECTORY}/*.tar.gz)
      file(GLOB tar_balls_2 ${CTEST_BINARY_DIRECTORY}/*.tgz)
      file(GLOB dmgs ${CTEST_BINARY_DIRECTORY}/*.dmg)
      file(GLOB exes ${CTEST_BINARY_DIRECTORY}/*.exe)
      file(GLOB zips ${CTEST_BINARY_DIRECTORY}/*.zip)
      set (files ${tar_balls} ${tar_balls_2} ${dmgs} ${exes} ${zips})
      if (files)
        ctest_upload(FILES ${files})
        ctest_submit(PARTS Upload)
      endif()
    endif()

Brad King's avatar
Brad King committed
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
    if(COMMAND dashboard_hook_submit)
      dashboard_hook_submit()
    endif()
    if(COMMAND dashboard_hook_end)
      dashboard_hook_end()
    endif()
  endif()

  if(dashboard_continuous AND NOT dashboard_disable_loop)
    # Delay until at least 5 minutes past START_TIME
    ctest_sleep(${START_TIME} 300 ${CTEST_ELAPSED_TIME})
    if(${CTEST_ELAPSED_TIME} GREATER 57600)
      set(dashboard_done 1)
    endif()
  else()
    # Not continuous, so we are done.
    set(dashboard_done 1)
  endif()
endwhile()