donate_cpu_lib.py: fix callstack capture, fix dependency check (#3665)
* donate_cpu_lib.py: fix callstack capture, fix dependency check check_requirements: verify that module psutil is available. scan_package: collect crash callstack regardless of cppcheck_path and cppcheck version * donate_cpu_lib.pu: remove debug code * donate_cpu_lib.py: add parameter capture_callstack
This commit is contained in:
parent
01a8890d6d
commit
dfd22919bc
|
@ -194,10 +194,12 @@ while True:
|
|||
|
||||
for ver in cppcheck_versions:
|
||||
tree_path = os.path.join(work_path, 'tree-'+ver)
|
||||
capture_callstack = False
|
||||
if ver == 'head':
|
||||
tree_path = os.path.join(work_path, 'tree-main')
|
||||
cppcheck_head_info = get_cppcheck_info(tree_path)
|
||||
c, errout, info, t, cppcheck_options, timing_info = scan_package(work_path, tree_path, jobs, libraries)
|
||||
capture_callstack = True
|
||||
c, errout, info, t, cppcheck_options, timing_info = scan_package(work_path, tree_path, jobs, libraries, capture_callstack)
|
||||
if c < 0:
|
||||
if c == -101 and 'error: could not find or open any of the paths given.' in errout:
|
||||
# No sourcefile found (for example only headers present)
|
||||
|
|
|
@ -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.17"
|
||||
CLIENT_VERSION = "1.3.18"
|
||||
|
||||
# Timeout for analysis with Cppcheck in seconds
|
||||
CPPCHECK_TIMEOUT = 30 * 60
|
||||
|
@ -34,6 +34,11 @@ def check_requirements():
|
|||
except OSError:
|
||||
print("Error: '{}' is required".format(app))
|
||||
result = False
|
||||
try:
|
||||
import psutil
|
||||
except ImportError as e:
|
||||
print("Error: {}. Module is required. ".format(e))
|
||||
result = False
|
||||
return result
|
||||
|
||||
|
||||
|
@ -292,7 +297,7 @@ def run_command(cmd):
|
|||
return return_code, stdout, stderr, elapsed_time
|
||||
|
||||
|
||||
def scan_package(work_path, cppcheck_path, jobs, libraries):
|
||||
def scan_package(work_path, cppcheck_path, jobs, libraries, capture_callstack = True):
|
||||
print('Analyze..')
|
||||
os.chdir(work_path)
|
||||
libs = ''
|
||||
|
@ -370,7 +375,7 @@ def scan_package(work_path, cppcheck_path, jobs, libraries):
|
|||
if has_sig:
|
||||
returncode = -sig_num
|
||||
stacktrace = ''
|
||||
if cppcheck_path == 'cppcheck':
|
||||
if capture_callstack:
|
||||
# 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 "
|
||||
if sig_file is not None:
|
||||
|
|
Loading…
Reference in New Issue