donate-cpu: run cppcheck with --experimental-fast also
This commit is contained in:
parent
8b9fb6dd88
commit
78ea6d71ac
|
@ -718,9 +718,10 @@ def server(server_address_port, packages, packageIndex, resultPath):
|
|||
print('[' + strDateTime() + '] get:' + pkg)
|
||||
connection.send(pkg)
|
||||
connection.close()
|
||||
elif cmd.startswith('write\nftp://'):
|
||||
elif cmd.startswith('write\nftp://') or cmd.startswith('write-fast\nftp://'):
|
||||
writeFast = cmd.startswith('write-fast')
|
||||
# read data
|
||||
data = cmd[6:]
|
||||
data = cmd[cmd.find('ftp'):]
|
||||
try:
|
||||
t = 0
|
||||
max_data_size = 2 * 1024 * 1024
|
||||
|
@ -753,10 +754,14 @@ def server(server_address_port, packages, packageIndex, resultPath):
|
|||
print('results not written. url is not in packages.')
|
||||
continue
|
||||
print('results added for package ' + res.group(1))
|
||||
if writeFast:
|
||||
filename = resultPath + '-fast/' + res.group(1)
|
||||
else:
|
||||
filename = resultPath + '/' + res.group(1)
|
||||
with open(filename, 'wt') as f:
|
||||
f.write(strDateTime() + '\n' + data)
|
||||
# track latest added results..
|
||||
if not writeFast:
|
||||
if len(latestResults) >= 20:
|
||||
latestResults = latestResults[1:]
|
||||
latestResults.append(filename)
|
||||
|
|
|
@ -224,7 +224,7 @@ def hasInclude(path, includes):
|
|||
return False
|
||||
|
||||
|
||||
def scanPackage(workPath, cppcheckPath, jobs):
|
||||
def scanPackage(workPath, cppcheckPath, jobs, fast):
|
||||
print('Analyze..')
|
||||
os.chdir(workPath)
|
||||
libraries = ' --library=posix --library=gnu'
|
||||
|
@ -247,6 +247,8 @@ def scanPackage(workPath, cppcheckPath, jobs):
|
|||
|
||||
# Reference for GNU C: https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html
|
||||
options = jobs + libraries + ' -D__GNUC__ --check-library --inconclusive --enable=style,information --platform=unix64 --template=daca2 -rp=temp temp'
|
||||
if fast:
|
||||
options = '--experimental-fast ' + options
|
||||
cmd = 'nice ' + cppcheckPath + '/cppcheck' + ' ' + options
|
||||
print(cmd)
|
||||
startTime = time.time()
|
||||
|
@ -336,7 +338,11 @@ def uploadResults(package, results, server_address):
|
|||
try:
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
sock.connect(server_address)
|
||||
sendAll(sock, 'write\n' + package + '\n' + results + '\nDONE')
|
||||
if results.startswith('FAST'):
|
||||
cmd = 'write-fast\n'
|
||||
else:
|
||||
cmd = 'write\n'
|
||||
sendAll(sock, cmd + package + '\n' + results + '\nDONE')
|
||||
sock.close()
|
||||
print('Results have been successfully uploaded.')
|
||||
return True
|
||||
|
@ -464,7 +470,7 @@ while True:
|
|||
current_cppcheck_dir = 'cppcheck'
|
||||
else:
|
||||
current_cppcheck_dir = ver
|
||||
c, errout, info, t, cppcheck_options = scanPackage(workpath, current_cppcheck_dir, jobs)
|
||||
c, errout, info, t, cppcheck_options = scanPackage(workpath, current_cppcheck_dir, jobs, False)
|
||||
if c < 0:
|
||||
crash = True
|
||||
count += ' Crash!'
|
||||
|
@ -474,6 +480,16 @@ while True:
|
|||
resultsToDiff.append(errout)
|
||||
if ver == 'head':
|
||||
head_info_msg = info
|
||||
|
||||
# Fast results
|
||||
fast_c, fast_errout, fast_info, fast_t, fast_cppcheck_options = scanPackage(workpath, current_cppcheck_dir, jobs, True)
|
||||
if c > 0 and errout and fast_errout:
|
||||
output = 'FAST\n'
|
||||
output += 'elapsed-time: %.1f %.1f' % (t, fast_t)
|
||||
output += '\ndiff:\n'
|
||||
output += diffResults(workpath, 'head', errout, 'fast', fast_errout)
|
||||
uploadResults(package, output, server_address)
|
||||
|
||||
results_exist = True
|
||||
if len(resultsToDiff[0]) + len(resultsToDiff[1]) == 0:
|
||||
results_exist = False
|
||||
|
|
Loading…
Reference in New Issue