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 os.path |
12 import re | 13 import re |
13 import shutil | 14 import shutil |
| 15 import subprocess |
14 import sys | 16 import sys |
15 | 17 |
16 import bot | 18 import bot |
17 import bot_utils | 19 import bot_utils |
18 | 20 |
19 utils = bot_utils.GetUtils() | 21 utils = bot_utils.GetUtils() |
20 | 22 |
21 FT_BUILDER = r'ft-slave-(linux|mac)' | 23 FT_BUILDER = r'ft-slave-(linux|mac)' |
22 FT_MASTER = r'ft-master' | 24 FT_MASTER = r'ft-master' |
23 | 25 |
24 HOST_OS = utils.GuessOS() | 26 HOST_OS = utils.GuessOS() |
25 | 27 |
| 28 def IsWindows(): |
| 29 return HOST_OS == 'win32' |
| 30 |
26 def SrcConfig(name, is_buildbot): | 31 def SrcConfig(name, is_buildbot): |
27 """Returns info for the current buildbot based on the name of the builder. | 32 """Returns info for the current buildbot based on the name of the builder. |
28 | 33 |
29 - mode: always "release" | 34 - mode: always "release" |
30 - system: always "linux" or "mac" | 35 - system: always "linux" or "mac" |
31 """ | 36 """ |
32 pattern = re.match(FT_BUILDER, name) | 37 pattern = re.match(FT_BUILDER, name) |
33 master_pattern = re.match(FT_MASTER, name) | 38 master_pattern = re.match(FT_MASTER, name) |
34 if not pattern and not master_pattern: | 39 if not pattern and not master_pattern: |
35 return None | 40 return None |
36 if master_pattern: | 41 if master_pattern: |
37 tag = 'master' | 42 tag = 'master' |
38 system = 'linux' | 43 system = 'linux' |
39 else: | 44 else: |
40 tag = 'slave' | 45 tag = 'slave' |
41 system = pattern.group(1) | 46 system = pattern.group(1) |
42 return bot.BuildInfo('none', 'none', 'release', system, | 47 return bot.BuildInfo('none', 'none', 'release', system, |
43 builder_tag=tag) | 48 builder_tag=tag) |
44 | 49 |
45 def Run(args): | 50 def Run(args): |
46 print "Running: %s" % ' '.join(args) | 51 print "Running: %s" % ' '.join(args) |
47 sys.stdout.flush() | 52 sys.stdout.flush() |
48 bot.RunProcess(args) | 53 bot.RunProcess(args) |
49 | 54 |
50 def FTSlave(config): | 55 def FTSlave(config): |
| 56 |
| 57 # Run SWTBot tests |
| 58 if len(sys.argv) > 0: |
| 59 scriptdir = os.path.dirname(sys.argv[0]) |
| 60 builddir = os.path.join(scriptdir, '..', '..', 'editor', 'build') |
| 61 testScript = os.path.join(builddir, 'testswteditor.py') |
| 62 cmd = [sys.executable, testScript] |
| 63 try: |
| 64 subprocess.call(cmd, shell=IsWindows()) |
| 65 except: |
| 66 pass |
| 67 |
| 68 # Prepare to run EggPlant tests |
51 with bot.BuildStep('Fetching editor'): | 69 with bot.BuildStep('Fetching editor'): |
52 revision = int(os.environ['BUILDBOT_GOT_REVISION']) | 70 revision = int(os.environ['BUILDBOT_GOT_REVISION']) |
53 bot_name, _ = bot.GetBotName() | 71 bot_name, _ = bot.GetBotName() |
54 print bot_name | 72 print bot_name |
55 channel = bot_utils.GetChannelFromName(bot_name) | 73 channel = bot_utils.GetChannelFromName(bot_name) |
56 namer = bot_utils.GCSNamer(channel=channel) | 74 namer = bot_utils.GCSNamer(channel=channel) |
57 system = config.system | 75 system = config.system |
58 if system == 'mac': | 76 if system == 'mac': |
59 system = 'macos' | 77 system = 'macos' |
60 editor_path = namer.editor_zipfilepath(revision, system, 'x64') | 78 editor_path = namer.editor_zipfilepath(revision, system, 'x64') |
(...skipping 16 matching lines...) Expand all Loading... |
77 print 'Not doing anything on master before the triggers' | 95 print 'Not doing anything on master before the triggers' |
78 return | 96 return |
79 else: | 97 else: |
80 builddir = os.path.join(bot_utils.DART_DIR, | 98 builddir = os.path.join(bot_utils.DART_DIR, |
81 utils.GetBuildDir(HOST_OS), | 99 utils.GetBuildDir(HOST_OS), |
82 'functional_testing') | 100 'functional_testing') |
83 shutil.rmtree(builddir, ignore_errors=True) | 101 shutil.rmtree(builddir, ignore_errors=True) |
84 os.makedirs(builddir) | 102 os.makedirs(builddir) |
85 script_locations = os.path.join(bot_utils.DART_DIR, 'editor', 'ft') | 103 script_locations = os.path.join(bot_utils.DART_DIR, 'editor', 'ft') |
86 Run(['/home/chrome-bot/func-test/bot-run', builddir, script_locations]) | 104 Run(['/home/chrome-bot/func-test/bot-run', builddir, script_locations]) |
| 105 #TODO Copy builddir to shared storage somewhere. |
87 | 106 |
88 def FTSteps(config): | 107 def FTSteps(config): |
89 if config.builder_tag == 'master': | 108 if config.builder_tag == 'master': |
90 FTMaster(config) | 109 FTMaster(config) |
91 else: | 110 else: |
92 FTSlave(config) | 111 FTSlave(config) |
93 | 112 |
94 if __name__ == '__main__': | 113 if __name__ == '__main__': |
95 bot.RunBot(SrcConfig, FTSteps, build_step=None) | 114 bot.RunBot(SrcConfig, FTSteps, build_step=None) |
OLD | NEW |