mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-24 21:54:01 +00:00
patman: Check patches in parallel
For large series this can take a while. Run checkpatch in parallel to try to reduce the time. The checkpatch information is still reported in sequential order, so a very slow patch at the start can still slow things down. But overall this gives good results. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Douglas Anderson <dianders@chromium.org>
This commit is contained in:
parent
27409e35d5
commit
00d54ae8f4
1 changed files with 26 additions and 20 deletions
|
@ -3,6 +3,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
import collections
|
import collections
|
||||||
|
import concurrent.futures
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
@ -244,26 +245,31 @@ def check_patches(verbose, args, use_tree):
|
||||||
error_count, warning_count, check_count = 0, 0, 0
|
error_count, warning_count, check_count = 0, 0, 0
|
||||||
col = terminal.Color()
|
col = terminal.Color()
|
||||||
|
|
||||||
for fname in args:
|
with concurrent.futures.ThreadPoolExecutor(max_workers=16) as executor:
|
||||||
result = check_patch(fname, verbose, use_tree=use_tree)
|
futures = []
|
||||||
if not result.ok:
|
for fname in args:
|
||||||
error_count += result.errors
|
f = executor.submit(check_patch, fname, verbose, use_tree=use_tree)
|
||||||
warning_count += result.warnings
|
futures.append(f)
|
||||||
check_count += result.checks
|
|
||||||
print('%d errors, %d warnings, %d checks for %s:' % (result.errors,
|
for fname, f in zip(args, futures):
|
||||||
result.warnings, result.checks, col.build(col.BLUE, fname)))
|
result = f.result()
|
||||||
if (len(result.problems) != result.errors + result.warnings +
|
if not result.ok:
|
||||||
result.checks):
|
error_count += result.errors
|
||||||
print("Internal error: some problems lost")
|
warning_count += result.warnings
|
||||||
# Python seems to get confused by this
|
check_count += result.checks
|
||||||
# pylint: disable=E1133
|
print('%d errors, %d warnings, %d checks for %s:' % (result.errors,
|
||||||
for item in result.problems:
|
result.warnings, result.checks, col.build(col.BLUE, fname)))
|
||||||
sys.stderr.write(
|
if (len(result.problems) != result.errors + result.warnings +
|
||||||
get_warning_msg(col, item.get('type', '<unknown>'),
|
result.checks):
|
||||||
item.get('file', '<unknown>'),
|
print("Internal error: some problems lost")
|
||||||
item.get('line', 0), item.get('msg', 'message')))
|
# Python seems to get confused by this
|
||||||
print
|
# pylint: disable=E1133
|
||||||
#print(stdout)
|
for item in result.problems:
|
||||||
|
sys.stderr.write(
|
||||||
|
get_warning_msg(col, item.get('type', '<unknown>'),
|
||||||
|
item.get('file', '<unknown>'),
|
||||||
|
item.get('line', 0), item.get('msg', 'message')))
|
||||||
|
print
|
||||||
if error_count or warning_count or check_count:
|
if error_count or warning_count or check_count:
|
||||||
str = 'checkpatch.pl found %d error(s), %d warning(s), %d checks(s)'
|
str = 'checkpatch.pl found %d error(s), %d warning(s), %d checks(s)'
|
||||||
color = col.GREEN
|
color = col.GREEN
|
||||||
|
|
Loading…
Reference in a new issue