donate_cpu_lib.py: fixed some cases with missing error information / cleanups (#2982)

This commit is contained in:
Oliver Stöneberg 2020-12-26 17:59:19 +01:00 committed by GitHub
parent 1f0187a8e6
commit 018b26a4ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 13 deletions

View File

@ -15,7 +15,7 @@ import shlex
# Version scheme (MAJOR.MINOR.PATCH) should orientate on "Semantic Versioning" https://semver.org/
# Every change in this script should result in increasing the version number accordingly (exceptions may be cosmetic
# changes)
CLIENT_VERSION = "1.3.1"
CLIENT_VERSION = "1.3.2"
# Timeout for analysis with Cppcheck in seconds
CPPCHECK_TIMEOUT = 60 * 60
@ -307,30 +307,34 @@ def scan_package(work_path, cppcheck_path, jobs, libraries):
if cppcheck_path == 'cppcheck':
# re-run within gdb to get a stacktrace
cmd = 'gdb --batch --eval-command=run --eval-command="bt 50" --return-child-result --args ' + cppcheck_cmd + " -j1"
dummy, stdout, stderr, elapsed_time = run_command(cmd)
gdb_pos = stdout.find(" received signal")
dummy, st_stdout, dummy, dummy = run_command(cmd)
gdb_pos = st_stdout.find(" received signal")
if not gdb_pos == -1:
last_check_pos = stdout.rfind('Checking ', 0, gdb_pos)
last_check_pos = st_stdout.rfind('Checking ', 0, gdb_pos)
if last_check_pos == -1:
stacktrace = stdout[gdb_pos:]
stacktrace = st_stdout[gdb_pos:]
else:
stacktrace = stdout[last_check_pos:]
stacktrace = st_stdout[last_check_pos:]
# if no stacktrace was generated return the original stdout
if not stacktrace:
stacktrace = stdout
return returncode, stacktrace, '', returncode, options, ''
if returncode != 0:
print('Error!')
if returncode > 0:
returncode = -100-returncode
return returncode, stdout, '', returncode, options, ''
if stderr.find('Internal error: Child process crashed with signal ') > 0:
err_s = 'Internal error: Child process crashed with signal '
err_pos = stderr.find(err_s)
if err_pos != -1:
print('Error!')
s = 'Internal error: Child process crashed with signal '
pos1 = stderr.find(s)
pos2 = stderr.find(' [cppcheckError]', pos1)
signr = int(stderr[pos1+len(s):pos2])
pos2 = stderr.find(' [cppcheckError]', err_pos)
signr = int(stderr[err_pos+len(err_s):pos2])
return -signr, '', '', -signr, options, ''
if stderr.find('#### ThreadExecutor') > 0:
thr_pos = stderr.find('#### ThreadExecutor')
if thr_pos != -1:
print('Thread!')
return -222, '', '', -222, options, ''
return -222, stderr[thr_pos:], '', -222, options, ''
information_messages_list = []
issue_messages_list = []
count = 0