OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Enables directory-specific presubmit checks to run at upload and/or commit. | 6 """Enables directory-specific presubmit checks to run at upload and/or commit. |
7 """ | 7 """ |
8 | 8 |
9 __version__ = '1.6.2' | 9 __version__ = '1.6.2' |
10 | 10 |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 @staticmethod | 471 @staticmethod |
472 def RunTests(tests_mix, parallel=True): | 472 def RunTests(tests_mix, parallel=True): |
473 tests = [] | 473 tests = [] |
474 msgs = [] | 474 msgs = [] |
475 for t in tests_mix: | 475 for t in tests_mix: |
476 if isinstance(t, OutputApi.PresubmitResult): | 476 if isinstance(t, OutputApi.PresubmitResult): |
477 msgs.append(t) | 477 msgs.append(t) |
478 else: | 478 else: |
479 assert issubclass(t.message, _PresubmitResult) | 479 assert issubclass(t.message, _PresubmitResult) |
480 tests.append(t) | 480 tests.append(t) |
481 if parallel: | 481 if tests and parallel: |
482 pool = multiprocessing.Pool() | 482 pool = multiprocessing.Pool() |
483 # async recipe works around multiprocessing bug handling Ctrl-C | 483 # async recipe works around multiprocessing bug handling Ctrl-C |
484 msgs.extend(pool.map_async(CallCommand, tests).get(99999)) | 484 msgs.extend(pool.map_async(CallCommand, tests).get(99999)) |
485 pool.close() | 485 pool.close() |
486 pool.join() | 486 pool.join() |
487 else: | 487 else: |
488 msgs.extend(map(CallCommand, tests)) | 488 msgs.extend(map(CallCommand, tests)) |
489 return [m for m in msgs if m] | 489 return [m for m in msgs if m] |
490 | 490 |
491 | 491 |
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1383 except PresubmitFailure, e: | 1383 except PresubmitFailure, e: |
1384 print >> sys.stderr, e | 1384 print >> sys.stderr, e |
1385 print >> sys.stderr, 'Maybe your depot_tools is out of date?' | 1385 print >> sys.stderr, 'Maybe your depot_tools is out of date?' |
1386 print >> sys.stderr, 'If all fails, contact maruel@' | 1386 print >> sys.stderr, 'If all fails, contact maruel@' |
1387 return 2 | 1387 return 2 |
1388 | 1388 |
1389 | 1389 |
1390 if __name__ == '__main__': | 1390 if __name__ == '__main__': |
1391 fix_encoding.fix_encoding() | 1391 fix_encoding.fix_encoding() |
1392 sys.exit(Main(None)) | 1392 sys.exit(Main(None)) |
OLD | NEW |