Improved sorting in performance reports

This commit is contained in:
Andrey Kamaev 2011-11-22 13:57:44 +00:00
parent 40d82c0720
commit 7fb5b5f218
2 changed files with 9 additions and 3 deletions

View File

@ -32,6 +32,9 @@ def keyselector(a):
return ((channels-1) & 511) + (depth << 9)
return a
convert = lambda text: int(text) if text.isdigit() else text
alphanum_keyselector = lambda key: [ convert(c) for c in re.split('([0-9]+)', keyselector(key)) ]
def getValueParams(test):
param = test.get("value_param")
if not param:
@ -174,7 +177,7 @@ if __name__ == "__main__":
exit(1)
for i in range(argsnum):
arglists[i] = sorted([str(key) for key in arglists[i].iterkeys()], key=keyselector)
arglists[i] = sorted([str(key) for key in arglists[i].iterkeys()], key=alphanum_keyselector)
if options.generateHtml and options.format != "moinwiki":
htmlPrintHeader(sys.stdout, "Report %s for %s" % (args[0], sname))

View File

@ -2,6 +2,9 @@ import testlog_parser, sys, os, xml, glob, re
from table_formatter import *
from optparse import OptionParser
convert = lambda text: int(text) if text.isdigit() else text
alphanum_keyselector = lambda key: [ convert(c) for c in re.split('([0-9]+)', key) ]
def getSetName(tset, idx, columns, short = True):
if columns and len(columns) >= idx:
prefix = columns[idx]
@ -121,7 +124,7 @@ if __name__ == "__main__":
# rows
needNewRow = True
for name in sorted(test_cases.iterkeys()):
for name in sorted(test_cases.iterkeys(), key=alphanum_keyselector):
cases = test_cases[name]
if needNewRow:
tbl.newRow()