source: XIOS/dev/dev_trunk_omp/html/generate_test_table.js @ 1838

Last change on this file since 1838 was 1792, checked in by yushan, 5 years ago

dev_trunk_omp : update and cleanup of unit tests

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