mbligh | 54fe698 | 2007-09-19 22:20:12 +0000 | [diff] [blame^] | 1 | import os, re, parse, sys, frontend |
mbligh | bfec522 | 2007-09-14 16:58:57 +0000 | [diff] [blame] | 2 | |
mbligh | cfd2d01 | 2007-09-19 21:07:34 +0000 | [diff] [blame] | 3 | color_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 | } |
mbligh | bfec522 | 2007-09-14 16:58:57 +0000 | [diff] [blame] | 15 | |
mbligh | cfd2d01 | 2007-09-19 21:07:34 +0000 | [diff] [blame] | 16 | |
| 17 | class 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 = ' ' |
| 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 | |
| 43 | def 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 | |
mbligh | cfd2d01 | 2007-09-19 21:07:34 +0000 | [diff] [blame] | 61 | def 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) |
mbligh | bfec522 | 2007-09-14 16:58:57 +0000 | [diff] [blame] | 71 | |