| 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 |
| 12 import re |
| 13 import shutil |
| 14 import sys |
| 15 |
| 16 import bot |
| 17 import bot_utils |
| 18 |
| 19 FT_BUILDER = r'ft-slave-(linux|mac)' |
| 20 |
| 21 EDITOR_LOCATION='/home/chrome-bot/Desktop' |
| 22 |
| 23 def SrcConfig(name, is_buildbot): |
| 24 """Returns info for the current buildbot based on the name of the builder. |
| 25 |
| 26 - mode: always "release" |
| 27 - system: always "linux" or "mac" |
| 28 """ |
| 29 pattern = re.match(FT_BUILDER, name) |
| 30 if not pattern: |
| 31 return None |
| 32 return bot.BuildInfo('none', 'none', 'release', pattern.group(1)) |
| 33 |
| 34 def Run(args): |
| 35 print "Running: %s" % ' '.join(args) |
| 36 sys.stdout.flush() |
| 37 bot.RunProcess(args) |
| 38 |
| 39 def FTSteps(config): |
| 40 revision = int(os.environ['BUILDBOT_GOT_REVISION']) |
| 41 bot_name, _ = bot.GetBotName() |
| 42 print bot_name |
| 43 channel = bot_utils.GetChannelFromName(bot_name) |
| 44 namer = bot_utils.GCSNamer(channel=channel) |
| 45 system = config.system |
| 46 if system == 'mac': |
| 47 system = 'macos' |
| 48 editor_path = namer.editor_zipfilepath(revision, system, 'x64') |
| 49 gsutils = bot_utils.GSUtil() |
| 50 local_path = os.path.join(EDITOR_LOCATION, 'editor.zip') |
| 51 if os.path.exists(local_path): |
| 52 os.remove(local_path) |
| 53 local_extracted = os.path.join(EDITOR_LOCATION, 'dart') |
| 54 shutil.rmtree(local_extracted, ignore_errors=True) |
| 55 gsutils.execute(['cp', editor_path, local_path]) |
| 56 Run(['unzip', local_path, '-d', EDITOR_LOCATION]) |
| 57 |
| 11 if __name__ == '__main__': | 58 if __name__ == '__main__': |
| 12 print "Functional testing placeholder" | 59 bot.RunBot(SrcConfig, FTSteps) |
| OLD | NEW |