OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2012 the V8 project authors. All rights reserved. | 3 # Copyright 2012 the V8 project authors. All rights reserved. |
4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
6 # met: | 6 # met: |
7 # | 7 # |
8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
(...skipping 27 matching lines...) Expand all Loading... |
38 import optparse | 38 import optparse |
39 import os | 39 import os |
40 from os.path import abspath, join, dirname, basename, exists | 40 from os.path import abspath, join, dirname, basename, exists |
41 import pickle | 41 import pickle |
42 import re | 42 import re |
43 import sys | 43 import sys |
44 import subprocess | 44 import subprocess |
45 import multiprocessing | 45 import multiprocessing |
46 from subprocess import PIPE | 46 from subprocess import PIPE |
47 | 47 |
| 48 from testrunner.local import statusfile |
| 49 from testrunner.local import testsuite |
| 50 from testrunner.local import utils |
| 51 |
48 # Special LINT rules diverging from default and reason. | 52 # Special LINT rules diverging from default and reason. |
49 # build/header_guard: Our guards have the form "V8_FOO_H_", not "SRC_FOO_H_". | 53 # build/header_guard: Our guards have the form "V8_FOO_H_", not "SRC_FOO_H_". |
50 # build/include_what_you_use: Started giving false positives for variables | 54 # build/include_what_you_use: Started giving false positives for variables |
51 # named "string" and "map" assuming that you needed to include STL headers. | 55 # named "string" and "map" assuming that you needed to include STL headers. |
52 # TODO(bmeurer): Fix and re-enable readability/check | 56 # TODO(bmeurer): Fix and re-enable readability/check |
53 | 57 |
54 LINT_RULES = """ | 58 LINT_RULES = """ |
55 -build/header_guard | 59 -build/header_guard |
56 +build/include_alpha | 60 +build/include_alpha |
57 -build/include_what_you_use | 61 -build/include_what_you_use |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 handle.close() | 400 handle.close() |
397 print "Total violating files: %s" % violations | 401 print "Total violating files: %s" % violations |
398 return success | 402 return success |
399 | 403 |
400 | 404 |
401 def CheckExternalReferenceRegistration(workspace): | 405 def CheckExternalReferenceRegistration(workspace): |
402 code = subprocess.call( | 406 code = subprocess.call( |
403 [sys.executable, join(workspace, "tools", "external-reference-check.py")]) | 407 [sys.executable, join(workspace, "tools", "external-reference-check.py")]) |
404 return code == 0 | 408 return code == 0 |
405 | 409 |
| 410 def CheckStatusFiles(workspace): |
| 411 suite_paths = utils.GetSuitePaths(join(workspace, "test")) |
| 412 for root in suite_paths: |
| 413 suite_path = join(workspace, "test", root) |
| 414 status_file_path = join(suite_path, root + ".status") |
| 415 suite = testsuite.TestSuite.LoadTestSuite(suite_path) |
| 416 if suite and exists(status_file_path): |
| 417 if not statusfile.PresubmitCheck(status_file_path): |
| 418 return False |
| 419 return True |
| 420 |
406 def CheckAuthorizedAuthor(input_api, output_api): | 421 def CheckAuthorizedAuthor(input_api, output_api): |
407 """For non-googler/chromites committers, verify the author's email address is | 422 """For non-googler/chromites committers, verify the author's email address is |
408 in AUTHORS. | 423 in AUTHORS. |
409 """ | 424 """ |
410 # TODO(maruel): Add it to input_api? | 425 # TODO(maruel): Add it to input_api? |
411 import fnmatch | 426 import fnmatch |
412 | 427 |
413 author = input_api.change.author_email | 428 author = input_api.change.author_email |
414 if not author: | 429 if not author: |
415 input_api.logging.info('No author, skipping AUTHOR check') | 430 input_api.logging.info('No author, skipping AUTHOR check') |
(...skipping 27 matching lines...) Expand all Loading... |
443 parser = GetOptions() | 458 parser = GetOptions() |
444 (options, args) = parser.parse_args() | 459 (options, args) = parser.parse_args() |
445 success = True | 460 success = True |
446 print "Running C++ lint check..." | 461 print "Running C++ lint check..." |
447 if not options.no_lint: | 462 if not options.no_lint: |
448 success = CppLintProcessor().Run(workspace) and success | 463 success = CppLintProcessor().Run(workspace) and success |
449 print "Running copyright header, trailing whitespaces and " \ | 464 print "Running copyright header, trailing whitespaces and " \ |
450 "two empty lines between declarations check..." | 465 "two empty lines between declarations check..." |
451 success = SourceProcessor().Run(workspace) and success | 466 success = SourceProcessor().Run(workspace) and success |
452 success = CheckExternalReferenceRegistration(workspace) and success | 467 success = CheckExternalReferenceRegistration(workspace) and success |
| 468 success = CheckStatusFiles(workspace) and success |
453 if success: | 469 if success: |
454 return 0 | 470 return 0 |
455 else: | 471 else: |
456 return 1 | 472 return 1 |
457 | 473 |
458 | 474 |
459 if __name__ == '__main__': | 475 if __name__ == '__main__': |
460 sys.exit(Main()) | 476 sys.exit(Main()) |
OLD | NEW |