summaryrefslogtreecommitdiff
path: root/tko/test.cgi
diff options
context:
space:
mode:
authormbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4>2007-11-05 17:22:46 +0000
committermbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4>2007-11-05 17:22:46 +0000
commit460280c1b01806ad52cf67b0d6bdaf0613fbd49c (patch)
tree5711ca62aeddc36a875a9b1f2d16f6944ca1481a /tko/test.cgi
parente35eb59dbeb77cf5b6ea047324dc93af8d841174 (diff)
Add reporting support for backend.
From: Radha Ramachandran <radha@google.com> Signed-off-by: Martin Bligh <mbligh@google.com> git-svn-id: svn://test.kernel.org/autotest/trunk@880 592f7852-d20e-0410-864c-8624ca9c26a4
Diffstat (limited to 'tko/test.cgi')
-rw-r--r--tko/test.cgi67
1 files changed, 67 insertions, 0 deletions
diff --git a/tko/test.cgi b/tko/test.cgi
new file mode 100644
index 00000000..dd858b00
--- /dev/null
+++ b/tko/test.cgi
@@ -0,0 +1,67 @@
+#!/usr/bin/python
+"""
+Further display the tests in a matrix of the form tests X machines
+to help understand the results selected from the previous form.
+"""
+
+print "Content-type: text/html\n"
+import cgi, cgitb, os, sys, re
+sys.stdout.flush()
+cgitb.enable()
+
+tko = os.path.dirname(os.path.realpath(os.path.abspath(sys.argv[0])))
+sys.path.insert(0, tko)
+import db, display, frontend
+
+db = db.db()
+
+def main():
+ form = cgi.FieldStorage()
+
+ if form.has_key('sql'):
+ sql = form['sql'].value
+
+ if form.has_key('values'):
+ values = [val for val in form['values'].value.split(',')]
+
+ if not sql:
+ return
+ if not values:
+ return
+
+ tests = frontend.test.select_sql(db, sql, values)
+
+ # get the list of tests/machines to populate the row and column header.
+ testname = [test.testname for test in tests]
+ machine_idx = [test.machine_idx for test in tests]
+
+ # We dont want repetitions in the table row/column headers,
+ # so eliminate the dups.
+ uniq_test = list(set(testname))
+ uniq_machine_idx = list(set(machine_idx))
+
+ header_row = [ display.box('', header = True) ]
+ for test_name in uniq_test:
+ header_row.append(display.box(test_name, header=True))
+ matrix = [header_row]
+ for machine in uniq_machine_idx:
+ mach_name = db.select_sql('hostname', 'machines',
+ ' where machine_idx=%s', [str(machine)])
+ row = [display.box(mach_name[0][0])]
+ for test_name in uniq_test:
+ testlist = [test for test in tests
+ if test.machine_idx == machine
+ and test.testname == test_name]
+ # url link to the first test.
+ # TODO: provide another level to show the different
+ # test results.
+ link = None
+ if testlist and testlist[0]:
+ link = testlist[0].url
+ box = display.status_count_box(db, testlist, link=link)
+ row.append(box)
+ matrix.append(row)
+ display.print_table(matrix)
+
+main()
+