Fix up group_test.cgi

Signed-off-by: Martin J. Bligh <mbligh@google.com>

        Fix bug in group_test.cgi - we want the test name, not it's 
        subdirectory (in this case it could be none, esp. for reboot.start)

        Only print machine groups which actually have tests against them

        Pretty printing for machine groups



git-svn-id: http://test.kernel.org/svn/autotest/trunk@983 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/tko/group_test.cgi b/tko/group_test.cgi
index 3df8e79..7374e98 100755
--- a/tko/group_test.cgi
+++ b/tko/group_test.cgi
@@ -24,24 +24,29 @@
 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:
-		for test in group.tests({ 'kernel_idx' : kernel.idx }):
-			all_tests.add(test.subdir)
+		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)
 		
 	print '<h1>%s</h1>' % kernel.printable
 
 	header_row = [ display.box('Test', header=True) ]
-	for group in groups:
-		header_row.append( display.box(group.name, header=True) )
+	for group in present_groups:
+		group_name = re.sub('_', '<br>', group.name)
+		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 groups:
+		for group in present_groups:
 			tests = group.tests({ 'kernel_idx' : kernel.idx ,
-					      'subdir' : testname })
+					      'test' : testname })
 			link = 'machine_kernel_test.cgi?'
 			link += 'group=%s&kernel=%s&test=%s' % \
 					(group.name, kernel.idx, testname)