Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
b01c5748d8c87135c00891796b89e877bc62db08
[simgrid.git] / buildtools / Cmake / Pipol.cmake
1 # On a Pipol system, set:
2 # PIPOL_USER
3
4 #SET(PIPOL_USER $ENV{PIPOL_USER})
5
6 # ssh/rsync mandatory 
7 IF(pipol_user)
8
9         set(CMAKE_OPTIONS "     -Wno-dev")
10         
11         if(custom_flags)
12         set(CMAKE_OPTIONS "${CMAKE_OPTIONS}     -Dcustom_flags=${custom_flags}")
13         endif(custom_flags)
14         
15         if(with_context)
16         set(CMAKE_OPTIONS "${CMAKE_OPTIONS}     -Dwith_context=${with_context}")
17         endif(with_context)
18         
19         if(enable_smpi)
20         set(CMAKE_OPTIONS "${CMAKE_OPTIONS}     -Denable_smpi=on")
21         endif(enable_smpi)
22         
23         if(enable_lua)
24         set(CMAKE_OPTIONS "${CMAKE_OPTIONS}     -Denable_lua=on")
25         endif(enable_lua)       
26         
27         if(enable_compile_optimizations)
28         set(CMAKE_OPTIONS "${CMAKE_OPTIONS}     -Denable_compile_optimizations=on")
29         endif(enable_compile_optimizations)
30         
31         if(enable_compile_warnings)
32         set(CMAKE_OPTIONS "${CMAKE_OPTIONS}     -Denable_compile_warnings=on")
33         endif(enable_compile_warnings)  
34         
35         if(enable_tracing)
36         set(CMAKE_OPTIONS "${CMAKE_OPTIONS}     -Denable_tracing=on")
37         endif(enable_tracing)
38         
39         if(enable_coverage)
40         set(CMAKE_OPTIONS "${CMAKE_OPTION}      -Denable_coverage=on")
41         endif(enable_coverage)  
42         
43         if(enable_print_message)        
44         set(CMAKE_OPTIONS "${CMAKE_OPTIONS}     -Denable_print_message=on")
45         endif(enable_print_message)     
46         
47         if(enable_model-checking)
48         set(CMAKE_OPTIONS "${CMAKE_OPTIONS}     -Denable_model-checking=on")
49         endif(enable_model-checking)
50         
51     if(enable_latency_bound_tracking)
52         set(CMAKE_OPTIONS "${CMAKE_OPTIONS}     -Denable_latency_bound_tracking=on")
53         endif(enable_latency_bound_tracking)
54
55         FIND_PROGRAM(HAVE_SSH ssh)
56         FIND_PROGRAM(HAVE_RSYNC rsync)
57
58     MESSAGE(STATUS "Pipol user is ${pipol_user}")
59     IF(HAVE_SSH)
60         message(STATUS "Found ssh: ${HAVE_SSH}")
61       # get pipol systems
62       EXECUTE_PROCESS(COMMAND 
63         ssh ${pipol_user}@pipol.inria.fr pipol-sub --query=systems 
64         OUTPUT_VARIABLE PIPOL_SYSTEMS OUTPUT_STRIP_TRAILING_WHITESPACE)
65         
66     ENDIF(HAVE_SSH)
67   
68         ADD_CUSTOM_TARGET(pipol_test_list_images
69                 COMMENT "Available images for pipol tests (cmake + make + make test) : "
70                 )
71                 
72         ADD_CUSTOM_TARGET(pipol_experimental_list_images
73                 COMMENT "Available images for ctest (ctest -D Experimental) : "
74                 )
75                 
76         ADD_CUSTOM_TARGET(pipol_kvm_deploy
77                 COMMENT "Deploy all kvm images on pipol (ctest -D Experimental) : "
78                 )
79         ADD_CUSTOM_COMMAND(TARGET pipol_kvm_deploy
80                 POST_BUILD
81                 COMMENT "See results on http://cdash.inria.fr/CDash/index.php?project=Simgrid"
82                 )
83   
84     IF(HAVE_RSYNC)
85         message(STATUS "Found rsync: ${HAVE_RSYNC}")
86               MACRO(PIPOL_TARGET
87                   SYSTEM_PATTERN)
88                                   STRING(REPLACE ".dd.gz" "" SYSTEM_TARGET ${SYSTEM_PATTERN})
89                                 
90                               ADD_CUSTOM_TARGET(
91                                 ${SYSTEM_TARGET}
92                                 COMMENT "PIPOL Build : ${SYSTEM_PATTERN}"
93                                 COMMAND rsync ${pipol_user}@pipol.inria.fr:/usr/local/bin/pipol-sub .
94                                 COMMAND ./pipol-sub --pipol-user=${pipol_user} ${SYSTEM_PATTERN} 02:00 --reconnect --group --keep --verbose=1 --export=${CMAKE_HOME_DIRECTORY} --rsynco=-aC  
95                                 \"sudo chown ${pipol_user} ${CMAKE_HOME_DIRECTORY} \;
96                                 cd ${CMAKE_HOME_DIRECTORY} \;
97                                 sh ${CMAKE_HOME_DIRECTORY}/buildtools/pipol/liste_install.sh \;
98                                 cmake -E remove CMakeCache.txt \;
99                                 cmake ${CMAKE_HOME_DIRECTORY}${CMAKE_OPTIONS} \;
100                                 make clean \;
101                                 make \;
102                                 make check \"
103                                 )
104                               ADD_CUSTOM_TARGET(
105                                 ${SYSTEM_TARGET}_experimental
106                                 COMMENT "PIPOL Build : ${SYSTEM_PATTERN}_experimental"
107                                 COMMAND rsync ${pipol_user}@pipol.inria.fr:/usr/local/bin/pipol-sub .
108                                 COMMAND ./pipol-sub --pipol-user=${pipol_user} ${SYSTEM_PATTERN} 02:00 --reconnect --group --keep --verbose=1 --export=${CMAKE_HOME_DIRECTORY} --rsynco=-aC  
109                                 \"sudo chown ${pipol_user} ${CMAKE_HOME_DIRECTORY} \;
110                                 cd ${CMAKE_HOME_DIRECTORY} \;
111                                 sh ${CMAKE_HOME_DIRECTORY}/buildtools/pipol/liste_install.sh \;
112                                 cmake -E remove CMakeCache.txt \;
113                                 cmake ${CMAKE_HOME_DIRECTORY}${CMAKE_OPTIONS} \;
114                                 ctest -D Experimental \"
115                                 )
116                                 
117                               STRING(REGEX MATCH "kvm" make_test "${SYSTEM_TARGET}")
118                               if(make_test)
119                                 STRING(REGEX MATCH "windows" make_test "${SYSTEM_TARGET}")
120                                 if(NOT make_test)
121                                   ADD_CUSTOM_COMMAND(TARGET pipol_kvm_deploy
122                                         COMMENT "PIPOL Build : ${SYSTEM_PATTERN}"
123                                         COMMAND rsync ${pipol_user}@pipol.inria.fr:/usr/local/bin/pipol-sub .
124                                         COMMAND ./pipol-sub --pipol-user=${pipol_user} ${SYSTEM_PATTERN} 02:00 --reconnect --group --keep --verbose=1 --export=${CMAKE_HOME_DIRECTORY} --rsynco=-aC  
125                                         \"sudo chown ${pipol_user} ${CMAKE_HOME_DIRECTORY} \;
126                                         cd ${CMAKE_HOME_DIRECTORY} \;
127                                         sh ${CMAKE_HOME_DIRECTORY}/buildtools/pipol/liste_install.sh \;
128                                         cmake -E remove CMakeCache.txt \;
129                                         cmake ${CMAKE_HOME_DIRECTORY}${CMAKE_OPTIONS} \;
130                                         ctest -D Experimental \"
131                                          )
132                                 endif(NOT make_test)
133                               endif(make_test)
134                               
135                               ADD_CUSTOM_COMMAND(TARGET ${SYSTEM_TARGET}_experimental
136                                                                  POST_BUILD
137                                                                  COMMENT "See results on http://cdash.inria.fr/CDash/index.php?project=Simgrid"
138                                                                  )
139                                                                  
140                               ADD_CUSTOM_COMMAND(TARGET pipol_test_list_images
141                                         COMMAND echo ${SYSTEM_TARGET}
142                                         )
143                                   ADD_CUSTOM_COMMAND(TARGET pipol_experimental_list_images
144                                         COMMAND echo "${SYSTEM_TARGET}_experimental"
145                                         )
146       ENDMACRO(PIPOL_TARGET)
147       
148     ENDIF(HAVE_RSYNC)
149     
150 # add a target for each pipol system
151 IF(PIPOL_SYSTEMS)
152   MESSAGE(STATUS "Adding Pipol targets")
153   FOREACH(SYSTEM ${PIPOL_SYSTEMS})
154     PIPOL_TARGET(${SYSTEM})
155   ENDFOREACH(SYSTEM ${PIPOL_SYSTEMS})
156 ENDIF(PIPOL_SYSTEMS)
157
158 ADD_CUSTOM_TARGET(pipol_kill_all_jobs
159                 COMMENT "PIPOL delete all jobs"
160                 COMMAND ./pipol-sub --pipol-user=${pipol_user} deleteallmyjobs
161                 )
162                 
163 message(STATUS "Pipol options: ${CMAKE_OPTIONS}")
164                 
165 ENDIF(pipol_user)