blob: e89884918d217fa9935a079c47f5abaf54efb30c [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
27 def display(self):
28 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
38 print "<%s bgcolor=%s>" % (box_html, self.color)
39 print data
40 print "</%s>" % box_html
41
42
43def print_table(matrix):
44 """
45 matrix: list of lists of boxes, giving a matrix of data
46 Each of the inner lists is a row, not a column.
47
48 Display the given matrix of data as a table.
49 """
50
51 print '<table cellpadding=5 border=1 class="boldtable">'
52 for row in matrix:
53 print '<tr>'
54 for element in row:
55 print element
56 element.display()
57 print '</tr>'
58 print '</table>'
59
60
mblighcfd2d012007-09-19 21:07:34 +000061def sort_tests(tests):
62 kernel_order = ['patch', 'config', 'build', 'mkinitrd', 'install']
63
64 results = []
65 for kernel_op in kernel_order:
66 test = 'kernel.' + kernel_op
67 if tests.count(test):
68 results.append(test)
69 tests.remove(test)
70 return results + sorted(tests)
mblighbfec5222007-09-14 16:58:57 +000071