summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndi-Bogdan Postelnicu <andi@mozilla.com>2018-08-10 11:50:47 +0000
committerAndi-Bogdan Postelnicu <andi@mozilla.com>2018-08-10 11:50:47 +0000
commitbebcd6fa4d2cbac48401bb95befb58dc81f6e54e (patch)
treec9e97eb7c09dc6fe5f1e1ae3cecbb18087da15a0
parent0a75766c3d851b3a792eadbcf28a44ffc8b956fd (diff)
downloadbcm5719-llvm-bebcd6fa4d2cbac48401bb95befb58dc81f6e54e.tar.gz
bcm5719-llvm-bebcd6fa4d2cbac48401bb95befb58dc81f6e54e.zip
[clang-tidy] run-clang-tidy.py - add synchronisation to the output
Differential Revision: https://reviews.llvm.org/D49851 llvm-svn: 339427
-rwxr-xr-xclang-tools-extra/clang-tidy/tool/run-clang-tidy.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
index ce46c0ed3e5..3852ba2c00f 100755
--- a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
+++ b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
@@ -153,7 +153,7 @@ def apply_fixes(args, tmpdir):
subprocess.call(invocation)
-def run_tidy(args, tmpdir, build_path, queue, failed_files):
+def run_tidy(args, tmpdir, build_path, queue, lock, failed_files):
"""Takes filenames out of queue and runs clang-tidy on them."""
while True:
name = queue.get()
@@ -161,10 +161,15 @@ def run_tidy(args, tmpdir, build_path, queue, failed_files):
tmpdir, build_path, args.header_filter,
args.extra_arg, args.extra_arg_before,
args.quiet, args.config)
- sys.stdout.write(' '.join(invocation) + '\n')
- return_code = subprocess.call(invocation)
- if return_code != 0:
+
+ proc = subprocess.Popen(invocation, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ output, err = proc.communicate()
+ if proc.returncode != 0:
failed_files.append(name)
+ with lock:
+ sys.stdout.write(' '.join(invocation) + '\n' + output + '\n')
+ if err > 0:
+ sys.stderr.write(err + '\n')
queue.task_done()
@@ -263,9 +268,10 @@ def main():
task_queue = queue.Queue(max_task)
# List of files with a non-zero return code.
failed_files = []
+ lock = threading.Lock()
for _ in range(max_task):
t = threading.Thread(target=run_tidy,
- args=(args, tmpdir, build_path, task_queue, failed_files))
+ args=(args, tmpdir, build_path, task_queue, lock, failed_files))
t.daemon = True
t.start()
OpenPOWER on IntegriCloud