summaryrefslogtreecommitdiff
path: root/tko/group_test.cgi
blob: 82e311b66af97f0c93e062597ab4daf615b43ada (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/python
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():
	display.print_main_header()

	form = cgi.FieldStorage()
	kernel_idx = form["kernel"].value
	kernel = frontend.kernel.select(db, {'kernel_idx' : kernel_idx })[0]
	groups = frontend.group.select(db)

	print_kernel_groups_vs_tests(kernel, groups)


def print_kernel_groups_vs_tests(kernel, groups):
	# first we have to get a list of all run tests across all machines
	all_tests = set()
	present_groups = []
	for group in groups:
		tests = group.tests({ 'kernel_idx' : kernel.idx })
		if tests:
			present_groups.append(group)
		for test in tests:
			all_tests.add(test.testname)
	all_tests = list(all_tests)
	all_tests.sort()
		
	print '<h1>%s</h1>' % kernel.printable

	header_row = [ display.box('Test', header=True) ]
	for group in present_groups:
		group_name = display.group_name(group)
		header_row.append( display.box(group_name, header=True) )

	matrix = [header_row]
	for testname in all_tests:
		shortname = re.sub(r'kernel.', r'kernel<br>', testname)
		row = [display.box(shortname)]
		for group in present_groups:
			tests = group.tests({ 'kernel_idx' : kernel.idx ,
					      'test' : testname })
			link = 'machine_kernel_test.cgi?'
			link += 'group=%s&kernel=%s&test=%s' % \
					(group.name, kernel.idx, testname)
			box = display.status_count_box(db, tests, link=link)
			row.append(box)
		matrix.append(row)
	matrix.append(header_row)

	display.print_table(matrix)

main()