Author: Ian Campbell Date: 2021-07-19T14:18:26+02:00 New Revision: f6ba03584b3ce5dab45d8c1fe84e89d4d668574d
URL: https://github.com/llvm/llvm-project/commit/f6ba03584b3ce5dab45d8c1fe84e89d4d668574d DIFF: https://github.com/llvm/llvm-project/commit/f6ba03584b3ce5dab45d8c1fe84e89d4d668574d.diff LOG: [clang-tidy] ensure run-clang-tidy reports children killed by signals If a clang-tidy child process exits with a signal then run-clang-tidy will exit with an error but there is no hint why in the output, since the clang-tidy doesn't log anything and may not even have had the opportunity to do so depending on the signal used. `subprocess.CompletedProcess.returncode` is the negative signal number in this case. I hit this in a CI system where the parallelism used exceeded the RAM assigned to the container causing the OOM killer to SIGKILL clang-tidy processes. Reviewed By: sylvestre.ledru Differential Revision: https://reviews.llvm.org/D99081 Added: Modified: clang-tools-extra/clang-tidy/tool/run-clang-tidy.py Removed: ################################################################################ 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 de810230b2852..acd1ed6979c0d 100755 --- a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py +++ b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py @@ -173,6 +173,9 @@ def run_tidy(args, tmpdir, build_path, queue, lock, failed_files): proc = subprocess.Popen(invocation, stdout=subprocess.PIPE, stderr=subprocess.PIPE) output, err = proc.communicate() if proc.returncode != 0: + if proc.returncode < 0: + msg = "%s: terminated by signal %d\n" % (name, -proc.returncode) + err += msg.encode('utf-8') failed_files.append(name) with lock: sys.stdout.write(' '.join(invocation) + '\n' + output.decode('utf-8')) _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits