fix codding convention violations (Markus H & Alex B)
[u/mrichter/AliRoot.git] / test / continuous-build.cmake
CommitLineData
eee962e6 1#****Macros****
2find_program(UNAME NAMES uname)
3macro(getuname name flag)
4 exec_program("${UNAME}" ARGS "${flag}" OUTPUT_VARIABLE "${name}")
5endmacro(getuname)
6
7#****Configuration Variables****
8#Set Project Name
9set(CTEST_PROJECT_NAME "AliRoot")
10set(ALICE_ROOT $ENV{ALICE_ROOT})
11set(ALICE_INSTALL $ENV{ALICE_INSTALL})
12
13if(NOT ALICE_INSTALL)
14message(FATAL_ERROR "Please set environment variable ALICE_INSTALL to the AliRoot installation directory")
15endif(NOT ALICE_INSTALL)
16if(NOT ALICE_ROOT)
17message(FATAL_ERROR "Please set environment variable ALICE_ROOT to the AliRoot source directory")
18endif(NOT ALICE_ROOT)
19
20#Set hostname of current machine
21find_program(HOSTNAME_CMD NAMES hostname)
22exec_program(${HOSTNAME_CMD} ARGS OUTPUT_VARIABLE HOSTNAME)
23set(CTEST_SITE "${HOSTNAME}")
24
25#Set build name
26getuname(osname -s)
27getuname(osrel -r)
28getuname(cpu -m)
29set(CTEST_BUILD_NAME "${osname}-${cpu}-prod")
30
31#Detect SVN and Make
32find_program(CTEST_SVN_COMMAND NAMES svn)
33find_program(MAKE NAMES make)
34find_program(CTEST_MEMORYCHECK_COMMAND NAMES valgrind)
35set(CTEST_MEMORYCHECK_COMMAND_OPTIONS "--leak-check=full --error-limit=yes --leak-resolution=low")
36
37#AliRoot Repository and build settings
38set(ALICE_REPO "https://alisoft.cern.ch/AliRoot/trunk")
39set(MODEL "Continuous")
40
41
42#Set Nightly build start time
43set(CTEST_NIGHTLY_START_TIME "00:00:00 EST")
44set(CTEST_TEST_TIMEOUT 0)
45#Default drop site
46set(CTEST_DROP_METHOD "http")
47set(CTEST_DROP_SITE "alirootbuildcmake.cern.ch")
48set(CTEST_DROP_LOCATION "/~johny/submit.php?project=AliRoot")
49set(CTEST_DROP_SITE_CDASH TRUE)
50
51set(OLDREV 0)
52set(NEWREV 0)
53set(CYCLE 0)
54set(CLEARCYCLE 5)
55set(TESTCYCLE 2)
56#Get Revision
57execute_process(COMMAND svn info ${ALICE_ROOT} OUTPUT_VARIABLE _svn_out )
58string(REGEX REPLACE "^.*Revision: ([^\n]*).*$" "\\1" ALIROOT_SVN_REVISION ${_svn_out})
59set(OLDREV ${ALIROOT_SVN_REVISION})
60set(NEWREV ${ALIROOT_SVN_REVISION})
61message("Starting build of revision ${OLDREV}")
62#Setup Directories
63set(CTEST_BINARY_DIRECTORY "${ALICE_INSTALL}")
64set(CTEST_SOURCE_DIRECTORY "${ALICE_ROOT}")
65set(CTEST_DASHBOARD_ROOT "$ENV{HOME}/Dashboards")
66# set(CTEST_CHECKOUT_COMMAND "${CTEST_SVN_COMMAND} co ${ALICE_REPO} $ENV{ALICE_ROOT}")
67set(CTEST_UPDATE_COMMAND "${CTEST_SVN_COMMAND}")
68set(CTEST_CMAKE_COMMAND "\"${CMAKE_EXECUTABLE_NAME}\" -D Continuous")
69
70#CMake Generator
71set(CTEST_CMAKE_GENERATOR "Unix Makefiles")
72
73message("Continuous Build Starting")
74
75#****Testing Process****
76while (${CTEST_ELAPSED_TIME} LESS 36000)
77
78 set (START_TIME ${CTEST_ELAPSED_TIME})
79 ctest_start (Continuous)
80
81 #Build only if new revision of source is available
82 while(${OLDREV} EQUAL ${NEWREV} AND ${CYCLE} GREATER 0)
83 message("Updating source")
84 message("Current revision : ${OLDREV}")
85 ctest_update(BUILD "${CTEST_SOURCE_DIRECTORY}")
86 execute_process(COMMAND svn info ${ALICE_ROOT} OUTPUT_VARIABLE _svn_out)
87 string(REGEX REPLACE "^.*Revision: ([^\n]*).*$" "\\1" ALIROOT_SVN_REVISION ${_svn_out})
88 set(NEWREV ${ALIROOT_SVN_REVISION})
89 message("New revision : ${NEWREV}")
90 if(${OLDREV} EQUAL ${NEWREV})
91 message("Source not updated, no need to build source")
92 ctest_sleep(300)
93 endif(${OLDREV} EQUAL ${NEWREV})
94 endwhile()
f04bc3d4 95 ctest_submit (PARTS Update)
eee962e6 96 set(OLDREV ${NEWREV})
97 math(EXPR CYCLE "${CYCLE} + 1")
98 message("Build #${CYCLE} ")
99 message("Revision : ${OLDREV}")
100 set (START_TIME ${CTEST_ELAPSED_TIME})
101 math(EXPR CLEAR "${CYCLE}%${CLEARCYCLE}")
102
103 #Clear build directory every CLEARCYCLE build
104 if(${CLEAR} EQUAL 0)
105 message("Clearing build directory")
106 ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY})
107 endif(${CLEAR} EQUAL 0)
108 message(STATUS "Building source")
109 ctest_build(BUILD "${CTEST_BINARY_DIRECTORY}")
f04bc3d4 110 ctest_submit(PARTS Build)
eee962e6 111 #Test every other build
112 math(EXPR TEST "${CYCLE}%${TESTCYCLE}")
113 if(${TEST} EQUAL 0)
114 message(STATUS "Running tests")
115 ctest_test (BUILD "${CTEST_BINARY_DIRECTORY}")
116 endif(${TEST} EQUAL 0)
117 ctest_submit ()
118 message("Build ${CYCLE} completed")
119 ctest_sleep(300)
120endwhile()
121
122
123
124