mbligh | 2e4e5df | 2007-11-05 17:22:46 +0000 | [diff] [blame] | 1 | #!/usr/bin/python |
| 2 | |
| 3 | """ |
| 4 | Selects all rows and columns that satisfy the condition specified |
| 5 | and draws the matrix. There is a seperate SQL query made for every (x,y) |
| 6 | in the matrix. |
| 7 | """ |
| 8 | |
mbligh | 2e4e5df | 2007-11-05 17:22:46 +0000 | [diff] [blame] | 9 | print "Content-type: text/html\n" |
mbligh | 2e4e5df | 2007-11-05 17:22:46 +0000 | [diff] [blame] | 10 | |
jadmanski | 22ab069 | 2008-05-01 22:22:51 +0000 | [diff] [blame] | 11 | import sys, os, urllib, cgi, cgitb, re, datetime, time |
mbligh | 2e4e5df | 2007-11-05 17:22:46 +0000 | [diff] [blame] | 12 | |
jadmanski | 22ab069 | 2008-05-01 22:22:51 +0000 | [diff] [blame] | 13 | total_wall_time_start = time.time() |
| 14 | |
| 15 | import common |
| 16 | from autotest_lib.tko import display, frontend, db, query_lib |
| 17 | from autotest_lib.client.bin import kernel_versions |
mbligh | 12eebfa | 2008-01-03 02:01:53 +0000 | [diff] [blame] | 18 | |
mbligh | 190a81d | 2007-11-05 20:40:38 +0000 | [diff] [blame] | 19 | html_header = """\ |
| 20 | <form action="compose_query.cgi" method="get"> |
| 21 | <table border="0"> |
| 22 | <tr> |
| 23 | <td>Column: </td> |
| 24 | <td>Row: </td> |
| 25 | <td>Condition: </td> |
mbligh | 44710b6 | 2008-03-07 00:25:43 +0000 | [diff] [blame] | 26 | <td align="center"> |
| 27 | <a href="http://test.kernel.org/autotest/AutotestTKOCondition">Help</a> |
| 28 | </td> |
mbligh | 190a81d | 2007-11-05 20:40:38 +0000 | [diff] [blame] | 29 | </tr> |
| 30 | <tr> |
| 31 | <td> |
| 32 | <SELECT NAME="columns"> |
| 33 | %s |
| 34 | </SELECT> |
| 35 | </td> |
| 36 | <td> |
| 37 | <SELECT NAME="rows"> |
| 38 | %s |
| 39 | </SELECT> |
| 40 | </td> |
| 41 | <td> |
mbligh | 44710b6 | 2008-03-07 00:25:43 +0000 | [diff] [blame] | 42 | <input type="text" name="condition" size="30" value="%s"> |
mbligh | be25745 | 2008-04-16 23:29:13 +0000 | [diff] [blame] | 43 | <input type="hidden" name="title" value="%s"> |
mbligh | 190a81d | 2007-11-05 20:40:38 +0000 | [diff] [blame] | 44 | </td> |
| 45 | <td align="center"><input type="submit" value="Submit"> |
| 46 | </td> |
| 47 | </tr> |
| 48 | </table> |
| 49 | </form> |
mbligh | 5a42d85 | 2008-05-15 23:49:04 +0000 | [diff] [blame] | 50 | <form action="save_query.cgi" method="get"> |
| 51 | <table border="0"> |
| 52 | <tr> |
| 53 | <td>Name your query: </td> |
| 54 | <td> |
| 55 | <input type="text" name="label" size="15" value=""> |
| 56 | </td> |
| 57 | <td align="center"> <input type="submit" value="Save Query"> |
| 58 | </td> |
| 59 | <td> <a href="query_history.cgi">View saved queries</a></td> |
| 60 | </tr> |
| 61 | </table> |
| 62 | </form> |
mbligh | 190a81d | 2007-11-05 20:40:38 +0000 | [diff] [blame] | 63 | """ |
| 64 | |
mbligh | 12eebfa | 2008-01-03 02:01:53 +0000 | [diff] [blame] | 65 | |
mbligh | 5dd503b | 2008-01-03 16:35:27 +0000 | [diff] [blame] | 66 | next_field = { |
mbligh | 44710b6 | 2008-03-07 00:25:43 +0000 | [diff] [blame] | 67 | 'machine_group': 'hostname', |
| 68 | 'hostname': 'tag', |
| 69 | 'tag': 'tag', |
mbligh | 5dd503b | 2008-01-03 16:35:27 +0000 | [diff] [blame] | 70 | |
mbligh | 44710b6 | 2008-03-07 00:25:43 +0000 | [diff] [blame] | 71 | 'kernel': 'test', |
| 72 | 'test': 'label', |
| 73 | 'label': 'tag', |
mbligh | 5dd503b | 2008-01-03 16:35:27 +0000 | [diff] [blame] | 74 | |
mbligh | 44710b6 | 2008-03-07 00:25:43 +0000 | [diff] [blame] | 75 | 'reason': 'tag', |
| 76 | 'user': 'tag', |
| 77 | 'status': 'tag', |
| 78 | |
mbligh | 5bb5586 | 2008-04-16 23:09:31 +0000 | [diff] [blame] | 79 | 'time': 'tag', |
| 80 | 'time_daily': 'time', |
mbligh | 5dd503b | 2008-01-03 16:35:27 +0000 | [diff] [blame] | 81 | } |
| 82 | |
| 83 | |
mbligh | 11204f8 | 2008-04-16 23:30:07 +0000 | [diff] [blame] | 84 | def parse_field(form, form_field, field_default): |
| 85 | if not form_field in form: |
| 86 | return field_default |
mbligh | 12eebfa | 2008-01-03 02:01:53 +0000 | [diff] [blame] | 87 | field_input = form[form_field].value.lower() |
mbligh | 2ba3e73 | 2008-01-16 01:30:19 +0000 | [diff] [blame] | 88 | if field_input and field_input in frontend.test_view_field_dict: |
mbligh | 12eebfa | 2008-01-03 02:01:53 +0000 | [diff] [blame] | 89 | return field_input |
mbligh | 11204f8 | 2008-04-16 23:30:07 +0000 | [diff] [blame] | 90 | return field_default |
mbligh | 12eebfa | 2008-01-03 02:01:53 +0000 | [diff] [blame] | 91 | |
| 92 | |
| 93 | def parse_condition(form, form_field, field_default): |
| 94 | if not form_field in form: |
| 95 | return field_default |
| 96 | return form[form_field].value |
| 97 | |
| 98 | |
| 99 | form = cgi.FieldStorage() |
mbligh | 3d7a5f5 | 2008-04-16 23:06:36 +0000 | [diff] [blame] | 100 | |
mbligh | be25745 | 2008-04-16 23:29:13 +0000 | [diff] [blame] | 101 | title_field = parse_condition(form, 'title', '') |
mbligh | 9add588 | 2008-04-16 23:32:01 +0000 | [diff] [blame] | 102 | row = parse_field(form, 'rows', 'kernel') |
| 103 | column = parse_field(form, 'columns', 'machine_group') |
| 104 | condition_field = parse_condition(form, 'condition', '') |
mbligh | 44710b6 | 2008-03-07 00:25:43 +0000 | [diff] [blame] | 105 | |
mbligh | 5684b03 | 2008-06-06 14:25:35 +0000 | [diff] [blame^] | 106 | if 'brief' in form.keys() and form['brief'].value <> '0': |
| 107 | display.set_brief_mode() |
| 108 | |
mbligh | 439661b | 2008-02-19 15:57:53 +0000 | [diff] [blame] | 109 | ## caller can specify rows and columns that shall be included into the report |
| 110 | ## regardless of whether actual test data is available yet |
| 111 | force_row_field = parse_condition(form,'force_row','') |
| 112 | force_column_field = parse_condition(form,'force_column','') |
mbligh | 190a81d | 2007-11-05 20:40:38 +0000 | [diff] [blame] | 113 | |
mbligh | 9add588 | 2008-04-16 23:32:01 +0000 | [diff] [blame] | 114 | |
mbligh | 439661b | 2008-02-19 15:57:53 +0000 | [diff] [blame] | 115 | def split_forced_fields(force_field): |
| 116 | if force_field: |
| 117 | return force_field.split() |
| 118 | else: |
| 119 | return [] |
| 120 | |
| 121 | force_row = split_forced_fields(force_row_field) |
| 122 | force_column = split_forced_fields(force_column_field) |
| 123 | |
mbligh | 2e4e5df | 2007-11-05 17:22:46 +0000 | [diff] [blame] | 124 | cgitb.enable() |
mbligh | aea0960 | 2008-04-16 22:59:37 +0000 | [diff] [blame] | 125 | db_obj = db.db() |
mbligh | 2e4e5df | 2007-11-05 17:22:46 +0000 | [diff] [blame] | 126 | |
mbligh | 12eebfa | 2008-01-03 02:01:53 +0000 | [diff] [blame] | 127 | |
mbligh | 2ba3e73 | 2008-01-16 01:30:19 +0000 | [diff] [blame] | 128 | def construct_link(x, y): |
| 129 | next_row = row |
| 130 | next_column = column |
mbligh | 5dd503b | 2008-01-03 16:35:27 +0000 | [diff] [blame] | 131 | condition_list = [] |
| 132 | if condition_field != '': |
| 133 | condition_list.append(condition_field) |
mbligh | 2ba3e73 | 2008-01-16 01:30:19 +0000 | [diff] [blame] | 134 | if y: |
| 135 | next_row = next_field[row] |
| 136 | condition_list.append("%s='%s'" % (row, y)) |
| 137 | if x: |
| 138 | next_column = next_field[column] |
| 139 | condition_list.append("%s='%s'" % (column, x)) |
mbligh | b180f6c | 2008-01-04 20:24:41 +0000 | [diff] [blame] | 140 | next_condition = '&'.join(condition_list) |
mbligh | be25745 | 2008-04-16 23:29:13 +0000 | [diff] [blame] | 141 | link = 'compose_query.cgi?' + urllib.urlencode({'columns': next_column, |
| 142 | 'rows': next_row, 'condition': next_condition, |
| 143 | 'title': title_field}) |
| 144 | return link |
mbligh | 5dd503b | 2008-01-03 16:35:27 +0000 | [diff] [blame] | 145 | |
| 146 | |
mbligh | 38e9d78 | 2008-05-01 20:49:41 +0000 | [diff] [blame] | 147 | def construct_logs_link(x, y, job_tag): |
| 148 | job_path = frontend.html_root + job_tag + '/' |
| 149 | test = '' |
| 150 | if (row == 'test' and |
| 151 | not y.split('.')[0] in ('boot', 'build', 'install')): |
| 152 | test = y |
| 153 | if (column == 'test' and |
| 154 | not x.split('.')[0] in ('boot', 'build', 'install')): |
| 155 | test = x |
| 156 | return 'retrieve_logs.cgi?' + urllib.urlencode({'job' : job_path, |
| 157 | 'test' : test}) |
| 158 | |
| 159 | |
mbligh | 12eebfa | 2008-01-03 02:01:53 +0000 | [diff] [blame] | 160 | def create_select_options(selected_val): |
mbligh | 190a81d | 2007-11-05 20:40:38 +0000 | [diff] [blame] | 161 | ret = "" |
mbligh | 2ba3e73 | 2008-01-16 01:30:19 +0000 | [diff] [blame] | 162 | for option in sorted(frontend.test_view_field_dict.keys()): |
mbligh | 190a81d | 2007-11-05 20:40:38 +0000 | [diff] [blame] | 163 | if selected_val == option: |
| 164 | selected = " SELECTED" |
| 165 | else: |
| 166 | selected = "" |
| 167 | |
mbligh | 2ba3e73 | 2008-01-16 01:30:19 +0000 | [diff] [blame] | 168 | ret += '<OPTION VALUE="%s"%s>%s</OPTION>\n' % \ |
| 169 | (option, selected, option) |
mbligh | 190a81d | 2007-11-05 20:40:38 +0000 | [diff] [blame] | 170 | return ret |
| 171 | |
| 172 | |
apw | 7a7316b | 2008-02-21 17:42:05 +0000 | [diff] [blame] | 173 | def map_kernel_base(kernel_name): |
mbligh | 439661b | 2008-02-19 15:57:53 +0000 | [diff] [blame] | 174 | ## insert <br> after each / in kernel name |
| 175 | ## but spare consequtive // |
mbligh | 8e7c78e | 2008-02-20 21:18:49 +0000 | [diff] [blame] | 176 | kernel_name = kernel_name.replace('/','/<br>') |
| 177 | kernel_name = kernel_name.replace('/<br>/<br>','//') |
mbligh | 439661b | 2008-02-19 15:57:53 +0000 | [diff] [blame] | 178 | return kernel_name |
| 179 | |
| 180 | |
mbligh | 44710b6 | 2008-03-07 00:25:43 +0000 | [diff] [blame] | 181 | def header_tuneup(field_name, header): |
| 182 | ## header tune up depends on particular field name and may include: |
| 183 | ## - breaking header into several strings if it is long url |
| 184 | ## - creating date from datetime stamp |
| 185 | ## - possibly, expect more various refinements for different fields |
| 186 | if field_name == 'kernel': |
| 187 | return map_kernel_base(header) |
mbligh | 44710b6 | 2008-03-07 00:25:43 +0000 | [diff] [blame] | 188 | else: |
| 189 | return header |
| 190 | |
| 191 | |
apw | 7a7316b | 2008-02-21 17:42:05 +0000 | [diff] [blame] | 192 | # Kernel name mappings -- the kernels table 'printable' field is |
| 193 | # effectively a sortable identifier for the kernel It encodes the base |
| 194 | # release which is used for overall sorting, plus where patches are |
| 195 | # applied it adds an increasing pNNN patch combination identifier |
| 196 | # (actually the kernel_idx for the entry). This allows sorting |
| 197 | # as normal by the base kernel version and then sub-sorting by the |
| 198 | # "first time we saw" a patch combination which should keep them in |
| 199 | # approximatly date order. This patch identifier is not suitable |
| 200 | # for display, so we have to map it to a suitable html fragment for |
| 201 | # display. This contains the kernel base version plus the truncated |
| 202 | # names of all the patches, |
| 203 | # |
| 204 | # 2.6.24-mm1 p112 |
| 205 | # +add-new-string-functions- |
| 206 | # +x86-amd-thermal-interrupt |
| 207 | # |
| 208 | # This mapping is produced when the first mapping is request, with |
| 209 | # a single query over the patches table; the result is then cached. |
| 210 | # |
| 211 | # Note: that we only count a base version as patched if it contains |
| 212 | # patches which are not already "expressed" in the base version. |
| 213 | # This includes both -gitN and -mmN kernels. |
| 214 | map_kernel_map = None |
| 215 | |
| 216 | |
| 217 | def map_kernel_init(): |
| 218 | fields = ['base', 'k.kernel_idx', 'name', 'url'] |
| 219 | map = {} |
mbligh | aea0960 | 2008-04-16 22:59:37 +0000 | [diff] [blame] | 220 | for (base, idx, name, url) in db_obj.select(','.join(fields), |
apw | 7a7316b | 2008-02-21 17:42:05 +0000 | [diff] [blame] | 221 | 'kernels k,patches p', 'k.kernel_idx=p.kernel_idx'): |
| 222 | match = re.match(r'.*(-mm[0-9]+|-git[0-9]+)\.(bz2|gz)$', url) |
| 223 | if match: |
| 224 | continue |
| 225 | |
| 226 | key = base + ' p%d' % (idx) |
| 227 | if not map.has_key(key): |
| 228 | map[key] = map_kernel_base(base) + ' p%d' % (idx) |
mbligh | 5a42d85 | 2008-05-15 23:49:04 +0000 | [diff] [blame] | 229 | map[key] += ('<br>+<span title="' + name + '">' + |
| 230 | name[0:25] + '</span>') |
apw | 7a7316b | 2008-02-21 17:42:05 +0000 | [diff] [blame] | 231 | |
| 232 | return map |
| 233 | |
| 234 | |
| 235 | def map_kernel(name): |
| 236 | global map_kernel_map |
| 237 | if map_kernel_map == None: |
| 238 | map_kernel_map = map_kernel_init() |
| 239 | |
| 240 | if map_kernel_map.has_key(name): |
| 241 | return map_kernel_map[name] |
| 242 | |
| 243 | return map_kernel_base(name.split(' ')[0]) |
| 244 | |
| 245 | |
| 246 | field_map = { |
| 247 | 'kernel':map_kernel |
| 248 | } |
| 249 | |
jadmanski | 36505a9 | 2008-05-01 22:07:02 +0000 | [diff] [blame] | 250 | sql_wall_time = 0 |
apw | 7a7316b | 2008-02-21 17:42:05 +0000 | [diff] [blame] | 251 | |
mbligh | 12eebfa | 2008-01-03 02:01:53 +0000 | [diff] [blame] | 252 | def gen_matrix(): |
mbligh | 12eebfa | 2008-01-03 02:01:53 +0000 | [diff] [blame] | 253 | where = None |
| 254 | if condition_field.strip() != '': |
mbligh | 44710b6 | 2008-03-07 00:25:43 +0000 | [diff] [blame] | 255 | try: |
| 256 | where = query_lib.parse_scrub_and_gen_condition( |
| 257 | condition_field, frontend.test_view_field_dict) |
| 258 | print "<!-- where clause: %s -->" % (where,) |
| 259 | except: |
| 260 | msg = "Unspecified error when parsing condition" |
| 261 | return [[display.box(msg)]] |
mbligh | 2e4e5df | 2007-11-05 17:22:46 +0000 | [diff] [blame] | 262 | |
jadmanski | 36505a9 | 2008-05-01 22:07:02 +0000 | [diff] [blame] | 263 | wall_time_start = time.time() |
mbligh | aea0960 | 2008-04-16 22:59:37 +0000 | [diff] [blame] | 264 | try: |
mbligh | 3126069 | 2008-04-16 23:12:12 +0000 | [diff] [blame] | 265 | ## Unfortunately, we can not request reasons of failure always |
| 266 | ## because it may result in an inflated size of data transfer |
| 267 | ## (at the moment we fetch 500 bytes of reason descriptions into |
| 268 | ## each cell ) |
| 269 | ## If 'status' in [row,column] then either width or height |
| 270 | ## of the table <=7, hence table is not really 2D, and |
| 271 | ## query_reason is relatively save. |
| 272 | ## At the same time view when either rows or columns grouped |
| 273 | ## by status is when users need reasons of failures the most. |
| 274 | |
| 275 | ## TO DO: implement [Show/Hide reasons] button or link in |
| 276 | ## all views and make thorough performance testing |
| 277 | test_data = frontend.get_matrix_data(db_obj, column, row, where, |
| 278 | query_reasons = ('status' in [row,column]) |
| 279 | ) |
jadmanski | 36505a9 | 2008-05-01 22:07:02 +0000 | [diff] [blame] | 280 | global sql_wall_time |
| 281 | sql_wall_time = time.time() - wall_time_start |
| 282 | |
mbligh | aea0960 | 2008-04-16 22:59:37 +0000 | [diff] [blame] | 283 | except db.MySQLTooManyRows, error: |
| 284 | return [[display.box(str(error))]] |
mbligh | 44710b6 | 2008-03-07 00:25:43 +0000 | [diff] [blame] | 285 | |
mbligh | 439661b | 2008-02-19 15:57:53 +0000 | [diff] [blame] | 286 | for f_row in force_row: |
| 287 | if not f_row in test_data.y_values: |
| 288 | test_data.y_values.append(f_row) |
| 289 | for f_column in force_column: |
| 290 | if not f_column in test_data.x_values: |
| 291 | test_data.x_values.append(f_column) |
mbligh | 2e4e5df | 2007-11-05 17:22:46 +0000 | [diff] [blame] | 292 | |
mbligh | 2ba3e73 | 2008-01-16 01:30:19 +0000 | [diff] [blame] | 293 | if not test_data.y_values: |
mbligh | 12eebfa | 2008-01-03 02:01:53 +0000 | [diff] [blame] | 294 | msg = "There are no results for this query (yet?)." |
| 295 | return [[display.box(msg)]] |
mbligh | 2e4e5df | 2007-11-05 17:22:46 +0000 | [diff] [blame] | 296 | |
mbligh | 456b477 | 2008-03-25 23:54:45 +0000 | [diff] [blame] | 297 | dict_url = {'columns': row, |
mbligh | be25745 | 2008-04-16 23:29:13 +0000 | [diff] [blame] | 298 | 'rows': column, 'condition': condition_field, |
| 299 | 'title': title_field} |
mbligh | 456b477 | 2008-03-25 23:54:45 +0000 | [diff] [blame] | 300 | link = 'compose_query.cgi?' + urllib.urlencode(dict_url) |
mbligh | 5dd503b | 2008-01-03 16:35:27 +0000 | [diff] [blame] | 301 | header_row = [display.box("<center>(Flip Axis)</center>", link=link)] |
| 302 | |
mbligh | 2ba3e73 | 2008-01-16 01:30:19 +0000 | [diff] [blame] | 303 | for x in test_data.x_values: |
apw | 7a7316b | 2008-02-21 17:42:05 +0000 | [diff] [blame] | 304 | dx = x |
| 305 | if field_map.has_key(column): |
| 306 | dx = field_map[column](x) |
mbligh | 44710b6 | 2008-03-07 00:25:43 +0000 | [diff] [blame] | 307 | x_header = header_tuneup(column, dx) |
| 308 | link = construct_link(x, None) |
| 309 | header_row.append(display.box(x_header,header=True,link=link)) |
mbligh | 2e4e5df | 2007-11-05 17:22:46 +0000 | [diff] [blame] | 310 | |
| 311 | matrix = [header_row] |
jadmanski | f9fa427 | 2008-05-02 15:43:33 +0000 | [diff] [blame] | 312 | # For each row, we are looping horizontally over the columns. |
mbligh | 2ba3e73 | 2008-01-16 01:30:19 +0000 | [diff] [blame] | 313 | for y in test_data.y_values: |
apw | 7a7316b | 2008-02-21 17:42:05 +0000 | [diff] [blame] | 314 | dy = y |
| 315 | if field_map.has_key(row): |
| 316 | dy = field_map[row](y) |
mbligh | 44710b6 | 2008-03-07 00:25:43 +0000 | [diff] [blame] | 317 | y_header = header_tuneup(row, dy) |
mbligh | 5bb5586 | 2008-04-16 23:09:31 +0000 | [diff] [blame] | 318 | link = construct_link(None, y) |
mbligh | 44710b6 | 2008-03-07 00:25:43 +0000 | [diff] [blame] | 319 | cur_row = [display.box(y_header, header=True, link=link)] |
mbligh | 2ba3e73 | 2008-01-16 01:30:19 +0000 | [diff] [blame] | 320 | for x in test_data.x_values: |
mbligh | 44710b6 | 2008-03-07 00:25:43 +0000 | [diff] [blame] | 321 | ## next 2 lines: temporary, until non timestamped |
| 322 | ## records are in the database |
| 323 | if x==datetime.datetime(1970,1,1): x = None |
| 324 | if y==datetime.datetime(1970,1,1): y = None |
mbligh | 12eebfa | 2008-01-03 02:01:53 +0000 | [diff] [blame] | 325 | try: |
mbligh | 3126069 | 2008-04-16 23:12:12 +0000 | [diff] [blame] | 326 | box_data = test_data.data[x][y] |
mbligh | 12eebfa | 2008-01-03 02:01:53 +0000 | [diff] [blame] | 327 | except: |
jadmanski | f9fa427 | 2008-05-02 15:43:33 +0000 | [diff] [blame] | 328 | cur_row.append(display.box(None, None, |
mbligh | 5a42d85 | 2008-05-15 23:49:04 +0000 | [diff] [blame] | 329 | row_label=y, column_label=x)) |
mbligh | 12eebfa | 2008-01-03 02:01:53 +0000 | [diff] [blame] | 330 | continue |
mbligh | 2ba3e73 | 2008-01-16 01:30:19 +0000 | [diff] [blame] | 331 | job_tag = test_data.data[x][y].job_tag |
mbligh | 5dd503b | 2008-01-03 16:35:27 +0000 | [diff] [blame] | 332 | if job_tag: |
mbligh | 38e9d78 | 2008-05-01 20:49:41 +0000 | [diff] [blame] | 333 | link = construct_logs_link(x, y, job_tag) |
mbligh | 5dd503b | 2008-01-03 16:35:27 +0000 | [diff] [blame] | 334 | else: |
mbligh | 2ba3e73 | 2008-01-16 01:30:19 +0000 | [diff] [blame] | 335 | link = construct_link(x, y) |
jadmanski | f9fa427 | 2008-05-02 15:43:33 +0000 | [diff] [blame] | 336 | |
mbligh | 5a42d85 | 2008-05-15 23:49:04 +0000 | [diff] [blame] | 337 | apnd = display.status_precounted_box(db_obj, box_data, |
| 338 | link, y, x) |
| 339 | cur_row.append(apnd) |
mbligh | 12eebfa | 2008-01-03 02:01:53 +0000 | [diff] [blame] | 340 | matrix.append(cur_row) |
mbligh | 12eebfa | 2008-01-03 02:01:53 +0000 | [diff] [blame] | 341 | return matrix |
mbligh | 2b67253 | 2007-11-05 19:24:51 +0000 | [diff] [blame] | 342 | |
mbligh | 2b67253 | 2007-11-05 19:24:51 +0000 | [diff] [blame] | 343 | |
mbligh | 12eebfa | 2008-01-03 02:01:53 +0000 | [diff] [blame] | 344 | def main(): |
mbligh | 5684b03 | 2008-06-06 14:25:35 +0000 | [diff] [blame^] | 345 | if display.is_brief_mode(): |
| 346 | ## create main grid table only as provided by gen_matrix() |
| 347 | display.print_table(gen_matrix()) |
| 348 | else: |
| 349 | # create the actual page |
| 350 | print '<html><head><title>' |
| 351 | print 'Filtered Autotest Results' |
| 352 | print '</title></head><body>' |
| 353 | display.print_main_header() |
| 354 | print html_header % (create_select_options(column), |
| 355 | create_select_options(row), |
| 356 | condition_field, title_field) |
| 357 | if title_field: |
| 358 | print '<h1> %s </h1>' % (title_field) |
| 359 | print display.color_keys_row() |
| 360 | display.print_table(gen_matrix()) |
| 361 | print display.color_keys_row() |
| 362 | total_wall_time = time.time() - total_wall_time_start |
| 363 | |
| 364 | perf_info = '<p style="font-size:x-small;">' |
| 365 | perf_info += 'sql access wall time = %s secs,' % sql_wall_time |
| 366 | perf_info += 'total wall time = %s secs</p>' % total_wall_time |
| 367 | print perf_info |
| 368 | print '</body></html>' |
| 369 | |
mbligh | 2e4e5df | 2007-11-05 17:22:46 +0000 | [diff] [blame] | 370 | |
mbligh | 2e4e5df | 2007-11-05 17:22:46 +0000 | [diff] [blame] | 371 | main() |