| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2014, 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 """ | 7 """ |
| 8 Buildbot steps for functional testing master and slaves | 8 Buildbot steps for functional testing master and slaves |
| 9 """ | 9 """ |
| 10 | 10 |
| 11 import os | 11 import os |
| 12 import re | 12 import re |
| 13 import shutil | 13 import shutil |
| 14 import sys | 14 import sys |
| 15 | 15 |
| 16 import bot | 16 import bot |
| 17 import bot_utils | 17 import bot_utils |
| 18 | 18 |
| 19 FT_BUILDER = r'ft-slave-(linux|mac)' | 19 FT_BUILDER = r'ft-slave-(linux|mac)' |
| 20 FT_MASTER = r'ft-master' |
| 20 | 21 |
| 21 EDITOR_LOCATION='/home/chrome-bot/Desktop' | 22 EDITOR_LOCATION='/home/chrome-bot/Desktop' |
| 22 | 23 |
| 23 def SrcConfig(name, is_buildbot): | 24 def SrcConfig(name, is_buildbot): |
| 24 """Returns info for the current buildbot based on the name of the builder. | 25 """Returns info for the current buildbot based on the name of the builder. |
| 25 | 26 |
| 26 - mode: always "release" | 27 - mode: always "release" |
| 27 - system: always "linux" or "mac" | 28 - system: always "linux" or "mac" |
| 28 """ | 29 """ |
| 29 pattern = re.match(FT_BUILDER, name) | 30 pattern = re.match(FT_BUILDER, name) |
| 30 if not pattern: | 31 master_pattern = re.match(FT_MASTER, name) |
| 32 if not pattern and not master_pattern: |
| 31 return None | 33 return None |
| 32 return bot.BuildInfo('none', 'none', 'release', pattern.group(1)) | 34 if master_pattern: |
| 35 tag = 'master' |
| 36 system = 'linux' |
| 37 else: |
| 38 tag = 'slave' |
| 39 system = pattern.group(1) |
| 40 return bot.BuildInfo('none', 'none', 'release', system, |
| 41 builder_tag=tag) |
| 33 | 42 |
| 34 def Run(args): | 43 def Run(args): |
| 35 print "Running: %s" % ' '.join(args) | 44 print "Running: %s" % ' '.join(args) |
| 36 sys.stdout.flush() | 45 sys.stdout.flush() |
| 37 bot.RunProcess(args) | 46 bot.RunProcess(args) |
| 38 | 47 |
| 39 def FTSteps(config): | 48 def FTSteps(config): |
| 49 if config.builder_tag == 'master': |
| 50 print 'Not doing anything on master for now' |
| 51 return |
| 40 revision = int(os.environ['BUILDBOT_GOT_REVISION']) | 52 revision = int(os.environ['BUILDBOT_GOT_REVISION']) |
| 41 bot_name, _ = bot.GetBotName() | 53 bot_name, _ = bot.GetBotName() |
| 42 print bot_name | 54 print bot_name |
| 43 channel = bot_utils.GetChannelFromName(bot_name) | 55 channel = bot_utils.GetChannelFromName(bot_name) |
| 44 namer = bot_utils.GCSNamer(channel=channel) | 56 namer = bot_utils.GCSNamer(channel=channel) |
| 45 system = config.system | 57 system = config.system |
| 46 if system == 'mac': | 58 if system == 'mac': |
| 47 system = 'macos' | 59 system = 'macos' |
| 48 editor_path = namer.editor_zipfilepath(revision, system, 'x64') | 60 editor_path = namer.editor_zipfilepath(revision, system, 'x64') |
| 49 gsutils = bot_utils.GSUtil() | 61 gsutils = bot_utils.GSUtil() |
| 50 local_path = os.path.join(EDITOR_LOCATION, 'editor.zip') | 62 local_path = os.path.join(EDITOR_LOCATION, 'editor.zip') |
| 51 if os.path.exists(local_path): | 63 if os.path.exists(local_path): |
| 52 os.remove(local_path) | 64 os.remove(local_path) |
| 53 local_extracted = os.path.join(EDITOR_LOCATION, 'dart') | 65 local_extracted = os.path.join(EDITOR_LOCATION, 'dart') |
| 54 shutil.rmtree(local_extracted, ignore_errors=True) | 66 shutil.rmtree(local_extracted, ignore_errors=True) |
| 55 gsutils.execute(['cp', editor_path, local_path]) | 67 gsutils.execute(['cp', editor_path, local_path]) |
| 56 Run(['unzip', local_path, '-d', EDITOR_LOCATION]) | 68 Run(['unzip', local_path, '-d', EDITOR_LOCATION]) |
| 57 | 69 |
| 58 if __name__ == '__main__': | 70 if __name__ == '__main__': |
| 59 bot.RunBot(SrcConfig, FTSteps) | 71 bot.RunBot(SrcConfig, FTSteps) |
| OLD | NEW |