| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """Dart frog buildbot steps | 7 """Dart frog buildbot steps |
| 8 | 8 |
| 9 Runs tests for the frog or dart2js compiler. | 9 Runs tests for the frog or dart2js compiler. |
| 10 """ | 10 """ |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 args, _ = parser.parse_args() | 45 args, _ = parser.parse_args() |
| 46 | 46 |
| 47 compiler = None | 47 compiler = None |
| 48 runtime = None | 48 runtime = None |
| 49 mode = None | 49 mode = None |
| 50 system = None | 50 system = None |
| 51 builder_name = os.environ.get(BUILDER_NAME) | 51 builder_name = os.environ.get(BUILDER_NAME) |
| 52 option = None | 52 option = None |
| 53 shard_index = None | 53 shard_index = None |
| 54 total_shards = None | 54 total_shards = None |
| 55 number = None |
| 55 if not builder_name: | 56 if not builder_name: |
| 56 # We are not running on a buildbot. | 57 # We are not running on a buildbot. |
| 57 if args.name: | 58 if args.name: |
| 58 builder_name = args.name | 59 builder_name = args.name |
| 59 else: | 60 else: |
| 60 print 'Use -n $BUILDBOT_NAME for the bot you would like to emulate.' | 61 print 'Use -n $BUILDBOT_NAME for the bot you would like to emulate.' |
| 61 sys.exit(1) | 62 sys.exit(1) |
| 62 | 63 |
| 63 if builder_name: | 64 if builder_name: |
| 64 | 65 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 93 | 94 |
| 94 if system == 'windows': | 95 if system == 'windows': |
| 95 system = 'win7' | 96 system = 'win7' |
| 96 | 97 |
| 97 if (system == 'win7' and platform.system() != 'Windows') or ( | 98 if (system == 'win7' and platform.system() != 'Windows') or ( |
| 98 system == 'mac' and platform.system() != 'Darwin') or ( | 99 system == 'mac' and platform.system() != 'Darwin') or ( |
| 99 system == 'linux' and platform.system() != 'Linux'): | 100 system == 'linux' and platform.system() != 'Linux'): |
| 100 print ('Error: You cannot emulate a buildbot with a platform different ' | 101 print ('Error: You cannot emulate a buildbot with a platform different ' |
| 101 'from your own.') | 102 'from your own.') |
| 102 sys.exit(1) | 103 sys.exit(1) |
| 103 return (compiler, runtime, mode, system, option, shard_index, total_shards) | 104 return (compiler, runtime, mode, system, option, shard_index, total_shards, |
| 105 number) |
| 104 | 106 |
| 105 | 107 |
| 106 def NeedsXterm(compiler, runtime): | 108 def NeedsXterm(compiler, runtime): |
| 107 return runtime in ['ie', 'chrome', 'safari', 'opera', 'ff', 'drt'] | 109 return runtime in ['ie', 'chrome', 'safari', 'opera', 'ff', 'drt'] |
| 108 | 110 |
| 109 def TestStep(name, mode, system, compiler, runtime, targets, flags): | 111 def TestStep(name, mode, system, compiler, runtime, targets, flags): |
| 110 print '@@@BUILD_STEP %s %s tests: %s %s@@@' % (name, compiler, runtime, | 112 print '@@@BUILD_STEP %s %s tests: %s %s@@@' % (name, compiler, runtime, |
| 111 ' '.join(flags)) | 113 ' '.join(flags)) |
| 112 sys.stdout.flush() | 114 sys.stdout.flush() |
| 113 if NeedsXterm(compiler, runtime) and system == 'linux': | 115 if NeedsXterm(compiler, runtime) and system == 'linux': |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 164 |
| 163 os.chdir(DART_PATH) | 165 os.chdir(DART_PATH) |
| 164 | 166 |
| 165 print '@@@BUILD_STEP build frog@@@' | 167 print '@@@BUILD_STEP build frog@@@' |
| 166 | 168 |
| 167 args = [sys.executable, './tools/build.py', '--mode=' + mode, 'dart2js'] | 169 args = [sys.executable, './tools/build.py', '--mode=' + mode, 'dart2js'] |
| 168 print 'running %s' % (' '.join(args)) | 170 print 'running %s' % (' '.join(args)) |
| 169 return subprocess.call(args, env=NO_COLOR_ENV) | 171 return subprocess.call(args, env=NO_COLOR_ENV) |
| 170 | 172 |
| 171 | 173 |
| 172 def TestFrog(compiler, runtime, mode, system, option, flags): | 174 def TestFrog(compiler, runtime, mode, system, option, flags, bot_number=None): |
| 173 """ test frog. | 175 """ test frog. |
| 174 Args: | 176 Args: |
| 175 - compiler: either 'dart2js' or 'frog' | 177 - compiler: either 'dart2js' or 'frog' |
| 176 - runtime: either 'd8', or one of the browsers, see GetBuildInfo | 178 - runtime: either 'd8', or one of the browsers, see GetBuildInfo |
| 177 - mode: either 'debug' or 'release' | 179 - mode: either 'debug' or 'release' |
| 178 - system: either 'linux', 'mac', or 'win7' | 180 - system: either 'linux', 'mac', or 'win7' |
| 179 - option: 'checked' | 181 - option: 'checked' |
| 180 - flags: extra flags to pass to test.dart | 182 - flags: extra flags to pass to test.dart |
| 183 - bot_number: (optional) Number of the buildbot. Used for dividing test |
| 184 sets between bots. |
| 181 """ | 185 """ |
| 182 | 186 |
| 183 # Make sure we are in the frog directory | 187 # Make sure we are in the frog directory |
| 184 os.chdir(DART_PATH) | 188 os.chdir(DART_PATH) |
| 185 | 189 |
| 186 if compiler == 'dart2js': | 190 if compiler == 'dart2js': |
| 187 if (option == 'checked'): | 191 if (option == 'checked'): |
| 188 flags.append('--host-checked') | 192 flags.append('--host-checked') |
| 189 # Leg isn't self-hosted (yet) so we run the leg unit tests on the VM. | 193 # Leg isn't self-hosted (yet) so we run the leg unit tests on the VM. |
| 190 TestStep("dart2js_unit", mode, system, 'none', 'vm', ['leg'], ['--checked']) | 194 TestStep("dart2js_unit", mode, system, 'none', 'vm', ['leg'], ['--checked']) |
| 191 | 195 |
| 192 extra_suites = ['leg_only', 'frog_native'] | 196 extra_suites = ['leg_only', 'frog_native'] |
| 193 TestStep("dart2js_extra", mode, system, 'dart2js', runtime, extra_suites, | 197 TestStep("dart2js_extra", mode, system, 'dart2js', runtime, extra_suites, |
| 194 flags) | 198 flags) |
| 195 | 199 |
| 196 TestStep("dart2js", mode, system, 'dart2js', runtime, [], flags) | 200 TestStep("dart2js", mode, system, 'dart2js', runtime, [], flags) |
| 197 | 201 |
| 198 elif runtime == 'd8' and compiler in ['frog']: | 202 elif runtime == 'd8' and compiler in ['frog']: |
| 199 TestStep("frog", mode, system, compiler, runtime, [], flags) | 203 TestStep("frog", mode, system, compiler, runtime, [], flags) |
| 200 TestStep("frog_extra", mode, system, compiler, runtime, | 204 TestStep("frog_extra", mode, system, compiler, runtime, |
| 201 ['frog', 'frog_native', 'peg', 'css'], flags) | 205 ['frog', 'frog_native', 'peg', 'css'], flags) |
| 202 TestStep("sdk", mode, system, 'none', 'vm', ['dartdoc'], flags) | 206 TestStep("sdk", mode, system, 'none', 'vm', ['dartdoc'], flags) |
| 203 | 207 |
| 204 else: | 208 else: |
| 205 tests = ['client', 'language', 'corelib', 'isolate', 'frog', | 209 tests = ['dom', 'html', 'json', 'benchmark_smoke', |
| 206 'frog_native', 'peg', 'css'] | 210 'isolate', 'frog', 'css', 'corelib', 'language', |
| 211 'frog_native', 'peg'] |
| 207 | 212 |
| 208 # TODO(efortuna): Move Mac back to DumpRenderTree when we have a more stable | 213 # TODO(efortuna): Move Mac back to DumpRenderTree when we have a more stable |
| 209 # solution for DRT. Right now DRT is flakier than regular Chrome for the | 214 # solution for DRT. Right now DRT is flakier than regular Chrome for the |
| 210 # isolate tests, so we're switching to use Chrome in the short term. | 215 # isolate tests, so we're switching to use Chrome in the short term. |
| 211 if runtime == 'chrome' and system == 'linux': | 216 if runtime == 'chrome' and system == 'linux': |
| 212 TestStep('browser', mode, system, 'frog', 'drt', tests, flags) | 217 TestStep('browser', mode, system, 'frog', 'drt', tests, flags) |
| 213 TestStep('browser_dart2js', mode, system, 'dart2js', 'drt', [], flags) | 218 TestStep('browser_dart2js', mode, system, 'dart2js', 'drt', [], flags) |
| 214 TestStep('browser_dart2js_extra', mode, system, 'dart2js', 'drt', | 219 TestStep('browser_dart2js_extra', mode, system, 'dart2js', 'drt', |
| 215 ['leg_only', 'frog_native'], flags) | 220 ['leg_only', 'frog_native'], flags) |
| 216 else: | 221 else: |
| 217 additional_flags = [] | 222 additional_flags = [] |
| 218 if system.startswith('win') and runtime == 'ie': | 223 if system.startswith('win') and runtime == 'ie': |
| 219 # There should not be more than one InternetExplorerDriver instance | 224 # There should not be more than one InternetExplorerDriver instance |
| 220 # running at a time. For details, see | 225 # running at a time. For details, see |
| 221 # http://code.google.com/p/selenium/wiki/InternetExplorerDriver. | 226 # http://code.google.com/p/selenium/wiki/InternetExplorerDriver. |
| 222 additional_flags += ['-j1'] | 227 additional_flags += ['-j1'] |
| 228 # The IE bots are slow lately. Split up the tests they do. |
| 229 if bot_number == '2': |
| 230 tests = ['corelib', 'language'] |
| 231 else: |
| 232 tests = ['dom', 'html', 'json', 'benchmark_smoke', |
| 233 'isolate', 'frog', 'css', 'frog_native', 'peg'] |
| 223 TestStep(runtime, mode, system, compiler, runtime, tests, | 234 TestStep(runtime, mode, system, compiler, runtime, tests, |
| 224 flags + additional_flags) | 235 flags + additional_flags) |
| 225 | 236 |
| 226 return 0 | 237 return 0 |
| 227 | 238 |
| 228 def _DeleteFirefoxProfiles(directory): | 239 def _DeleteFirefoxProfiles(directory): |
| 229 """Find all the firefox profiles in a particular directory and delete them.""" | 240 """Find all the firefox profiles in a particular directory and delete them.""" |
| 230 for f in os.listdir(directory): | 241 for f in os.listdir(directory): |
| 231 item = os.path.join(directory, f) | 242 item = os.path.join(directory, f) |
| 232 if os.path.isdir(item) and f.startswith('tmp'): | 243 if os.path.isdir(item) and f.startswith('tmp'): |
| (...skipping 25 matching lines...) Expand all Loading... |
| 258 # password. The command won't actually work on regular machines without | 269 # password. The command won't actually work on regular machines without |
| 259 # root permissions. | 270 # root permissions. |
| 260 _DeleteFirefoxProfiles('/tmp') | 271 _DeleteFirefoxProfiles('/tmp') |
| 261 _DeleteFirefoxProfiles('/var/tmp') | 272 _DeleteFirefoxProfiles('/var/tmp') |
| 262 | 273 |
| 263 def main(): | 274 def main(): |
| 264 if len(sys.argv) == 0: | 275 if len(sys.argv) == 0: |
| 265 print 'Script pathname not known, giving up.' | 276 print 'Script pathname not known, giving up.' |
| 266 return 1 | 277 return 1 |
| 267 | 278 |
| 268 compiler, runtime, mode, system, option, shard_index, total_shards = ( | 279 compiler, runtime, mode, system, option, shard_index, total_shards, number = ( |
| 269 GetBuildInfo()) | 280 GetBuildInfo()) |
| 270 shard_description = "" | 281 shard_description = "" |
| 271 if shard_index: | 282 if shard_index: |
| 272 shard_description = " shard %s of %s" % (shard_index, total_shards) | 283 shard_description = " shard %s of %s" % (shard_index, total_shards) |
| 273 print "compiler: %s, runtime: %s mode: %s, system: %s, option: %s%s" % ( | 284 print "compiler: %s, runtime: %s mode: %s, system: %s, option: %s%s" % ( |
| 274 compiler, runtime, mode, system, option, shard_description) | 285 compiler, runtime, mode, system, option, shard_description) |
| 275 if compiler is None: | 286 if compiler is None: |
| 276 return 1 | 287 return 1 |
| 277 | 288 |
| 278 status = BuildFrog(compiler, mode, system) | 289 status = BuildFrog(compiler, mode, system) |
| 279 if status != 0: | 290 if status != 0: |
| 280 print '@@@STEP_FAILURE@@@' | 291 print '@@@STEP_FAILURE@@@' |
| 281 return status | 292 return status |
| 282 test_flags = [] | 293 test_flags = [] |
| 283 if shard_index: | 294 if shard_index: |
| 284 test_flags = ['--shards=%s' % total_shards, '--shard=%s' % shard_index] | 295 test_flags = ['--shards=%s' % total_shards, '--shard=%s' % shard_index] |
| 285 if compiler == 'dart2js': | 296 if compiler == 'dart2js': |
| 286 status = TestFrog(compiler, runtime, mode, system, option, test_flags) | 297 status = TestFrog(compiler, runtime, mode, system, option, test_flags, |
| 298 number) |
| 287 if status != 0: | 299 if status != 0: |
| 288 print '@@@STEP_FAILURE@@@' | 300 print '@@@STEP_FAILURE@@@' |
| 289 return status # Return unconditionally for dart2js. | 301 return status # Return unconditionally for dart2js. |
| 290 | 302 |
| 291 if runtime == 'd8' or (system == 'linux' and runtime == 'chrome'): | 303 if runtime == 'd8' or (system == 'linux' and runtime == 'chrome'): |
| 292 status = TestFrog(compiler, runtime, mode, system, option, test_flags) | 304 status = TestFrog(compiler, runtime, mode, system, option, test_flags, |
| 305 number) |
| 293 if status != 0: | 306 if status != 0: |
| 294 print '@@@STEP_FAILURE@@@' | 307 print '@@@STEP_FAILURE@@@' |
| 295 return status | 308 return status |
| 296 | 309 |
| 297 status = TestFrog(compiler, runtime, mode, system, option, | 310 status = TestFrog(compiler, runtime, mode, system, option, |
| 298 test_flags + ['--checked']) | 311 test_flags + ['--checked'], number) |
| 299 if status != 0: | 312 if status != 0: |
| 300 print '@@@STEP_FAILURE@@@' | 313 print '@@@STEP_FAILURE@@@' |
| 301 | 314 |
| 302 if compiler == 'frog' and runtime in ['ff', 'chrome', 'safari', 'opera', | 315 if compiler == 'frog' and runtime in ['ff', 'chrome', 'safari', 'opera', |
| 303 'ie', 'drt']: | 316 'ie', 'drt']: |
| 304 CleanUpTemporaryFiles(system, runtime) | 317 CleanUpTemporaryFiles(system, runtime) |
| 305 return status | 318 return status |
| 306 | 319 |
| 307 | 320 |
| 308 if __name__ == '__main__': | 321 if __name__ == '__main__': |
| 309 sys.exit(main()) | 322 sys.exit(main()) |
| OLD | NEW |