Skip to content

Commit e20ee07

Browse files
authored
Merge pull request #4674 from barnabasdomozi/plist_error
Introduce plist.err and parse --status
2 parents 5d64100 + efbe920 commit e20ee07

File tree

70 files changed

+1295
-44
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+1295
-44
lines changed

analyzer/codechecker_analyzer/analyzers/clangsa/result_handler.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from typing import Optional
1515

1616
from codechecker_report_converter.report.parser.base import AnalyzerInfo
17-
from codechecker_report_converter.report import report_file
17+
from codechecker_report_converter.report import report_file, error_file
1818
from codechecker_report_converter.report.hash import get_report_hash, HashType
1919
from codechecker_common.logger import get_logger
2020
from codechecker_common.skiplist_handler import SkipListHandlers
@@ -43,6 +43,11 @@ def postprocess_result(
4343
Generate analyzer result output file which can be parsed and stored
4444
into the database.
4545
"""
46+
error_file.update(
47+
self.analyzer_result_file, self.analyzer_returncode,
48+
self.analyzer_info, self.analyzer_cmd,
49+
self.analyzer_stdout, self.analyzer_stderr)
50+
4651
if os.path.exists(self.analyzer_result_file):
4752
reports = report_file.get_reports(
4853
self.analyzer_result_file, self.checker_labels,

analyzer/codechecker_analyzer/analyzers/clangtidy/result_handler.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
AnalyzerResult
1616
from codechecker_report_converter.analyzers.clang_tidy.parser import Parser
1717
from codechecker_report_converter.report.parser.base import AnalyzerInfo
18-
from codechecker_report_converter.report import report_file
18+
from codechecker_report_converter.report import report_file, error_file
1919
from codechecker_report_converter.report.hash import get_report_hash, HashType
2020

2121
from codechecker_common.logger import get_logger
@@ -76,3 +76,8 @@ def postprocess_result(
7676
report_file.create(
7777
self.analyzer_result_file, reports, self.checker_labels,
7878
self.analyzer_info)
79+
80+
error_file.update(
81+
self.analyzer_result_file, self.analyzer_returncode,
82+
self.analyzer_info, self.analyzer_cmd,
83+
self.analyzer_stdout, self.analyzer_stderr)

analyzer/codechecker_analyzer/analyzers/cppcheck/result_handler.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from codechecker_report_converter.analyzers.cppcheck.analyzer_result import \
1515
AnalyzerResult
1616
from codechecker_report_converter.report import BugPathEvent, \
17-
Range, report_file
17+
Range, report_file, error_file
1818
from codechecker_report_converter.report.hash import get_report_hash, HashType
1919

2020
from codechecker_common.logger import get_logger
@@ -95,3 +95,8 @@ def postprocess_result(
9595
report_file.create(
9696
self.analyzer_result_file, reports, self.checker_labels,
9797
self.analyzer_info)
98+
99+
error_file.update(
100+
self.analyzer_result_file, self.analyzer_returncode,
101+
self.analyzer_info, self.analyzer_cmd,
102+
self.analyzer_stdout, self.analyzer_stderr)

analyzer/codechecker_analyzer/analyzers/gcc/result_handler.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from codechecker_report_converter.report.parser.base import AnalyzerInfo
1717
from codechecker_report_converter.analyzers.gcc.analyzer_result import \
1818
AnalyzerResult
19-
from codechecker_report_converter.report import report_file
19+
from codechecker_report_converter.report import report_file, error_file
2020
from codechecker_report_converter.report.hash import get_report_hash, HashType
2121

2222
from codechecker_common.logger import get_logger
@@ -118,3 +118,8 @@ def postprocess_result(
118118
report_file.create(
119119
self.analyzer_result_file, reports, self.checker_labels,
120120
self.analyzer_info)
121+
122+
error_file.update(
123+
self.analyzer_result_file, self.analyzer_returncode,
124+
self.analyzer_info, self.analyzer_cmd,
125+
self.analyzer_stdout, self.analyzer_stderr)

analyzer/codechecker_analyzer/analyzers/infer/result_handler.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from codechecker_report_converter.report.parser.base import AnalyzerInfo
1616
from codechecker_report_converter.analyzers.infer.analyzer_result import \
1717
AnalyzerResult
18-
from codechecker_report_converter.report import report_file
18+
from codechecker_report_converter.report import report_file, error_file
1919
from codechecker_report_converter.report.hash import get_report_hash, HashType
2020

2121
from codechecker_common.logger import get_logger
@@ -74,4 +74,9 @@ def postprocess_result(
7474
self.analyzer_result_file, reports, self.checker_labels,
7575
self.analyzer_info)
7676

77+
error_file.update(
78+
self.analyzer_result_file, self.analyzer_returncode,
79+
self.analyzer_info, self.analyzer_cmd,
80+
self.analyzer_stdout, self.analyzer_stderr)
81+
7782
shutil.rmtree(Path(self.workspace, "infer", self.buildaction_hash))

analyzer/codechecker_analyzer/analyzers/result_handler_base.py

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@
99
Result handlers to manage the output of the static analyzers.
1010
"""
1111

12-
import hashlib
1312
import os
14-
import shlex
1513

1614
from abc import ABCMeta
1715
from typing import Optional
1816

1917
from codechecker_analyzer import analyzer_context
18+
from codechecker_analyzer.util import analyzer_action_hash
2019
from codechecker_common.logger import get_logger
2120
from codechecker_common.skiplist_handler import SkipListHandlers
2221
from codechecker_common.review_status_handler import ReviewStatusHandler
@@ -99,43 +98,10 @@ def analyzer_action_str(self):
9998
"""
10099
analyzed_file_name = os.path.basename(self.analyzed_source_file)
101100

102-
source_file = os.path.normpath(
103-
os.path.join(self.buildaction.directory,
104-
self.analyzed_source_file))
105-
106-
# In case of "make 4.3" depending on compile-time options "make" tool
107-
# can be built so a subprocess named cc1build will be logged by
108-
# "CodeChecker log".
109-
# See posix_spawn() option:
110-
# https://lists.gnu.org/archive/html/info-gnu/2020-01/msg00004.html
111-
# In this case the -o output argument of cc1build command is a randomly
112-
# named temporary file. We can't afford dynamic parts in the original
113-
# build command, because its hash is used for identification in the
114-
# plist file name.
115-
#
116-
# The proper logging of this "make 4.3" version has been done in
117-
# bf140d6, so it is unlikely happen that two build actions differ only
118-
# in their "-o" flags. This workaround is still kept for any case.
119-
#
120-
# Note that some information loss occurs during the following algorithm
121-
# because ' '.join(shlex.split(cmd)) is not necessarily equal to cmd:
122-
# g++ -DVAR="hello world" main.cpp
123-
124-
args = shlex.split(self.buildaction.original_command)
125-
indices = [idx for idx, v in enumerate(args) if v.startswith('-o')]
126-
127-
for idx in reversed(indices):
128-
# Output can be given separate or joint:
129-
# -o a.out vs. -oa.out
130-
# In the first case we delete its argument too.
131-
if args[idx] == '-o':
132-
del args[idx]
133-
del args[idx]
134-
135-
build_info = source_file + '_' + ' '.join(args)
136-
137101
self.buildaction_hash = \
138-
hashlib.md5(build_info.encode(errors='ignore')).hexdigest()
102+
analyzer_action_hash(self.analyzed_source_file,
103+
self.buildaction.directory,
104+
self.buildaction.original_command)
139105

140106
return analyzed_file_name + '_' + \
141107
str(self.buildaction.analyzer_type) + '_' + \

0 commit comments

Comments
 (0)