| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 4 # for details. All rights reserved. Use of this source code is governed by a | 4 # for details. All rights reserved. Use of this source code is governed by a |
| 5 # BSD-style license that can be found in the LICENSE file. | 5 # BSD-style license that can be found in the LICENSE file. |
| 6 | 6 |
| 7 import datetime | 7 import datetime |
| 8 import math | 8 import math |
| 9 try: | 9 try: |
| 10 from matplotlib.font_manager import FontProperties | 10 from matplotlib.font_manager import FontProperties |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 """Determine the amount of (real) time it takes to execute a given command.""" | 71 """Determine the amount of (real) time it takes to execute a given command.""" |
| 72 start = time.time() | 72 start = time.time() |
| 73 RunCmd(cmd) | 73 RunCmd(cmd) |
| 74 return time.time() - start | 74 return time.time() - start |
| 75 | 75 |
| 76 def SyncAndBuild(failed_once=False): | 76 def SyncAndBuild(failed_once=False): |
| 77 """Make sure we have the latest version of of the repo, and build it. We | 77 """Make sure we have the latest version of of the repo, and build it. We |
| 78 begin and end standing in DART_INSTALL_LOCATION. | 78 begin and end standing in DART_INSTALL_LOCATION. |
| 79 Args: | 79 Args: |
| 80 failed_once True if we have attempted to build this once before, and we've | 80 failed_once True if we have attempted to build this once before, and we've |
| 81 failed, indicating the build is broken.""" | 81 failed, indicating the build is broken. |
| 82 Returns: |
| 83 err_code = 1 if there was a problem building two times in a row.""" |
| 82 os.chdir(DART_INSTALL_LOCATION) | 84 os.chdir(DART_INSTALL_LOCATION) |
| 83 #Revert our newly built minfrog to prevent conflicts when we update | 85 #Revert our newly built minfrog to prevent conflicts when we update |
| 84 RunCmd(['svn', 'revert', os.path.join(os.getcwd(), 'frog', 'minfrog')]) | 86 RunCmd(['svn', 'revert', os.path.join(os.getcwd(), 'frog', 'minfrog')]) |
| 85 | 87 |
| 86 RunCmd(['gclient', 'sync']) | 88 RunCmd(['gclient', 'sync']) |
| 87 lines = RunCmd([os.path.join('.', 'tools', 'build.py'), '-m', 'release']) | 89 lines = RunCmd([os.path.join('.', 'tools', 'build.py'), '-m', 'release']) |
| 88 os.chdir('frog') | 90 os.chdir('frog') |
| 89 lines += RunCmd([os.path.join('..', 'tools', 'build.py'), '-m', | 91 lines += RunCmd([os.path.join('..', 'tools', 'build.py'), '-m', |
| 90 'debug,release']) | 92 'debug,release']) |
| 91 os.chdir('..') | 93 os.chdir('..') |
| 92 | 94 |
| 93 for line in lines: | 95 for line in lines: |
| 94 if 'BUILD FAILED' in lines: | 96 if 'BUILD FAILED' in lines: |
| 95 if failed_once: | 97 if failed_once: |
| 96 # Someone checked in a broken build! Just stop trying to make it work | 98 # Someone checked in a broken build! Just stop trying to make it work |
| 97 # and wait for the next hour to try again. | 99 # and wait for the next hour to try again. |
| 98 print 'Broken Build' | 100 print 'Broken Build' |
| 99 sys.exit(0) | 101 return 1 |
| 100 #Remove the xcode directory and attempt to build again. If it still | 102 #Remove the xcode directory and attempt to build again. If it still |
| 101 #fails, abort, and try again next hour. | 103 #fails, abort, and try again next hour. |
| 102 out_dir = 'out' | 104 out_dir = 'out' |
| 103 if platform.system() == 'Darwin': | 105 if platform.system() == 'Darwin': |
| 104 out_dir = 'xcodebuild' | 106 out_dir = 'xcodebuild' |
| 105 shutil.rmtree(os.path.join(os.getcwd(), out_dir, 'Release_ia32')) | 107 shutil.rmtree(os.path.join(os.getcwd(), out_dir, 'Release_ia32')) |
| 106 shutil.rmtree(os.path.join(os.getcwd(), 'frog', out_dir, | 108 shutil.rmtree(os.path.join(os.getcwd(), 'frog', out_dir, |
| 107 'Debug_ia32')) | 109 'Debug_ia32')) |
| 108 shutil.rmtree(os.path.join(os.getcwd(), 'frog', out_dir, | 110 shutil.rmtree(os.path.join(os.getcwd(), 'frog', out_dir, |
| 109 'Release_ia32')) | 111 'Release_ia32')) |
| 110 SyncAndBuild(True) | 112 SyncAndBuild(True) |
| 113 return 0 |
| 111 | 114 |
| 112 def EnsureOutputDirectory(dir_name): | 115 def EnsureOutputDirectory(dir_name): |
| 113 """Test that the listed directory name exists, and if not, create one for | 116 """Test that the listed directory name exists, and if not, create one for |
| 114 our output to be placed. | 117 our output to be placed. |
| 115 Args: | 118 Args: |
| 116 dir_name the directory we will create if it does not exist.""" | 119 dir_name the directory we will create if it does not exist.""" |
| 117 dir_path = os.path.join(DART_INSTALL_LOCATION, 'tools', 'testing', | 120 dir_path = os.path.join(DART_INSTALL_LOCATION, 'tools', 'testing', |
| 118 'perf_testing', dir_name) | 121 'perf_testing', dir_name) |
| 119 if not os.path.exists(dir_path): | 122 if not os.path.exists(dir_path): |
| 120 os.mkdir(dir_path) | 123 os.mkdir(dir_path) |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 args, ignored = parser.parse_args() | 688 args, ignored = parser.parse_args() |
| 686 if not (args.cl or args.size or args.language or args.perf): | 689 if not (args.cl or args.size or args.language or args.perf): |
| 687 args.cl = args.size = args.language = args.perf = True | 690 args.cl = args.size = args.language = args.perf = True |
| 688 return (args.cl, args.size, args.language, args.perf, args.continuous, | 691 return (args.cl, args.size, args.language, args.perf, args.continuous, |
| 689 args.perfbot, args.verbose) | 692 args.perfbot, args.verbose) |
| 690 | 693 |
| 691 def RunTestSequence(cl, size, language, perf): | 694 def RunTestSequence(cl, size, language, perf): |
| 692 if PERFBOT_MODE: | 695 if PERFBOT_MODE: |
| 693 # The buildbot already builds and syncs to a specific revision. Don't fight | 696 # The buildbot already builds and syncs to a specific revision. Don't fight |
| 694 # with it or replicate work. | 697 # with it or replicate work. |
| 695 SyncAndBuild() | 698 if SyncAndBuild() == 1: |
| 699 return # The build is broken. |
| 696 if cl: | 700 if cl: |
| 697 CommandLinePerformanceTestRunner('cl-results').Run() | 701 CommandLinePerformanceTestRunner('cl-results').Run() |
| 698 if size: | 702 if size: |
| 699 CompileTimeAndSizeTestRunner('code-time-size').Run() | 703 CompileTimeAndSizeTestRunner('code-time-size').Run() |
| 700 if language: | 704 if language: |
| 701 BrowserCorrectnessTestRunner('language', 'browser-correctness').Run() | 705 BrowserCorrectnessTestRunner('language', 'browser-correctness').Run() |
| 702 if perf: | 706 if perf: |
| 703 BrowserPerformanceTestRunner('browser-perf').Run() | 707 BrowserPerformanceTestRunner('browser-perf').Run() |
| 704 | 708 |
| 705 def main(): | 709 def main(): |
| 706 global PERFBOT_MODE, VERBOSE | 710 global PERFBOT_MODE, VERBOSE |
| 707 (cl, size, language, perf, continuous, perfbot, verbose) = ParseArgs() | 711 (cl, size, language, perf, continuous, perfbot, verbose) = ParseArgs() |
| 708 PERFBOT_MODE = perfbot | 712 PERFBOT_MODE = perfbot |
| 709 VERBOSE = verbose | 713 VERBOSE = verbose |
| 710 if continuous: | 714 if continuous: |
| 711 while True: | 715 while True: |
| 712 if HasNewCode(): | 716 if HasNewCode(): |
| 713 RunTestSequence(cl, size, language, perf) | 717 RunTestSequence(cl, size, language, perf) |
| 714 else: | 718 else: |
| 715 time.sleep(SLEEP_TIME) | 719 time.sleep(SLEEP_TIME) |
| 716 else: | 720 else: |
| 717 RunTestSequence(cl, size, language, perf) | 721 RunTestSequence(cl, size, language, perf) |
| 718 | 722 |
| 719 if __name__ == '__main__': | 723 if __name__ == '__main__': |
| 720 main() | 724 main() |
| 721 | 725 |
| OLD | NEW |