blob: fc8375e97840bced103cc5bbd40ddf7c028f9bfb [file] [log] [blame]
mbligh54fe6982007-09-19 22:20:12 +00001import os, re, parse, sys, frontend
mblighbfec5222007-09-14 16:58:57 +00002
mblighcfd2d012007-09-19 21:07:34 +00003color_map = {
4 'GOOD' : '#66ff66', # green
5 'WARN' : '#fffc00', # yellow
6 'FAIL' : '#ff6666', # red
7 'ABORT' : '#ff6666', # red
8 'ERROR' : '#ff6666', # red
9 'NOSTATUS' : '#ffffff', # white
10 'white' : '#ffffff', # white
11 'green' : '#66ff66', # green
12 'yellow' : '#fffc00', # yellow
13 'red' : '#ff6666', # red
14}
mblighbfec5222007-09-14 16:58:57 +000015
mblighcfd2d012007-09-19 21:07:34 +000016
17class box:
18 def __init__(self, data, color_key = None, header = False):
19 self.data = data
20 if color_map.has_key(color_key):
21 self.color = color_map[color_key]
22 else:
23 self.color = color_map['white']
24 self.header = header
25
26
mbligh38757e72007-09-30 22:32:13 +000027 def html(self):
mblighcfd2d012007-09-19 21:07:34 +000028 if self.data:
29 data = self.data
30 else:
31 data = '&nbsp'
32
33 if self.header:
34 box_html = 'th'
35 else:
36 box_html = 'td'
37
mbligh38757e72007-09-30 22:32:13 +000038 return "<%s bgcolor=%s>%s</%s>" % \
39 (box_html, self.color, data, box_html)
mblighcfd2d012007-09-19 21:07:34 +000040
41
42def print_table(matrix):
43 """
44 matrix: list of lists of boxes, giving a matrix of data
45 Each of the inner lists is a row, not a column.
46
47 Display the given matrix of data as a table.
48 """
49
50 print '<table cellpadding=5 border=1 class="boldtable">'
51 for row in matrix:
52 print '<tr>'
53 for element in row:
54 print element
mbligh38757e72007-09-30 22:32:13 +000055 print element.html()
mblighcfd2d012007-09-19 21:07:34 +000056 print '</tr>'
57 print '</table>'
58
59
mblighcfd2d012007-09-19 21:07:34 +000060def sort_tests(tests):
61 kernel_order = ['patch', 'config', 'build', 'mkinitrd', 'install']
62
63 results = []
64 for kernel_op in kernel_order:
65 test = 'kernel.' + kernel_op
66 if tests.count(test):
67 results.append(test)
68 tests.remove(test)
69 return results + sorted(tests)
mblighbfec5222007-09-14 16:58:57 +000070