Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Make the sendsend tests at least fail fast to not hinder my workflow
[simgrid.git] / tools / jenkins / project_description.sh
1 #!/usr/bin/env bash
2
3 get_boost(){
4     BOOST=$(grep -m 1 "Boost version:" ./consoleText | sed  "s/.*-- Boost version: \([a-zA-Z0-9\.]*\)/\1/g")
5     if [ -z "$BOOST" ]
6     then
7       BOOST=$(grep -m 1 "Found Boost:" ./consoleText | sed  "s/.*-- Found Boost:.*found suitable version \"\([a-zA-Z0-9\.]*\)\",.*/\1/g")
8     fi
9   echo "$BOOST"
10 }
11
12 get_compiler(){
13     grep -m 1 "The C compiler identification" ./consoleText | sed  "s/.*-- The C compiler identification is \([a-zA-Z0-9\.]*\)/\1/g"
14 }
15
16 get_cmake(){
17     grep -m 1 "Cmake version" ./consoleText| sed "s/.*-- Cmake version \([a-zA-Z0-9\.]*\)/\1/g"
18 }
19
20 get_eigen3(){
21   sed -n 's/.* Eigen3 library \.\+: \([^ ]*\) in .*/\1/p;T;q' ./consoleText
22 }
23
24 get_ns3(){
25   sed -n 's/.*-- ns-3 found (v\(3[-.0-9a-z]\+\); minor:.*/\1/p;T;q' ./consoleText
26 }
27
28 get_python(){
29   found=$(grep -c "Compile Python bindings .....: ON" ./consoleText)
30   if [ "$found" != 0 ]; then
31     grep -m 1 "Found Python3" ./consoleText| sed "s/.*-- Found Python3.*found version \"\([a-zA-Z0-9\.]*\)\".*/\1/g"
32   else
33     echo ""
34   fi
35 }
36
37 if [ -f consoleText ]; then
38   rm consoleText
39 fi
40
41
42 if [ -z "$BUILD_URL" ]; then
43   BUILD_URL="https://ci.inria.fr/simgrid/job/SimGrid/lastBuild"
44 fi
45
46 #get the list of nodes on jenkins
47 wget --quiet ${BUILD_URL}/consoleText >/dev/null 2>&1
48 nodes=($(sed -n 's/^Triggering SimGrid [^ ]* Debug,//p' ./consoleText| sort))
49 rm consoleText
50
51 cat <<EOF
52 <br>Description of the nodes - Automatically updated by project_description.sh script - Don't edit here<br><br>
53 <script>
54 function compareVersion(v1, v2) {
55     if (typeof v1 !== 'string') return false;
56     if (typeof v2 !== 'string') return false;
57     v1 = v1.split('.');
58     v2 = v2.split('.');
59     const k = Math.min(v1.length, v2.length);
60     for (let i = 0; i < k; ++ i) {
61         v1[i] = parseInt(v1[i], 10);
62         v2[i] = parseInt(v2[i], 10);
63         if (v1[i] > v2[i]) return 1;
64         if (v1[i] < v2[i]) return -1;
65     }
66     return v1.length == v2.length ? 0: (v1.length < v2.length ? -1 : 1);
67 }</script>
68 <script>
69 function sortTable(n, type) {
70   var table, rows, switching, i, x, y, shouldSwitch, dir, switchcount = 0;
71   table = document.getElementById('configuration-matrix');
72   switching = true;
73   //Set the sorting direction to ascending:
74   dir = 'asc';
75   /*Make a loop that will continue until
76   no switching has been done:*/
77   while (switching) {
78     //start by saying: no switching is done:
79     switching = false;
80     rows = table.rows;
81     /*Loop through all table rows (except the
82     first, which contains table headers):*/
83     for (i = 1; i < (rows.length - 1); i++) {
84       //start by saying there should be no switching:
85       shouldSwitch = false;
86       /*Get the two elements you want to compare,
87       one from current row and one from the next:*/
88       x = rows[i].getElementsByTagName('TD')[n];
89       y = rows[i + 1].getElementsByTagName('TD')[n];
90       /*check if the two rows should switch place,
91       based on the direction, asc or desc:*/
92       if (dir == 'asc') {
93         if(type == 'version'){
94           shouldSwitch = (compareVersion(x.innerHTML.toLowerCase(), y.innerHTML.toLowerCase()) > 0);
95         }else{
96           shouldSwitch = (x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase());
97         }
98       } else if (dir == 'desc') {
99         if(type == 'version'){
100           shouldSwitch = (compareVersion(x.innerHTML.toLowerCase(), y.innerHTML.toLowerCase()) < 0);
101         }else{
102           shouldSwitch = (x.innerHTML.toLowerCase() < y.innerHTML.toLowerCase());
103         }
104       }
105       if (shouldSwitch)
106         break;
107     }
108     if (shouldSwitch) {
109       /*If a switch has been marked, make the switch
110       and mark that a switch has been done:*/
111       rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);
112       switching = true;
113       //Each time a switch is done, increase this count by 1:
114       switchcount ++;
115     } else {
116       /*If no switching has been done AND the direction is 'asc',
117       set the direction to 'desc' and run the while loop again.*/
118       if (switchcount == 0 && dir == 'asc') {
119         dir = 'desc';
120         switching = true;
121       }
122     }
123   }
124 }
125 </script>
126 <table id=configuration-matrix>
127   <tr class=matrix-row>
128     <td class=matrix-header style=min-width:75px onclick='sortTable($((col=0)));'>Name of the Builder</td>
129     <td class=matrix-header style=min-width:75px onclick='sortTable($((++col)));'>OS</td>
130     <td class=matrix-header style=min-width:50px onclick='sortTable($((++col,0)));'>Debug</td>
131     <td class=matrix-header style=min-width:50px onclick='sortTable($((++col,0)));'>MC</td>
132     <td class=matrix-header style=min-width:75px onclick='sortTable($((++col)));'>Compiler</td>
133     <td class=matrix-header style=min-width:75px onclick="sortTable($((++col)),'version');">Boost</td>
134     <td class=matrix-header style=min-width:75px onclick="sortTable($((++col)),'version');">Cmake</td>
135     <td class=matrix-header style=min-width:50px onclick="sortTable($((++col)),'version');">Eigen3</td>
136     <td class=matrix-header style=min-width:50px onclick="sortTable($((++col)),'version');">ns-3</td>
137     <td class=matrix-header style=min-width:50px onclick="sortTable($((++col)),'version');">Python</td>
138   </tr>
139 EOF
140
141 declare -A icons
142 icons=(
143     [success]="img src=https://ci.inria.fr/simgrid/images/24x24/blue.png"
144     [failure]="img src=https://ci.inria.fr/simgrid/images/24x24/red.png"
145     [disabled]="img src=https://ci.inria.fr/simgrid/images/24x24/disabled.png"
146 )
147
148 for node in "${nodes[@]}"
149 do
150     wget --quiet --output-document=consoleText \
151          ${BUILD_URL}/build_mode=Debug,node=${node}/consoleText \
152          ${BUILD_URL}/build_mode=ModelChecker,node=${node}/consoleText \
153          >/dev/null 2>&1
154     if [ ! -f consoleText ]; then
155       echo "file not existing for node ${node}"
156       exit 1
157     fi
158     boost=$(get_boost)
159     compiler=$(get_compiler)
160     cmake=$(get_cmake)
161     eigen3=$(get_eigen3)
162     ns3=$(get_ns3)
163     py=$(get_python)
164     os=$(grep -m 1 "OS Version" ./consoleText| sed "s/OS Version : \(.*\)/\1/g")
165
166     color1=""
167     color2=""
168     #in case of success, replace blue by green in status balls
169     wget --quiet https://ci.inria.fr/simgrid/buildStatus/text?job=SimGrid%2Fbuild_mode%3DDebug%2Cnode%3D"${node}" -O status  >/dev/null 2>&1
170
171     status=$(cat status)
172     if [ "$status" == "Success" ]; then
173       color1="&color=green"
174     fi
175     rm status
176     statusdebug="<a href=\"build_mode=Debug,node=${node}/\"><img src=\"https://ci.inria.fr/simgrid/job/SimGrid/build_mode=Debug,node=${node}/badge/icon?style=ball-24x24${color1}\"/>"
177
178     statusmc="<${icons[disabled]}>"
179     wget --quiet https://ci.inria.fr/simgrid/buildStatus/text?job=SimGrid%2Fbuild_mode%3DModelChecker%2Cnode%3D"${node}" -O status >/dev/null 2>&1
180     status=$(cat status)
181     if [ "$status" ]; then
182       if [ "$status" == "Success" ]; then
183         color2="&color=green"
184       fi
185       statusmc="<a href=\"build_mode=ModelChecker,node=${node}/\"><img src=\"https://ci.inria.fr/simgrid/job/SimGrid/build_mode=ModelChecker,node=${node}/badge/icon?style=ball-24x24${color2}\"/>"
186     fi
187     rm status
188
189     cat <<EOF
190   <tr>
191     <td class="matrix-leftcolumn">$node</td>
192     <td class="matrix-cell" style="text-align:left">$os</td>
193     <td class="matrix-cell" style="text-align:center">${statusdebug}</td>
194     <td class="matrix-cell" style="text-align:center">${statusmc}</td>
195     <td class="matrix-cell" style="text-align:left">$compiler</td>
196     <td class="matrix-cell" style="text-align:left">$boost</td>
197     <td class="matrix-cell" style="text-align:left">$cmake</td>
198     <td class="matrix-cell" style="text-align:center">$eigen3</td>
199     <td class="matrix-cell" style="text-align:left">$ns3</td>
200     <td class="matrix-cell" style="text-align:left">$py</td>
201   </tr>
202 EOF
203     rm consoleText
204 done
205
206 echo "</table>"