3 Further display the tests in a matrix of the form tests X machines
4 to help understand the results selected from the previous form.
7 print "Content-type: text/html\n"
8 import cgi
, cgitb
, os
, sys
, re
13 from autotest_lib
.tko
import db
, display
, frontend
18 display
.print_main_header()
20 form
= cgi
.FieldStorage()
22 if form
.has_key('sql'):
23 sql
= form
['sql'].value
25 if form
.has_key('values'):
26 values
= [val
for val
in form
['values'].value
.split(',')]
33 tests
= frontend
.test
.select_sql(db
, sql
, values
)
35 # get the list of tests/machines to populate the row and column header.
36 testname
= [test
.testname
for test
in tests
]
37 machine_idx
= [test
.machine_idx
for test
in tests
]
39 # We dont want repetitions in the table row/column headers,
40 # so eliminate the dups.
41 uniq_test
= list(set(testname
))
42 uniq_machine_idx
= list(set(machine_idx
))
44 header_row
= [ display
.box('', header
= True) ]
45 for test_name
in uniq_test
:
46 header_row
.append(display
.box(test_name
, header
=True))
48 for machine
in uniq_machine_idx
:
49 mach_name
= db
.select_sql('hostname', 'machines',
50 ' where machine_idx=%s', [str(machine
)])
51 row
= [display
.box(mach_name
[0][0])]
52 for test_name
in uniq_test
:
53 testlist
= [test
for test
in tests
54 if test
.machine_idx
== machine
55 and test
.testname
== test_name
]
56 # url link to the first test.
57 # TODO: provide another level to show the different
60 if testlist
and testlist
[0]:
61 link
= testlist
[0].url
62 box
= display
.status_count_box(db
, testlist
, link
=link
)
65 display
.print_table(matrix
)