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)
|
print('[' + strDateTime() + '] get:' + pkg)
|
||||||
connection.send(pkg)
|
connection.send(pkg)
|
||||||
connection.close()
|
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
|
# read data
|
||||||
data = cmd[6:]
|
data = cmd[cmd.find('ftp'):]
|
||||||
try:
|
try:
|
||||||
t = 0
|
t = 0
|
||||||
max_data_size = 2 * 1024 * 1024
|
max_data_size = 2 * 1024 * 1024
|
||||||
|
@ -753,15 +754,19 @@ def server(server_address_port, packages, packageIndex, resultPath):
|
||||||
print('results not written. url is not in packages.')
|
print('results not written. url is not in packages.')
|
||||||
continue
|
continue
|
||||||
print('results added for package ' + res.group(1))
|
print('results added for package ' + res.group(1))
|
||||||
filename = resultPath + '/' + res.group(1)
|
if writeFast:
|
||||||
|
filename = resultPath + '-fast/' + res.group(1)
|
||||||
|
else:
|
||||||
|
filename = resultPath + '/' + res.group(1)
|
||||||
with open(filename, 'wt') as f:
|
with open(filename, 'wt') as f:
|
||||||
f.write(strDateTime() + '\n' + data)
|
f.write(strDateTime() + '\n' + data)
|
||||||
# track latest added results..
|
# track latest added results..
|
||||||
if len(latestResults) >= 20:
|
if not writeFast:
|
||||||
latestResults = latestResults[1:]
|
if len(latestResults) >= 20:
|
||||||
latestResults.append(filename)
|
latestResults = latestResults[1:]
|
||||||
with open('latest.txt', 'wt') as f:
|
latestResults.append(filename)
|
||||||
f.write(' '.join(latestResults))
|
with open('latest.txt', 'wt') as f:
|
||||||
|
f.write(' '.join(latestResults))
|
||||||
elif cmd.startswith('write_info\nftp://'):
|
elif cmd.startswith('write_info\nftp://'):
|
||||||
# read data
|
# read data
|
||||||
data = cmd[11:]
|
data = cmd[11:]
|
||||||
|
|
|
@ -224,7 +224,7 @@ def hasInclude(path, includes):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def scanPackage(workPath, cppcheckPath, jobs):
|
def scanPackage(workPath, cppcheckPath, jobs, fast):
|
||||||
print('Analyze..')
|
print('Analyze..')
|
||||||
os.chdir(workPath)
|
os.chdir(workPath)
|
||||||
libraries = ' --library=posix --library=gnu'
|
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
|
# 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'
|
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
|
cmd = 'nice ' + cppcheckPath + '/cppcheck' + ' ' + options
|
||||||
print(cmd)
|
print(cmd)
|
||||||
startTime = time.time()
|
startTime = time.time()
|
||||||
|
@ -336,7 +338,11 @@ def uploadResults(package, results, server_address):
|
||||||
try:
|
try:
|
||||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
sock.connect(server_address)
|
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()
|
sock.close()
|
||||||
print('Results have been successfully uploaded.')
|
print('Results have been successfully uploaded.')
|
||||||
return True
|
return True
|
||||||
|
@ -464,7 +470,7 @@ while True:
|
||||||
current_cppcheck_dir = 'cppcheck'
|
current_cppcheck_dir = 'cppcheck'
|
||||||
else:
|
else:
|
||||||
current_cppcheck_dir = ver
|
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:
|
if c < 0:
|
||||||
crash = True
|
crash = True
|
||||||
count += ' Crash!'
|
count += ' Crash!'
|
||||||
|
@ -474,6 +480,16 @@ while True:
|
||||||
resultsToDiff.append(errout)
|
resultsToDiff.append(errout)
|
||||||
if ver == 'head':
|
if ver == 'head':
|
||||||
head_info_msg = info
|
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
|
results_exist = True
|
||||||
if len(resultsToDiff[0]) + len(resultsToDiff[1]) == 0:
|
if len(resultsToDiff[0]) + len(resultsToDiff[1]) == 0:
|
||||||
results_exist = False
|
results_exist = False
|
||||||
|
|
Loading…
Reference in New Issue