daca2-report: attempt to speedup report

This commit is contained in:
Daniel Marjamäki 2018-06-29 18:14:15 +02:00
parent ba8529ce32
commit da2867c09a
1 changed files with 22 additions and 11 deletions

View File

@ -47,7 +47,7 @@ def summaryHtml(style, font, severity, categories, totalNumber):
def getWarnings(filename): def getWarnings(filename):
ftp = '' ftp = ''
warnings = [] warnings = {}
pattern = re.compile(r'(.*:[0-9]+):[0-9]+: (error|warning|style|performance|portability)(:.* \[[a-zA-Z0-9_\\-]+\])') pattern = re.compile(r'(.*:[0-9]+):[0-9]+: (error|warning|style|performance|portability)(:.* \[[a-zA-Z0-9_\\-]+\])')
for line in open(filename, 'rt'): for line in open(filename, 'rt'):
line = line.strip('\r\n') line = line.strip('\r\n')
@ -56,21 +56,24 @@ def getWarnings(filename):
continue continue
res = pattern.match(line) res = pattern.match(line)
if res: if res:
warnings.append(ftp + '\n' + res.group(1) + ': ' + res.group(2) + res.group(3)) warnings[ftp + '\n' + res.group(1) + ': ' + res.group(2) + res.group(3)] = 1
return warnings return warnings
def getUnique(warnings1, warnings2): def getUnique(warnings1, warnings2):
ret = '' ret = ''
count = 0 count = 0
for w in warnings1: for w in warnings1.keys():
if w not in warnings2: if w not in warnings2:
ret = ret + w + '\n' ret = ret + w + '\n'
count = count + 1 count = count + 1
return ret, count return ret, count
def diffResults(reportpath): def diffResults(reportpath):
warnings_base = [] negatives = ''
warnings_head = [] count_negatives = 0
positives = ''
count_positives = 0
for lib in ['', 'lib']: for lib in ['', 'lib']:
for a in "0123456789abcdefghijklmnopqrstuvwxyz": for a in "0123456789abcdefghijklmnopqrstuvwxyz":
@ -79,17 +82,25 @@ def diffResults(reportpath):
if not os.path.isfile(daca2folder + lib + a + '/results-head.txt'): if not os.path.isfile(daca2folder + lib + a + '/results-head.txt'):
continue continue
warnings_base.extend(getWarnings(daca2folder + lib + a + '/results-1.84.txt')) print('diffResults:' + lib + a)
warnings_head.extend(getWarnings(daca2folder + lib + a + '/results-head.txt'))
warnings_base = getWarnings(daca2folder + lib + a + '/results-1.84.txt')
warnings_head = getWarnings(daca2folder + lib + a + '/results-head.txt')
s, count = getUnique(warnings_base, warnings_head)
negatives += s
count_negatives += count
s, count = getUnique(warnings_head, warnings_base)
positives += s
count_positives += count
f = open(reportpath + 'negatives.txt', 'wt') f = open(reportpath + 'negatives.txt', 'wt')
s, count_negatives = getUnique(warnings_base, warnings_head) f.write(negatives)
f.write(s)
f.close() f.close()
f = open(reportpath + 'positives.txt', 'wt') f = open(reportpath + 'positives.txt', 'wt')
s, count_positives = getUnique(warnings_head, warnings_base) f.write(positives)
f.write(s)
f.close() f.close()
return count_negatives, count_positives return count_negatives, count_positives