Emscripten: Document failing getExceptionMessage
[LibreOffice.git] / bin / find-most-common-warn-messages.py
blob392fff74a08c8f98c21d51dbb11df0c13e7a1172
1 #!/usr/bin/python3
3 # A script to search our test logs and sort the messages by how common they are so we can start to
4 # reduce the noise a little.
6 import subprocess
8 # find . -name '*.log' | xargs grep -h 'warn:' | sort | uniq -c | sort -n --field-separator=: --key=5,6
10 process = subprocess.Popen("find workdir -name '*.log' | xargs grep -h 'warn:' | sort",
11 shell=True, stdout=subprocess.PIPE, universal_newlines=True)
13 messages = dict() # dict of sourceAndLine->count
14 sampleOfMessage = dict() # dict of sourceAndLine->string
15 for line in process.stdout:
16 line = line.strip()
17 # a sample line is:
18 # warn:sw:18790:1:sw/source/core/doc/DocumentRedlineManager.cxx:98: redline table corrupted: overlapping redlines
19 tokens = line.split(":")
20 sourceAndLine = tokens[4] + ":" + tokens[5]
21 if (sourceAndLine in messages):
22 messages[sourceAndLine] = messages[sourceAndLine] + 1
23 else:
24 messages[sourceAndLine] = 1
25 sampleOfMessage[sourceAndLine] = line[line.find(tokens[6]):]
27 tmplist = list() # set of tuple (count, sourceAndLine)
28 for key, value in messages.items():
29 tmplist.append([value,key])
31 print( "The top 20 warnings" )
32 print("")
33 for i in sorted(tmplist, key=lambda v: v[0])[-20:]:
34 print( "%6d %s %s" % (i[0], i[1], sampleOfMessage[i[1]]) )