| 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 utils = bot_utils.GetUtils() | 19 utils = bot_utils.GetUtils() |
| 20 | 20 |
| 21 FT_BUILDER = r'ft-slave-(linux|mac)' | 21 FT_BUILDER = r'ft-slave-(linux|mac)' |
| 22 FT_MASTER = r'ft-master' | 22 FT_MASTER = r'ft-master' |
| 23 | 23 |
| 24 HOST_OS = utils.GuessOS() | 24 HOST_OS = utils.GuessOS() |
| 25 | 25 |
| 26 EDITOR_LOCATION='/home/chrome-bot/Desktop' | |
| 27 | |
| 28 def SrcConfig(name, is_buildbot): | 26 def SrcConfig(name, is_buildbot): |
| 29 """Returns info for the current buildbot based on the name of the builder. | 27 """Returns info for the current buildbot based on the name of the builder. |
| 30 | 28 |
| 31 - mode: always "release" | 29 - mode: always "release" |
| 32 - system: always "linux" or "mac" | 30 - system: always "linux" or "mac" |
| 33 """ | 31 """ |
| 34 pattern = re.match(FT_BUILDER, name) | 32 pattern = re.match(FT_BUILDER, name) |
| 35 master_pattern = re.match(FT_MASTER, name) | 33 master_pattern = re.match(FT_MASTER, name) |
| 36 if not pattern and not master_pattern: | 34 if not pattern and not master_pattern: |
| 37 return None | 35 return None |
| (...skipping 16 matching lines...) Expand all Loading... |
| 54 revision = int(os.environ['BUILDBOT_GOT_REVISION']) | 52 revision = int(os.environ['BUILDBOT_GOT_REVISION']) |
| 55 bot_name, _ = bot.GetBotName() | 53 bot_name, _ = bot.GetBotName() |
| 56 print bot_name | 54 print bot_name |
| 57 channel = bot_utils.GetChannelFromName(bot_name) | 55 channel = bot_utils.GetChannelFromName(bot_name) |
| 58 namer = bot_utils.GCSNamer(channel=channel) | 56 namer = bot_utils.GCSNamer(channel=channel) |
| 59 system = config.system | 57 system = config.system |
| 60 if system == 'mac': | 58 if system == 'mac': |
| 61 system = 'macos' | 59 system = 'macos' |
| 62 editor_path = namer.editor_zipfilepath(revision, system, 'x64') | 60 editor_path = namer.editor_zipfilepath(revision, system, 'x64') |
| 63 gsutils = bot_utils.GSUtil() | 61 gsutils = bot_utils.GSUtil() |
| 64 local_path = os.path.join(EDITOR_LOCATION, 'editor.zip') | 62 editor_location='/home/chrome-bot/Desktop' |
| 63 if system == 'macos': |
| 64 editor_location='/Users/chrome-bot/Desktop' |
| 65 local_path = os.path.join(editor_location, 'editor.zip') |
| 65 if os.path.exists(local_path): | 66 if os.path.exists(local_path): |
| 66 os.remove(local_path) | 67 os.remove(local_path) |
| 67 local_extracted = os.path.join(EDITOR_LOCATION, 'dart') | 68 local_extracted = os.path.join(editor_location, 'dart') |
| 68 shutil.rmtree(local_extracted, ignore_errors=True) | 69 shutil.rmtree(local_extracted, ignore_errors=True) |
| 69 gsutils.execute(['cp', editor_path, local_path]) | 70 gsutils.execute(['cp', editor_path, local_path]) |
| 70 Run(['unzip', local_path, '-d', EDITOR_LOCATION]) | 71 Run(['unzip', local_path, '-d', editor_location]) |
| 71 | 72 |
| 72 def FTMaster(config): | 73 def FTMaster(config): |
| 73 run = int(os.environ['BUILDBOT_ANNOTATED_STEPS_RUN']) | 74 run = int(os.environ['BUILDBOT_ANNOTATED_STEPS_RUN']) |
| 74 with bot.BuildStep('Master run %s' % run): | 75 with bot.BuildStep('Master run %s' % run): |
| 75 if run == 1: | 76 if run == 1: |
| 76 print 'Not doing anything on master before the triggers' | 77 print 'Not doing anything on master before the triggers' |
| 77 return | 78 return |
| 78 else: | 79 else: |
| 79 builddir = os.path.join(bot_utils.DART_DIR, | 80 builddir = os.path.join(bot_utils.DART_DIR, |
| 80 utils.GetBuildDir(HOST_OS, HOST_OS), | 81 utils.GetBuildDir(HOST_OS, HOST_OS), |
| 81 'functional_testing') | 82 'functional_testing') |
| 82 shutil.rmtree(builddir, ignore_errors=True) | 83 shutil.rmtree(builddir, ignore_errors=True) |
| 83 os.makedirs(builddir) | 84 os.makedirs(builddir) |
| 84 script_locations = os.path.join(bot_utils.DART_DIR, 'editor', 'ft') | 85 script_locations = os.path.join(bot_utils.DART_DIR, 'editor', 'ft') |
| 85 Run(['/home/chrome-bot/func-test/bot-run', builddir, script_locations]) | 86 Run(['/home/chrome-bot/func-test/bot-run', builddir, script_locations]) |
| 86 | 87 |
| 87 def FTSteps(config): | 88 def FTSteps(config): |
| 88 if config.builder_tag == 'master': | 89 if config.builder_tag == 'master': |
| 89 FTMaster(config) | 90 FTMaster(config) |
| 90 else: | 91 else: |
| 91 FTSlave(config) | 92 FTSlave(config) |
| 92 | 93 |
| 93 if __name__ == '__main__': | 94 if __name__ == '__main__': |
| 94 bot.RunBot(SrcConfig, FTSteps, build_step=None) | 95 bot.RunBot(SrcConfig, FTSteps, build_step=None) |
| OLD | NEW |