#!/usr/bin/env python import string import cgi ident = '$Id: interop2html.py 4 2001-06-27 21:36:11Z cullman $' lines = open('output.txt').readlines() #preserve the tally tally = lines[-6:] #whack the tally from lines lines = lines[:-6] table={} for line in lines: if line[:3] == ' ' or line == '>\n' : continue line = line[:-1] #delete end of line char row = [line[:line.find(': ')], line[line.find(': ')+2:]] #split server name from rest of line restofrow = row[1].split(' ',3) #break out method name, number, status code, status comment if len(restofrow) > 3: if restofrow[3].find('as expected') != -1: restofrow[2] = restofrow[2] + ' (as expected)' elif restofrow[3][:2] == '- ' : restofrow[3] = restofrow[3][2:] try: table[row[0]].append([restofrow[0],restofrow[2:]]) except KeyError: table[row[0]] = [[restofrow[0],restofrow[2:]]] print "" print "" print "
" for x in tally: z = x[:-1].split(":",1) print "" print "
Summary
",z[0],"",z[1],"

" c = 0 totalmethods = len(table[table.keys()[0]]) while c < totalmethods: print "
" print "" cols = [c, c + 1, c + 2] if c != 16: cols += [c + 3] for i in cols: try: header = table[table.keys()[0]][i][0] except: break print "" print "" l = table.keys() l.sort() for key in l: print "" for i in cols: try: status = table[key][i][1][0] except: break if status.find("succeed") != -1: bgcolor = "#339900" status = "Pass" elif status.find("expected") != -1: bgcolor = "#FF9900" hreftitle = table[key][i][1][1].replace("'","") # remove apostrophes from title properties popuphtml = '"' + cgi.escape(cgi.escape(table[key][i][1][1]).replace("'","'").replace('"',""")) + '"' status = "Failed (expected)" else: bgcolor = "#CC0000" hreftitle = table[key][i][1][1].replace("'","") # remove apostrophes from title properties popuphtml = '"' + cgi.escape(cgi.escape(table[key][i][1][1]).replace("'","'").replace('"',""")) + '"' status = "Failed" print "" print "" print "
",header,"
", key , "" , status , "
" c = c + len(cols) print ""