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 """Dart2js buildbot steps | 7 """Dart2js buildbot steps |
8 | 8 |
9 Runs tests for the dart2js compiler. | 9 Runs tests for the dart2js compiler. |
10 """ | 10 """ |
11 | 11 |
12 import platform | 12 import platform |
13 import optparse | 13 import optparse |
14 import os | 14 import os |
15 import re | 15 import re |
16 import shutil | 16 import shutil |
17 import subprocess | 17 import subprocess |
18 import sys | 18 import sys |
19 | 19 |
20 BUILDER_NAME = 'BUILDBOT_BUILDERNAME' | 20 BUILDER_NAME = 'BUILDBOT_BUILDERNAME' |
21 BUILDER_CLOBBER = 'BUILDBOT_CLOBBER' | |
22 | |
21 | 23 |
22 DART_PATH = os.path.dirname( | 24 DART_PATH = os.path.dirname( |
23 os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | 25 os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
24 | 26 |
25 DART2JS_BUILDER = ( | 27 DART2JS_BUILDER = ( |
26 r'dart2js-(linux|mac|windows)-(debug|release)(-([a-z]+))?-?(\d*)-?(\d*)') | 28 r'dart2js-(linux|mac|windows)-(debug|release)(-([a-z]+))?-?(\d*)-?(\d*)') |
27 WEB_BUILDER = ( | 29 WEB_BUILDER = ( |
28 r'web-(ie|ff|safari|chrome|opera)-(win7|win8|mac|linux)-?(\d*)-?(\d*)') | 30 r'web-(ie|ff|safari|chrome|opera)-(win7|win8|mac|linux)-?(\d*)-?(\d*)') |
29 | 31 |
30 NO_COLOR_ENV = dict(os.environ) | 32 NO_COLOR_ENV = dict(os.environ) |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
284 if system == 'win7': | 286 if system == 'win7': |
285 shutil.rmtree('C:\\Users\\chrome-bot\\AppData\\Local\\Temp', | 287 shutil.rmtree('C:\\Users\\chrome-bot\\AppData\\Local\\Temp', |
286 ignore_errors=True) | 288 ignore_errors=True) |
287 elif browser == 'ff': | 289 elif browser == 'ff': |
288 # Note: the buildbots run as root, so we can do this without requiring a | 290 # Note: the buildbots run as root, so we can do this without requiring a |
289 # password. The command won't actually work on regular machines without | 291 # password. The command won't actually work on regular machines without |
290 # root permissions. | 292 # root permissions. |
291 _DeleteFirefoxProfiles('/tmp') | 293 _DeleteFirefoxProfiles('/tmp') |
292 _DeleteFirefoxProfiles('/var/tmp') | 294 _DeleteFirefoxProfiles('/var/tmp') |
293 | 295 |
296 def MaybeClobber(runtime, mode, system): | |
297 """ Clobber the build directory if the clobber flag has been set. | |
298 Args: | |
299 - runtime: either 'd8', or one of the browsers, see GetBuildInfo | |
300 - mode: either 'debug' or 'release' | |
301 - system: either 'linux', 'mac', or 'win7' | |
ricow1
2012/08/14 08:22:58
we don't use all these arguments for clobbering th
| |
302 """ | |
303 builder_clobber = os.environ.get(BUILDER_CLOBBER) | |
304 if (builder_clobber != "1"): | |
305 print "Clobber flag not set, not clobbering" | |
306 return | |
307 | |
308 # TODO(ricow): add support for browser bots - sync with Emily | |
309 if (runtime == "d8"): | |
310 delete_path = os.path.join(DART_PATH, "out") | |
311 print "Clobbering %s" % (delete_path) | |
312 shutil.rmtree("", ignore_errors=True); | |
313 | |
294 def main(): | 314 def main(): |
295 print '@@@BUILD_STEP build sdk@@@' | |
296 | 315 |
297 if len(sys.argv) == 0: | 316 if len(sys.argv) == 0: |
298 print 'Script pathname not known, giving up.' | 317 print 'Script pathname not known, giving up.' |
299 return 1 | 318 return 1 |
300 | 319 |
301 (compiler, runtime, mode, system, option, shard_index, total_shards, | 320 (compiler, runtime, mode, system, option, shard_index, total_shards, |
302 is_buildbot) = GetBuildInfo() | 321 is_buildbot) = GetBuildInfo() |
303 shard_description = "" | 322 shard_description = "" |
304 if shard_index: | 323 if shard_index: |
305 shard_description = " shard %s of %s" % (shard_index, total_shards) | 324 shard_description = " shard %s of %s" % (shard_index, total_shards) |
306 print "compiler: %s, runtime: %s mode: %s, system: %s, option: %s%s" % ( | 325 print "compiler: %s, runtime: %s mode: %s, system: %s, option: %s%s" % ( |
307 compiler, runtime, mode, system, option, shard_description) | 326 compiler, runtime, mode, system, option, shard_description) |
308 if compiler is None: | 327 if compiler is None: |
309 return 1 | 328 return 1 |
310 | 329 |
330 print '@@@BUILD_STEP Maybe clobber@@@' | |
331 MaybeClobber(runtime, mode, system) | |
332 | |
333 print '@@@BUILD_STEP build sdk@@@' | |
311 status = BuildSDK(mode, system) | 334 status = BuildSDK(mode, system) |
312 if status != 0: | 335 if status != 0: |
313 print '@@@STEP_FAILURE@@@' | 336 print '@@@STEP_FAILURE@@@' |
314 return status | 337 return status |
315 | 338 |
316 test_flags = [] | 339 test_flags = [] |
317 if shard_index: | 340 if shard_index: |
318 test_flags = ['--shards=%s' % total_shards, '--shard=%s' % shard_index] | 341 test_flags = ['--shards=%s' % total_shards, '--shard=%s' % shard_index] |
319 | 342 |
320 # First we run all the regular tests. | 343 # First we run all the regular tests. |
321 status = TestCompiler(runtime, mode, system, option, test_flags, | 344 status = TestCompiler(runtime, mode, system, option, test_flags, |
322 is_buildbot) | 345 is_buildbot) |
323 | 346 |
324 # We only run checked mode tests when the host is not in checked mode. | 347 # We only run checked mode tests when the host is not in checked mode. |
325 if status == 0 and option != 'checked' and runtime == 'd8': | 348 if status == 0 and option != 'checked' and runtime == 'd8': |
326 status = TestCompiler(runtime, mode, system, option, | 349 status = TestCompiler(runtime, mode, system, option, |
327 test_flags + ['--checked'], is_buildbot) | 350 test_flags + ['--checked'], is_buildbot) |
328 | 351 |
329 if runtime != 'd8': CleanUpTemporaryFiles(system, runtime) | 352 if runtime != 'd8': CleanUpTemporaryFiles(system, runtime) |
330 if status != 0: print '@@@STEP_FAILURE@@@' | 353 if status != 0: print '@@@STEP_FAILURE@@@' |
331 return status | 354 return status |
332 | 355 |
333 if __name__ == '__main__': | 356 if __name__ == '__main__': |
334 sys.exit(main()) | 357 sys.exit(main()) |
OLD | NEW |