[PATCH] D80626: [analyzer] SATestBuild.py: Make verbosity level a cmd option
Valeriy Savchenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed May 27 06:27:50 PDT 2020
vsavchenko created this revision.
vsavchenko added reviewers: NoQ, dcoughlin.
Herald added subscribers: cfe-commits, ASDenysPetrov, Charusso, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, szepet, baloghadamsoftware, xazax.hun.
Herald added a project: clang.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D80626
Files:
clang/utils/analyzer/SATestBuild.py
Index: clang/utils/analyzer/SATestBuild.py
===================================================================
--- clang/utils/analyzer/SATestBuild.py
+++ clang/utils/analyzer/SATestBuild.py
@@ -389,7 +389,7 @@
start_time = time.time()
project_dir = self.get_project_dir()
- if VERBOSE == 1:
+ if VERBOSE >= 1:
stdout(f" Build directory: {project_dir}.\n")
# Set the build results directory.
@@ -431,7 +431,7 @@
# Clean up scan build results.
if os.path.exists(output_dir):
- if VERBOSE == 1:
+ if VERBOSE >= 1:
stdout(f" Removing old results: {output_dir}\n")
shutil.rmtree(output_dir)
@@ -517,7 +517,7 @@
command_to_run = command_prefix + command
- if VERBOSE == 1:
+ if VERBOSE >= 1:
stdout(f" Executing: {command_to_run}\n")
check_call(command_to_run, cwd=cwd,
@@ -575,7 +575,7 @@
log_path = os.path.join(fail_path, file_name + ".stderr.txt")
with open(log_path, "w+") as log_file:
try:
- if VERBOSE == 1:
+ if VERBOSE >= 1:
stdout(f" Executing: {command}\n")
check_call(command, cwd=directory, stderr=log_file,
@@ -744,7 +744,7 @@
for ref_dir, new_dir in zip(ref_list, new_list):
assert(ref_dir != new_dir)
- if VERBOSE == 1:
+ if VERBOSE >= 1:
stdout(f" Comparing Results: {ref_dir} {new_dir}\n")
patched_source = os.path.join(directory, PATCHED_SOURCE_DIR_NAME)
@@ -818,7 +818,7 @@
# Clean up the log file.
if os.path.exists(build_log_path):
- if VERBOSE == 1:
+ if VERBOSE >= 1:
stdout(f" Removing log file: {build_log_path}\n")
os.remove(build_log_path)
@@ -888,28 +888,32 @@
if __name__ == "__main__":
# Parse command line arguments.
- Parser = argparse.ArgumentParser(
+ parser = argparse.ArgumentParser(
description="Test the Clang Static Analyzer.")
- Parser.add_argument("--strictness", dest="strictness", type=int, default=0,
+ parser.add_argument("--strictness", dest="strictness", type=int, default=0,
help="0 to fail on runtime errors, 1 to fail when the "
"number of found bugs are different from the "
"reference, 2 to fail on any difference from the "
"reference. Default is 0.")
- Parser.add_argument("-r", dest="regenerate", action="store_true",
+ parser.add_argument("-r", dest="regenerate", action="store_true",
default=False, help="Regenerate reference output.")
- Parser.add_argument("--override-compiler", action="store_true",
+ parser.add_argument("--override-compiler", action="store_true",
default=False, help="Call scan-build with "
"--override-compiler option.")
- Parser.add_argument("-j", "--jobs", dest="jobs", type=int,
+ parser.add_argument("-j", "--jobs", dest="jobs", type=int,
default=0,
help="Number of projects to test concurrently")
- Parser.add_argument("--extra-analyzer-config",
+ parser.add_argument("--extra-analyzer-config",
dest="extra_analyzer_config", type=str,
default="",
help="Arguments passed to to -analyzer-config")
+ parser.add_argument("-v", "--verbose", action="count", default=0)
- args = Parser.parse_args()
+ args = parser.parse_args()
+
+ global VERBOSE
+ VERBOSE = args.verbose
tester = RegressionTester(args.jobs, args.override_compiler,
args.extra_analyzer_config, args.regenerate,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80626.266512.patch
Type: text/x-patch
Size: 3923 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200527/c1608761/attachment.bin>
More information about the cfe-commits
mailing list