[analyzer] Add option to SATest.py for extra checkers

This patch adds the flag `extra-checkers` to the sub-command `build` for
passing a comma separated list of additional checkers to include.

Differential Revision: https://reviews.llvm.org/D106739
This commit is contained in:
Deep Majumder 2021-08-17 10:42:30 +05:30
parent 9790a2a72f
commit 198e6771e2
2 changed files with 14 additions and 0 deletions

View File

@ -42,6 +42,7 @@ def build(parser, args):
projects,
args.override_compiler,
args.extra_analyzer_config,
args.extra_checkers,
args.regenerate,
args.strictness)
tests_passed = tester.test_all()
@ -250,6 +251,10 @@ def main():
dest="extra_analyzer_config", type=str,
default="",
help="Arguments passed to to -analyzer-config")
build_parser.add_argument("--extra-checkers",
dest="extra_checkers", type=str,
default="",
help="Extra checkers to enable")
build_parser.add_argument("--projects", action="store", default="",
help="Comma-separated list of projects to test")
build_parser.add_argument("--max-size", action="store", default=None,

View File

@ -213,6 +213,7 @@ class TestInfo(NamedTuple):
project: ProjectInfo
override_compiler: bool = False
extra_analyzer_config: str = ""
extra_checkers: str = ""
is_reference_build: bool = False
strictness: int = 0
@ -233,13 +234,16 @@ class RegressionTester:
"""
A component aggregating all of the project testing.
"""
def __init__(self, jobs: int, projects: List[ProjectInfo],
override_compiler: bool, extra_analyzer_config: str,
extra_checkers: str,
regenerate: bool, strictness: bool):
self.jobs = jobs
self.projects = projects
self.override_compiler = override_compiler
self.extra_analyzer_config = extra_analyzer_config
self.extra_checkers = extra_checkers
self.regenerate = regenerate
self.strictness = strictness
@ -252,6 +256,7 @@ class RegressionTester:
TestInfo(project,
self.override_compiler,
self.extra_analyzer_config,
self.extra_checkers,
self.regenerate, self.strictness))
if self.jobs <= 1:
return self._single_threaded_test_all(projects_to_test)
@ -305,10 +310,12 @@ class ProjectTester:
"""
A component aggregating testing for one project.
"""
def __init__(self, test_info: TestInfo, silent: bool = False):
self.project = test_info.project
self.override_compiler = test_info.override_compiler
self.extra_analyzer_config = test_info.extra_analyzer_config
self.extra_checkers = test_info.extra_checkers
self.is_reference_build = test_info.is_reference_build
self.strictness = test_info.strictness
self.silent = silent
@ -414,6 +421,8 @@ class ProjectTester:
if 'SA_ADDITIONAL_CHECKERS' in os.environ:
all_checkers = (all_checkers + ',' +
os.environ['SA_ADDITIONAL_CHECKERS'])
if self.extra_checkers != "":
all_checkers += "," + self.extra_checkers
# Run scan-build from within the patched source directory.
cwd = os.path.join(directory, PATCHED_SOURCE_DIR_NAME)