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 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 contents = handle.read() | 410 contents = handle.read() |
411 if not self.ProcessContents(file, contents): | 411 if not self.ProcessContents(file, contents): |
412 success = False | 412 success = False |
413 violations += 1 | 413 violations += 1 |
414 finally: | 414 finally: |
415 handle.close() | 415 handle.close() |
416 print "Total violating files: %s" % violations | 416 print "Total violating files: %s" % violations |
417 return success | 417 return success |
418 | 418 |
419 | 419 |
420 def CheckGeneratedRuntimeTests(workspace): | 420 def CheckRuntimeVsNativesNameClashes(workspace): |
421 code = subprocess.call( | 421 code = subprocess.call( |
422 [sys.executable, join(workspace, "tools", "generate-runtime-tests.py"), | 422 [sys.executable, join(workspace, "tools", "check-name-clashes.py")]) |
423 "check"]) | |
424 return code == 0 | 423 return code == 0 |
425 | 424 |
426 | 425 |
427 def CheckExternalReferenceRegistration(workspace): | 426 def CheckExternalReferenceRegistration(workspace): |
428 code = subprocess.call( | 427 code = subprocess.call( |
429 [sys.executable, join(workspace, "tools", "external-reference-check.py")]) | 428 [sys.executable, join(workspace, "tools", "external-reference-check.py")]) |
430 return code == 0 | 429 return code == 0 |
431 | 430 |
432 | 431 |
433 def GetOptions(): | 432 def GetOptions(): |
434 result = optparse.OptionParser() | 433 result = optparse.OptionParser() |
435 result.add_option('--no-lint', help="Do not run cpplint", default=False, | 434 result.add_option('--no-lint', help="Do not run cpplint", default=False, |
436 action="store_true") | 435 action="store_true") |
437 return result | 436 return result |
438 | 437 |
439 | 438 |
440 def Main(): | 439 def Main(): |
441 workspace = abspath(join(dirname(sys.argv[0]), '..')) | 440 workspace = abspath(join(dirname(sys.argv[0]), '..')) |
442 parser = GetOptions() | 441 parser = GetOptions() |
443 (options, args) = parser.parse_args() | 442 (options, args) = parser.parse_args() |
444 success = True | 443 success = True |
445 print "Running C++ lint check..." | 444 print "Running C++ lint check..." |
446 if not options.no_lint: | 445 if not options.no_lint: |
447 success = CppLintProcessor().Run(workspace) and success | 446 success = CppLintProcessor().Run(workspace) and success |
448 print "Running copyright header, trailing whitespaces and " \ | 447 print "Running copyright header, trailing whitespaces and " \ |
449 "two empty lines between declarations check..." | 448 "two empty lines between declarations check..." |
450 success = SourceProcessor().Run(workspace) and success | 449 success = SourceProcessor().Run(workspace) and success |
451 success = CheckGeneratedRuntimeTests(workspace) and success | 450 success = CheckRuntimeVsNativesNameClashes(workspace) and success |
452 success = CheckExternalReferenceRegistration(workspace) and success | 451 success = CheckExternalReferenceRegistration(workspace) and success |
453 if success: | 452 if success: |
454 return 0 | 453 return 0 |
455 else: | 454 else: |
456 return 1 | 455 return 1 |
457 | 456 |
458 | 457 |
459 if __name__ == '__main__': | 458 if __name__ == '__main__': |
460 sys.exit(Main()) | 459 sys.exit(Main()) |
OLD | NEW |