source: XIOS/trunk/xios_test_suite/HTML/generate_test_table.js @ 1821

Last change on this file since 1821 was 1821, checked in by yushan, 4 years ago

XIOS test suite : unit tests will not run if build failed. Catch the make_xios exit value as build status.

File size: 16.1 KB
Line 
1var dict = {"-1": "❌", "0": "❎", "1": "✅"}
2
3function generateTestTable()
4{
5  var machine_list=[];
6  var machine_revision_list=[];
7  var machine_full_name_list=[];
8  var machine_info_list=[];
9
10  if(typeof test_jeanzay_revision_list != 'undefined') 
11  {
12    machine_list.push("jeanzay");
13    machine_revision_list.push("test_jeanzay_revision_list")
14    machine_full_name_list.push("Jean-Zay")
15    machine_info_list.push("test_jeanzay_info_list")
16  }
17 
18  if (typeof test_irene_revision_list != 'undefined') 
19  {
20    machine_list.push("irene");
21    machine_revision_list.push("test_irene_revision_list")
22    machine_full_name_list.push("Irene")
23    machine_info_list.push("test_irene_info_list")
24  }
25 
26  if (typeof test_other_revision_list != 'undefined') 
27  {
28    machine_list.push("other");
29    machine_revision_list.push("test_other_revision_list")
30    machine_full_name_list.push("Other")
31    machine_info_list.push("test_other_info_list")
32  }
33
34  var revision_list=[]
35
36  for (var i=0; i<machine_list.length; i++)
37  {
38    tmp_list = eval(machine_revision_list[i])
39
40    for (var j=0; j<tmp_list.length; j++)
41    {
42      if (revision_list.includes(tmp_list[j]) == false)
43      {
44        revision_list.push(tmp_list[j])
45      }
46    }
47  }
48
49  revision_list.sort(function(a, b){return b-a});
50
51  // Generate select list for test table
52
53  var sel = document.getElementById("revision");
54
55  var sel_options = sel.children
56 
57  var new_options=[]
58  for(var i=0; i<sel_options.length-1; i++)
59  {
60    new_options[i] = sel_options[i+1].value
61  }
62 
63  for(var i=0; i<revision_list.length; i++)
64  {
65    if (!new_options.includes(revision_list[i]))
66    {
67      new_options.push(revision_list[i])
68    }
69  }
70 
71  new_options.sort(function(a, b){return b-a})
72 
73  while (sel.lastChild && sel.children.length>1) {
74    sel.removeChild(sel.lastChild);
75  }
76
77  for(var i=0; i<new_options.length; i++)
78  {
79    var opt = document.createElement('option');
80    opt.appendChild( document.createTextNode(new_options[i]));
81    opt.value = new_options[i]; 
82    sel.appendChild(opt);
83  }
84 
85
86
87 
88  // Generate content of test table
89 
90  var table = document.getElementById("test_table")
91  table.style.backgroundColor = "#84c5ff";
92  table.setAttribute("class", "test_table")
93  table.setAttribute("id", "test_table")
94
95  var titelRow = document.getElementById("test_table_row0")
96  var myCell = document.createElement("TD");
97  myCell.style.minWidth="150px"
98  myCell.style.maxWidth="150px"
99  myCell.innerHTML = ("Revision");
100  titelRow.appendChild(myCell)
101
102  for (var machine_index=0; machine_index<machine_list.length; machine_index++)
103  {
104    var myCell = document.createElement("TD");
105    myCell.style.minWidth="50px"
106    myCell.innerHTML = (machine_full_name_list[machine_index]);
107    titelRow.appendChild(myCell)
108  }
109
110  var emptyRow = document.createElement("tr")
111  emptyRow.setAttribute("id", "empty_test_row")
112  emptyRow.style.display="none"
113  table.appendChild(emptyRow)
114 
115  var myCell = document.createElement("TD");
116  myCell.setAttribute("id", "empty_test_row_revision")
117  myCell.style.fontWeight="bold"
118  emptyRow.appendChild(myCell)
119
120  for (var machine_index=0; machine_index<machine_list.length; machine_index++)
121  {
122    var myCell = document.createElement("TD");
123    myCell.innerHTML="No Test Information"
124    myCell.style.color="white"
125    emptyRow.appendChild(myCell)
126  }
127
128
129  for (var i=0; i<revision_list.length; i++)
130  {
131    var revision = revision_list[i]
132
133    var myRow = document.createElement("TR");
134    myRow.setAttribute("id", "test_table_"+revision);
135    myRow.setAttribute("class", "test_table_row");
136    table.appendChild(myRow)
137   
138    var myCell = document.createElement("TD");
139    myCell.innerHTML = (revision);
140    myCell.style.fontWeight = "bold";
141    myRow.appendChild(myCell)
142   
143    for( var j=0; j<machine_list.length; j++)
144    {
145      var machine = machine_list[j]
146      var myCell = document.createElement("TD");
147      myCell.setAttribute("id", "test_table_"+revision+"_"+machine);
148      myRow.appendChild(myCell)
149      myRow.appendChild(myCell)
150    }       
151  }
152
153  for (var i=0; i<revision_list.length; i++)
154  {
155    var revision = revision_list[i]
156    for (var j=0; j<machine_list.length; j++)
157    {
158      var machine = machine_list[j]
159      var has_test_info=false
160      tmp_info = eval(machine_info_list[j])
161      for (var k=0; k<eval(machine_info_list[j]).length; k++)
162      {
163        target_info = tmp_info[k]
164        if (target_info[0] == revision && target_info[1] == machine)
165        {
166          fillSubTestTable(revision, machine, target_info[2], target_info[3], target_info[4], target_info[5], target_info[6], target_info[7])
167          has_test_info = true
168        }
169      }
170      if (!has_test_info)
171      {
172        var myTD = document.getElementById("test_table_"+revision+"_"+machine);
173        myTD.innerHTML = "No Test Information"
174        myTD.style.color = "white"
175      }
176    }
177  }
178  update_status()
179}
180
181function fillSubTestTable(revision, machine, build_dir, branch_name, machine_name, arch_name, mode_name, full_dir)
182{
183  var info_list = eval("test_"+machine+"_"+revision+"_"+build_dir.replace("build_",""))
184
185  var myTD = document.getElementById("test_table_"+revision+"_"+machine);
186  var mySubTable = document.createElement("table")
187  myTD.appendChild(mySubTable)
188  mySubTable.style.minWidth="200px"
189  mySubTable.setAttribute("class", "test_sub_table")
190  mySubTable.setAttribute("id", "test_sub_table_"+revision+"_"+machine+"_"+build_dir)
191
192  if(info_list.length == 0)
193  {
194    myRow = document.createElement("tr")
195    myRow.setAttribute("id","test_sub_table_row_"+revision+"_"+machine+"_"+build_dir)
196    myRow.setAttribute("class","test_sub_table_row_"+revision+"_"+machine)
197    myRow.classList.add("build_level")
198    myCell = document.createElement("td")
199    myCell.innerHTML = build_dir.replace("build_","")+" Build Failed"
200    myCell.style.color = "white"
201    myCell.style.fontWeight = "bold"
202    myRow.appendChild(myCell)
203    mySubTable.append(myRow)
204    return;
205  }
206
207  myRow = document.createElement("tr")
208  myRow.setAttribute("id","test_sub_table_row_"+revision+"_"+machine+"_"+build_dir)
209  myRow.setAttribute("class","test_sub_table_row_"+revision+"_"+machine)
210  myRow.classList.add("build_level")
211  myCell = document.createElement("td")
212  myCell.innerHTML = build_dir.replace("build_","")
213  myCell.onclick=function() {mytoggle("test_sub_table_"+revision+"_"+machine+"_"+build_dir)}
214  myRow.appendChild(myCell)
215  mySubTable.append(myRow)
216
217  myCell = document.createElement("td")
218  myCell_1 = document.createElement("div")
219  myCell_1.setAttribute("class", "dropdown")
220  myCell_2 = document.createElement("button")
221  myCell_2.onclick = function() {show_dropdown("test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_dropdown")}
222  myCell_2.onmouseleave = function() {hide_dropdown("test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_dropdown")}
223  myCell_2.innerHTML=("&#128270;")
224  myCell_3 = document.createElement("div")
225  myCell_3.setAttribute("class", "dropdown-content")
226  myCell_3.setAttribute("id", "test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_dropdown")
227  myCell_4 = document.createElement("a")
228  myCell_4.innerHTML = ("show plain report")
229  myCell_4.onclick = function() {show_plain_report(machine, revision, build_dir)}
230  myCell_5 = document.createElement("a")
231  myCell_5.innerHTML = ("show xios info")
232  myCell_5.onclick = function() {show_text("<table><tr><td>Branch</td><td><em>"+branch_name+"</em></td></tr><tr><td>Revision</td><td><em>"+revision+"</em></td></tr><tr><td>Machine</td><td><em>"+machine_name+"</em></td></tr><tr><td>Architecture</td><td><em>"+arch_name+"</em></td></tr><tr><td>Compile mode</td><td><em>"+mode_name+"</em></td></tr><tr><td>Full build directory</td><td><em>"+full_dir+"</em></td></tr><tr><td>Short build directory</td><td><em>"+build_dir+"</em></td></tr></table>")}
233  myCell_2.appendChild(myCell_3)
234  myCell_3.appendChild(myCell_4)
235  myCell_3.appendChild(myCell_5)
236  myCell_1.appendChild(myCell_2)
237  myCell.appendChild(myCell_1)
238  myRow.appendChild(myCell)
239
240  for (var i=0; i<2; i++)
241  {
242    myCell = document.createElement("td")
243    myRow.appendChild(myCell)
244  }
245
246  myCell = document.createElement("td")
247  myCell.setAttribute("class", "cell_to_update")
248  myCell.setAttribute("id","test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_status")
249  myCell.innerHTML = 1
250  myRow.appendChild(myCell)
251
252  for (var i=0; i<3; i++)
253  {
254    myCell = document.createElement("td")
255    myRow.appendChild(myCell)
256  }
257
258  var previous_status=["","","",""]
259  var current_status=info_list[0]
260  for(var i=0; i<info_list.length; i++)
261  {
262    current_status = info_list[i]
263    if (current_status[0] != previous_status[0])
264    {
265      create_rows(3, revision, machine, build_dir, current_status, full_dir)
266    }
267    else if (current_status[1] != previous_status[1])
268    {
269      create_rows(2, revision, machine, build_dir, current_status, full_dir)
270    }
271    else if (current_status[2] != previous_status[2])
272    {
273      create_rows(1, revision, machine, build_dir, current_status, full_dir)
274    }
275    previous_status = current_status
276  }
277
278
279}
280
281
282function create_rows(nb, revision, machine, build_dir, status, full_dir)
283{
284  tt = document.getElementById("test_sub_table_"+revision+"_"+machine+"_"+build_dir)
285  if(nb==3)
286  {
287    // algo level
288
289    myRow = document.createElement("tr")
290    myRow.setAttribute("class", "test_sub_table_"+revision+"_"+machine+"_"+build_dir)
291    myRow.classList.add('algo_level');
292    myRow.setAttribute("id", "test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_"+status[0])
293    myRow.style.display = "none";
294    tt.appendChild(myRow)
295   
296   
297    myCell = document.createElement("td")
298    myRow.appendChild(myCell)
299
300
301    myCell = document.createElement("td")
302    myCell.innerHTML = status[0]
303    myCell.onclick=function() {mytoggle("test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_"+status[0])}
304    myRow.appendChild(myCell)
305
306    myCell = document.createElement("td")
307    myCell_1 = document.createElement("div")
308    myCell_1.setAttribute("class", "dropdown")
309    myCell_2 = document.createElement("button")
310    myCell_2.onclick = function() {show_dropdown("test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_"+status[0]+"_dropdown")}
311    myCell_2.onmouseleave = function() {hide_dropdown("test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_"+status[0]+"_dropdown")}
312    myCell_2.innerHTML=("&#128270;")
313    myCell_3 = document.createElement("div")
314    myCell_3.setAttribute("class", "dropdown-content")
315    myCell_3.setAttribute("id", "test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_"+status[0]+"_dropdown")
316    myCell_4 = document.createElement("a")
317    myCell_4.innerHTML = ("show user_params.def")
318    myCell_4.onclick = function() {show_user_params(machine, revision, build_dir, status[0])}
319    myCell_5 = document.createElement("a")
320    myCell_5.innerHTML = ("show location")
321    myCell_5.onclick = function() {show_text(full_dir.replace(build_dir, "GENERIC_TESTCASE/")+status[0])}
322    myCell_2.appendChild(myCell_3)
323    myCell_3.appendChild(myCell_4)
324    myCell_3.appendChild(myCell_5)
325    myCell_1.appendChild(myCell_2)
326    myCell.appendChild(myCell_1)
327    myRow.appendChild(myCell)
328
329    for (var i=0; i<2; i++)
330    {
331      myCell = document.createElement("td")
332      myRow.appendChild(myCell)
333    }
334
335    myCell = document.createElement("td")
336    myCell.innerHTML = 1
337    myCell.setAttribute("id", "test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_"+status[0]+"_status")
338    myCell.setAttribute("class", "cell_to_update")
339    myRow.appendChild(myCell)
340   
341    for (var i=0; i<2; i++)
342    {
343      myCell = document.createElement("td")
344      myRow.appendChild(myCell)
345    }
346  }
347
348  if(nb>=2)
349  {
350    // config level
351
352    myRow = document.createElement("tr")
353    myRow.setAttribute("class", "test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_"+status[0])
354    myRow.classList.add("config_level")
355    myRow.setAttribute("id", "test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_"+status[0]+"_"+status[1])
356    myRow.style.display = "none";
357    tt.appendChild(myRow)
358   
359    for (var i=0; i<2; i++)
360    {
361      myCell = document.createElement("td")
362      myRow.appendChild(myCell)
363    }
364
365    myCell = document.createElement("td")
366    myCell.innerHTML = status[1]
367    myCell.onclick=function() {mytoggle("test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_"+status[0]+"_"+status[1])}
368    myRow.appendChild(myCell)
369
370    myCell = document.createElement("td")
371    myCell_1 = document.createElement("div")
372    myCell_1.setAttribute("class", "dropdown")
373    myCell_2 = document.createElement("button")
374    myCell_2.onclick = function() {show_dropdown("test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_"+status[0]+"_"+status[1]+"_dropdown")}
375    myCell_2.onmouseleave = function() {hide_dropdown("test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_"+status[0]+"_"+status[1]+"_dropdown")}
376    myCell_2.innerHTML=("&#128270;")
377    myCell_3 = document.createElement("div")
378    myCell_3.setAttribute("class", "dropdown-content")
379    myCell_3.setAttribute("id", "test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_"+status[0]+"_"+status[1]+"_dropdown")
380    myCell_4 = document.createElement("a")
381    myCell_4.innerHTML = ("show all_param.def")
382    myCell_4.onclick = function() {show_all_params(machine, revision, build_dir, status[0], status[1])}
383    myCell_5 = document.createElement("a")
384    myCell_5.innerHTML = ("show location")
385    myCell_5.onclick = function() {show_text(full_dir.replace(build_dir, "GENERIC_TESTCASE/")+status[0]+"/"+status[1])}
386    myCell_2.appendChild(myCell_3)
387    myCell_3.appendChild(myCell_4)
388    myCell_3.appendChild(myCell_5)
389    myCell_1.appendChild(myCell_2)
390    myCell.appendChild(myCell_1)
391    myRow.appendChild(myCell)
392
393
394    for (var i=0; i<2; i++)
395    {
396      myCell = document.createElement("td")
397      myRow.appendChild(myCell)
398    }
399
400    myCell = document.createElement("td")
401    myCell.innerHTML = 1
402    myCell.setAttribute("id", "test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_"+status[0]+"_"+status[1]+"_status")   
403    myCell.setAttribute("class", "cell_to_update")
404    myRow.appendChild(myCell)
405   
406    myCell = document.createElement("td")
407    myRow.appendChild(myCell)
408  }
409
410  // file level
411
412  myRow = document.createElement("tr")
413  myRow.setAttribute("class", "test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_"+status[0]+"_"+status[1])
414  myRow.classList.add("file_level")
415  myRow.setAttribute("id", "test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_"+status[0]+"_"+status[1]+"_"+status[2])
416  myRow.style.display = "none";
417  tt.appendChild(myRow)
418   
419  for (var i=0; i<3; i++)
420  {
421    myCell = document.createElement("td")
422    myRow.appendChild(myCell)
423  }
424
425  myCell = document.createElement("td")
426  myCell.innerHTML = status[2]
427  myRow.appendChild(myCell)
428
429  for (var i=0; i<3; i++)
430  {
431    myCell = document.createElement("td")
432    myRow.appendChild(myCell)
433  }
434
435  myCell = document.createElement("td")
436  myCell.setAttribute("class", "cell_to_update")
437  myCell.innerHTML = status[3]
438  myRow.appendChild(myCell)
439
440  var cell = document.getElementById("test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_"+status[0]+"_"+status[1]+"_status")
441  cell.innerHTML = Math.min(cell.innerHTML, status[3])
442   
443  var cell = document.getElementById("test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_"+status[0]+"_status")
444  cell.innerHTML = Math.min(cell.innerHTML, status[3])
445
446  var cell = document.getElementById("test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_status")
447  cell.innerHTML = Math.min(cell.innerHTML, status[3])
448
449}
450
451function update_status()
452{
453  var cells = document.getElementsByClassName("cell_to_update")
454  for (var i=0; i<cells.length; i++)
455  {
456    cells[i].innerHTML = dict[cells[i].innerHTML]
457  }
458}
459
460function mytoggle(classname)
461{
462  var myCells = document.getElementsByClassName(classname)
463  for (var i=0; i<myCells.length; i++)
464  {
465    var mySubCells = document.getElementsByClassName(myCells[i].id)
466    if (myCells[i].style.display=="table-row")
467    {
468      myCells[i].style.display="none" 
469      for(var j=0; j<mySubCells.length; j++)
470      {
471        mySubCells[j].style.display="none"
472        var mySubSubCells = document.getElementsByClassName(mySubCells[j].id)
473        for(var k=0; k<mySubSubCells.length; k++)
474        {
475          mySubSubCells[k].style.display="none"
476        }
477      }
478    }
479    else
480    {
481      myCells[i].style.display="table-row"
482    }
483  }
484}
485
Note: See TracBrowser for help on using the repository browser.