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 """ |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
210 if system == 'linux' and runtime == 'chrome': | 210 if system == 'linux' and runtime == 'chrome': |
211 # TODO(ngeoffray): We should install selenium on the buildbot. | 211 # TODO(ngeoffray): We should install selenium on the buildbot. |
212 runtime = 'drt' | 212 runtime = 'drt' |
213 elif (runtime == 'ff' or runtime == 'chrome') and is_buildbot: | 213 elif (runtime == 'ff' or runtime == 'chrome') and is_buildbot: |
214 # Print out browser version numbers if we're running on the buildbot (where | 214 # Print out browser version numbers if we're running on the buildbot (where |
215 # we know the paths to these browser installations). | 215 # we know the paths to these browser installations). |
216 version_query_string = '"%s" --version' % GetPath(runtime) | 216 version_query_string = '"%s" --version' % GetPath(runtime) |
217 if runtime == 'ff' and system == 'win7': | 217 if runtime == 'ff' and system == 'win7': |
218 version_query_string += '| more' | 218 version_query_string += '| more' |
219 elif runtime == 'chrome' and system == 'win7': | 219 elif runtime == 'chrome' and system == 'win7': |
220 version_query_string = ('''reg query "HKCU\\Software\\Microsoft\\''' + | 220 version_query_string = ('''reg query "HKCU\\Software\\Microsoft\\''' + |
221 '''Windows\\CurrentVersion\\Uninstall\\Google Chrome" /v Version''') | 221 '''Windows\\CurrentVersion\\Uninstall\\Google Chrome" /v Version''') |
222 p = subprocess.Popen(version_query_string, | 222 p = subprocess.Popen(version_query_string, |
223 stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) | 223 stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) |
224 output, stderr = p.communicate() | 224 output, stderr = p.communicate() |
225 output = output.split() | 225 output = output.split() |
226 try: | 226 try: |
227 print 'Version of %s: %s' % (runtime, output[-1]) | 227 print 'Version of %s: %s' % (runtime, output[-1]) |
228 except IndexError: | 228 except IndexError: |
229 # Failed to obtain version information. Continue running tests. | 229 # Failed to obtain version information. Continue running tests. |
230 pass | 230 pass |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
286 if system == 'win7': | 286 if system == 'win7': |
287 shutil.rmtree('C:\\Users\\chrome-bot\\AppData\\Local\\Temp', | 287 shutil.rmtree('C:\\Users\\chrome-bot\\AppData\\Local\\Temp', |
288 ignore_errors=True) | 288 ignore_errors=True) |
289 elif browser == 'ff': | 289 elif browser == 'ff': |
290 # 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 |
291 # password. The command won't actually work on regular machines without | 291 # password. The command won't actually work on regular machines without |
292 # root permissions. | 292 # root permissions. |
293 _DeleteFirefoxProfiles('/tmp') | 293 _DeleteFirefoxProfiles('/tmp') |
294 _DeleteFirefoxProfiles('/var/tmp') | 294 _DeleteFirefoxProfiles('/var/tmp') |
295 | 295 |
296 def MaybeClobber(runtime, mode, system): | 296 def ClobberBuilder(mode): |
297 """ Clobber the build directory if the clobber flag has been set. | 297 """ Clobber the builder before we do the build. |
298 Args: | 298 Args: |
299 - runtime: either 'd8', or one of the browsers, see GetBuildInfo | |
300 - mode: either 'debug' or 'release' | 299 - mode: either 'debug' or 'release' |
301 - system: either 'linux', 'mac', or 'win7' | |
302 """ | 300 """ |
303 builder_clobber = os.environ.get(BUILDER_CLOBBER) | 301 cmd = [sys.executable, |
304 if (builder_clobber != "1"): | 302 './tools/clean_output_directory.py', |
305 print "Clobber flag not set, not clobbering" | 303 '--mode=' + mode] |
306 return | 304 print 'Clobbering %s' % (' '.join(cmd)) |
305 return subprocess.call(cmd, env=NO_COLOR_ENV) | |
307 | 306 |
308 # TODO(ricow): add support for browser bots - sync with Emily | 307 def GetShouldClobber(): |
309 if (runtime == "d8"): | 308 if os.environ.get(BUILDER_CLOBBER) == "1": |
ahe
2012/08/14 17:57:20
return os.environ.get(BUILDER_CLOBBER) == "1"
| |
310 delete_path = os.path.join(DART_PATH, "out") | 309 return True |
311 print "Clobbering %s" % (delete_path) | 310 else: |
312 shutil.rmtree("", ignore_errors=True); | 311 return False |
313 | 312 |
314 def main(): | 313 def main(): |
315 | |
316 if len(sys.argv) == 0: | 314 if len(sys.argv) == 0: |
317 print 'Script pathname not known, giving up.' | 315 print 'Script pathname not known, giving up.' |
318 return 1 | 316 return 1 |
319 | 317 |
320 (compiler, runtime, mode, system, option, shard_index, total_shards, | 318 (compiler, runtime, mode, system, option, shard_index, total_shards, |
321 is_buildbot) = GetBuildInfo() | 319 is_buildbot) = GetBuildInfo() |
322 shard_description = "" | 320 shard_description = "" |
323 if shard_index: | 321 if shard_index: |
324 shard_description = " shard %s of %s" % (shard_index, total_shards) | 322 shard_description = " shard %s of %s" % (shard_index, total_shards) |
325 print "compiler: %s, runtime: %s mode: %s, system: %s, option: %s%s" % ( | 323 print "compiler: %s, runtime: %s mode: %s, system: %s, option: %s%s" % ( |
326 compiler, runtime, mode, system, option, shard_description) | 324 compiler, runtime, mode, system, option, shard_description) |
327 if compiler is None: | 325 if compiler is None: |
328 return 1 | 326 return 1 |
329 | 327 |
330 print '@@@BUILD_STEP Maybe clobber@@@' | 328 if GetShouldClobber(): |
331 MaybeClobber(runtime, mode, system) | 329 print '@@@BUILD_STEP Clobber@@@' |
330 status = ClobberBuilder(mode) | |
331 if status != 0: | |
332 print '@@@STEP_FAILURE@@@' | |
333 return status | |
332 | 334 |
333 print '@@@BUILD_STEP build sdk@@@' | 335 print '@@@BUILD_STEP build sdk@@@' |
334 status = BuildSDK(mode, system) | 336 status = BuildSDK(mode, system) |
335 if status != 0: | 337 if status != 0: |
336 print '@@@STEP_FAILURE@@@' | 338 print '@@@STEP_FAILURE@@@' |
337 return status | 339 return status |
338 | 340 |
339 test_flags = [] | 341 test_flags = [] |
340 if shard_index: | 342 if shard_index: |
341 test_flags = ['--shards=%s' % total_shards, '--shard=%s' % shard_index] | 343 test_flags = ['--shards=%s' % total_shards, '--shard=%s' % shard_index] |
342 | 344 |
343 # First we run all the regular tests. | 345 # First we run all the regular tests. |
344 status = TestCompiler(runtime, mode, system, option, test_flags, | 346 status = TestCompiler(runtime, mode, system, option, test_flags, |
345 is_buildbot) | 347 is_buildbot) |
346 | 348 |
347 # We only run checked mode tests when the host is not in checked mode. | 349 # We only run checked mode tests when the host is not in checked mode. |
348 if status == 0 and option != 'checked' and runtime == 'd8': | 350 if status == 0 and option != 'checked' and runtime == 'd8': |
349 status = TestCompiler(runtime, mode, system, option, | 351 status = TestCompiler(runtime, mode, system, option, |
350 test_flags + ['--checked'], is_buildbot) | 352 test_flags + ['--checked'], is_buildbot) |
351 | 353 |
352 if runtime != 'd8': CleanUpTemporaryFiles(system, runtime) | 354 if runtime != 'd8': CleanUpTemporaryFiles(system, runtime) |
353 if status != 0: print '@@@STEP_FAILURE@@@' | 355 if status != 0: print '@@@STEP_FAILURE@@@' |
354 return status | 356 return status |
355 | 357 |
356 if __name__ == '__main__': | 358 if __name__ == '__main__': |
357 sys.exit(main()) | 359 sys.exit(main()) |
OLD | NEW |