donate-cpu.py: Add Cppcheck cmd line options to the output (#1581)

It is interesting what libraries, how many jobs, ... were used during analysis.
Tested locally.
This commit is contained in:
Sebastian 2019-01-09 18:38:00 +01:00 committed by GitHub
parent 7c168fa850
commit f673d552cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 4 deletions

View File

@ -222,7 +222,8 @@ def scanPackage(workPath, cppcheck, jobs):
libraries += ' --library=zlib' libraries += ' --library=zlib'
if hasInclude('temp', '<gtk/gtk.h>'): if hasInclude('temp', '<gtk/gtk.h>'):
libraries += ' --library=gtk' libraries += ' --library=gtk'
cmd = 'nice ' + cppcheck + ' ' + jobs + libraries + ' -D__GCC__ --inconclusive --enable=style --platform=unix64 --template=daca2 -rp=temp temp' options = jobs + libraries + ' -D__GCC__ --inconclusive --enable=style --platform=unix64 --template=daca2 -rp=temp temp'
cmd = 'nice ' + cppcheck + ' ' + options
print(cmd) print(cmd)
startTime = time.time() startTime = time.time()
p = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE) p = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
@ -244,7 +245,7 @@ def scanPackage(workPath, cppcheck, jobs):
if re.match(r'.*:[0-9]+:.*\]$', line): if re.match(r'.*:[0-9]+:.*\]$', line):
count += 1 count += 1
print('Number of issues: ' + str(count)) print('Number of issues: ' + str(count))
return count, stderr, elapsedTime return count, stderr, elapsedTime, options
def splitResults(results): def splitResults(results):
@ -396,12 +397,13 @@ while True:
count = '' count = ''
elapsedTime = '' elapsedTime = ''
resultsToDiff = [] resultsToDiff = []
cppcheck_options = ''
for ver in cppcheckVersions: for ver in cppcheckVersions:
if ver == 'head': if ver == 'head':
cppcheck = 'cppcheck/cppcheck' cppcheck = 'cppcheck/cppcheck'
else: else:
cppcheck = ver + '/cppcheck' cppcheck = ver + '/cppcheck'
c, errout, t = scanPackage(workpath, cppcheck, jobs) c, errout, t, cppcheck_options = scanPackage(workpath, cppcheck, jobs)
if c < 0: if c < 0:
crash = True crash = True
count += ' Crash!' count += ' Crash!'
@ -412,7 +414,8 @@ while True:
if not crash and len(resultsToDiff[0]) + len(resultsToDiff[1]) == 0: if not crash and len(resultsToDiff[0]) + len(resultsToDiff[1]) == 0:
print('No results') print('No results')
continue continue
output = 'cppcheck: ' + ' '.join(cppcheckVersions) + '\n' output = 'cppcheck-options: ' + cppcheck_options + '\n'
output += 'cppcheck: ' + ' '.join(cppcheckVersions) + '\n'
output += 'count:' + count + '\n' output += 'count:' + count + '\n'
output += 'elapsed-time:' + elapsedTime + '\n' output += 'elapsed-time:' + elapsedTime + '\n'
if 'head' in cppcheckVersions: if 'head' in cppcheckVersions: