Index: utils/compiler/buildbot.py |
=================================================================== |
--- utils/compiler/buildbot.py (revision 9819) |
+++ utils/compiler/buildbot.py (working copy) |
@@ -54,8 +54,10 @@ |
option = None |
shard_index = None |
total_shards = None |
+ is_buildbot = True |
if not builder_name: |
# We are not running on a buildbot. |
+ is_buildbot = False |
if args.name: |
builder_name = args.name |
else: |
@@ -99,7 +101,8 @@ |
print ('Error: You cannot emulate a buildbot with a platform different ' |
'from your own.') |
sys.exit(1) |
- return (compiler, runtime, mode, system, option, shard_index, total_shards) |
+ return (compiler, runtime, mode, system, option, shard_index, total_shards, |
+ is_buildbot) |
def NeedsXterm(compiler, runtime): |
@@ -166,7 +169,7 @@ |
return subprocess.call(args, env=NO_COLOR_ENV) |
-def TestCompiler(compiler, runtime, mode, system, option, flags): |
+def TestCompiler(compiler, runtime, mode, system, option, flags, is_buildbot): |
""" test the compiler. |
Args: |
- compiler: either 'dart2js' or 'frog' |
@@ -175,6 +178,8 @@ |
- system: either 'linux', 'mac', or 'win7' |
- option: 'checked' |
- flags: extra flags to pass to test.dart |
+ - is_buildbot: true if we are running on a real buildbot instead of |
+ emulating one. |
""" |
# Make sure we are in the frog directory |
@@ -193,9 +198,35 @@ |
flags = (filter(lambda(item): not item.startswith('--shard'), flags) + |
['-j1']) |
+ def GetPath(runtime): |
+ """ Helper to get the path to the Chrome or Firefox executable for a |
+ particular platform on the buildbot. Throws a KeyError if runtime is not |
+ either 'chrome' or 'ff'.""" |
+ if system == 'mac': |
+ partDict = {'chrome': 'Google\\ Chrome', 'ff': 'Firefox'} |
+ mac_path = '/Applications/%s.app/Contents/MacOS/%s' |
+ path_dict = {'chrome': mac_path % (partDict[runtime], partDict[runtime]), |
+ 'ff': mac_path % (partDict[runtime], partDict[runtime].lower())} |
+ elif system == 'linux': |
+ path_dict = {'ff': 'firefox', 'chrome': 'google-chrome'} |
+ else: |
+ # Windows. |
+ path_dict = {'ff': os.path.join('C:/', 'Program Files (x86)', |
+ 'Mozilla Firefox', 'firefox.exe'), |
+ 'chrome': os.path.join('C:/', 'Users', 'chrome-bot', 'AppData', |
+ 'Local', 'Google', 'Chrome', 'Application', 'chrome.exe')} |
+ return path_dict[runtime] |
+ |
if system == 'linux' and runtime == 'chrome': |
# TODO(ngeoffray): We should install selenium on the buildbot. |
runtime = 'drt' |
+ elif ((runtime == 'ff' or runtime == 'chrome') and is_buildbot: |
+ # Print out browser version numbers if we're running on the buildbot (where |
+ # we know the paths to these browser installations). |
+ p = subprocess.Popen('%s --version' % GetPath(runtime), |
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) |
+ output, stderr = p.communicate() |
+ print 'Version of %s: %s' % (runtime, output) |
if compiler == 'dart2js': |
if option == 'checked': flags = flags + ['--host-checked'] |
@@ -274,8 +305,8 @@ |
print 'Script pathname not known, giving up.' |
return 1 |
- compiler, runtime, mode, system, option, shard_index, total_shards = ( |
- GetBuildInfo()) |
+ (compiler, runtime, mode, system, option, shard_index, total_shards, |
+ is_buildbot) = GetBuildInfo() |
shard_description = "" |
if shard_index: |
shard_description = " shard %s of %s" % (shard_index, total_shards) |
@@ -294,12 +325,13 @@ |
test_flags = ['--shards=%s' % total_shards, '--shard=%s' % shard_index] |
# First we run all the regular tests. |
- status = TestCompiler(compiler, runtime, mode, system, option, test_flags) |
+ status = TestCompiler(compiler, runtime, mode, system, option, test_flags, |
+ is_buildbot) |
# We only run checked mode tests when the host is not in checked mode. |
if status == 0 and option != 'checked' and runtime == 'd8': |
status = TestCompiler(compiler, runtime, mode, system, option, |
- test_flags + ['--checked']) |
+ test_flags + ['--checked'], is_buildbot) |
if runtime != 'd8': CleanUpTemporaryFiles(system, runtime) |
if status != 0: print '@@@STEP_FAILURE@@@' |