Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(491)

Side by Side Diff: tools/bots/bot.py

Issue 1214343004: Run pub tests on the pub bots. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Use the right dart_style version. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « DEPS ('k') | tools/bots/pkg.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 3 # Copyright (c) 2012, 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 Shared code for use in the buildbot scripts. 8 Shared code for use in the buildbot scripts.
9 """ 9 """
10 10
11 import optparse 11 import optparse
12 import os 12 import os
13 from os.path import abspath 13 from os.path import abspath
14 from os.path import dirname 14 from os.path import dirname
15 import subprocess 15 import subprocess
16 import sys 16 import sys
17 17
18 DART_PATH = dirname(dirname(dirname(abspath(__file__)))) 18 import bot_utils
19
20 utils = bot_utils.GetUtils()
21
22 BUILD_OS = utils.GuessOS()
19 23
20 BUILDER_NAME = 'BUILDBOT_BUILDERNAME' 24 BUILDER_NAME = 'BUILDBOT_BUILDERNAME'
21 BUILDER_CLOBBER = 'BUILDBOT_CLOBBER' 25 BUILDER_CLOBBER = 'BUILDBOT_CLOBBER'
22 26
23 27
24 class BuildInfo(object): 28 class BuildInfo(object):
25 """ 29 """
26 Encapsulation of build information. 30 Encapsulation of build information.
27 31
28 - compiler: None or 'dart2js' 32 - compiler: None or 'dart2js'
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 name, is_buildbot = GetBotName() 148 name, is_buildbot = GetBotName()
145 build_info = parse_name(name, is_buildbot) 149 build_info = parse_name(name, is_buildbot)
146 if not build_info: 150 if not build_info:
147 print 'Could not handle unfamiliar bot name "%s".' % name 151 print 'Could not handle unfamiliar bot name "%s".' % name
148 sys.exit(1) 152 sys.exit(1)
149 153
150 # Print out the buildinfo for easy debugging. 154 # Print out the buildinfo for easy debugging.
151 build_info.PrintBuildInfo() 155 build_info.PrintBuildInfo()
152 156
153 # Make sure we are in the dart directory 157 # Make sure we are in the dart directory
154 os.chdir(DART_PATH) 158 os.chdir(bot_utils.DART_DIR)
155 159
156 try: 160 try:
157 Clobber() 161 Clobber()
158 if build_step: 162 if build_step:
159 build_step(build_info) 163 build_step(build_info)
160 164
161 custom_steps(build_info) 165 custom_steps(build_info)
162 except OSError as e: 166 except OSError as e:
163 sys.exit(e.errno) 167 sys.exit(e.errno)
164 168
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 if build_info.checked: 237 if build_info.checked:
234 cmd.append('--checked') 238 cmd.append('--checked')
235 239
236 cmd.extend(flags) 240 cmd.extend(flags)
237 cmd.extend(targets) 241 cmd.extend(targets)
238 242
239 print 'Running: %s' % (' '.join(map(lambda arg: '"%s"' % arg, cmd))) 243 print 'Running: %s' % (' '.join(map(lambda arg: '"%s"' % arg, cmd)))
240 RunProcess(cmd) 244 RunProcess(cmd)
241 245
242 246
247 def RunTestRunner(build_info, path):
248 """
249 Runs the test package's runner on the package at 'path'.
250 """
251 sdk_bin = os.path.join(
252 bot_utils.DART_DIR,
253 utils.GetBuildSdkBin(BUILD_OS, build_info.mode, build_info.arch))
254
255 build_root = utils.GetBuildRoot(
256 BUILD_OS, build_info.mode, build_info.arch)
257 package_root = os.path.abspath(os.path.join(build_root, 'packages'))
258
259 dart_name = 'dart.exe' if build_info.system == 'windows' else 'dart'
260 dart_bin = os.path.join(sdk_bin, dart_name)
261
262 test_bin = os.path.abspath(
263 os.path.join('third_party', 'pkg', 'test', 'bin', 'test.dart'))
264
265 with utils.ChangedWorkingDirectory(path):
266 args = [dart_bin, '--package-root=' + package_root, test_bin,
267 '--package-root', package_root, '--reporter', 'expanded',
268 '--no-color']
269 print("Running %s" % ' '.join(args))
270 RunProcess(args)
271
272
243 def RunProcess(command): 273 def RunProcess(command):
244 """ 274 """
245 Runs command. 275 Runs command.
246 276
247 If a non-zero exit code is returned, raises an OSError with errno as the exit 277 If a non-zero exit code is returned, raises an OSError with errno as the exit
248 code. 278 code.
249 """ 279 """
250 no_color_env = dict(os.environ) 280 no_color_env = dict(os.environ)
251 no_color_env['TERM'] = 'nocolor' 281 no_color_env['TERM'] = 'nocolor'
252 282
253 exit_code = subprocess.call(command, env=no_color_env) 283 exit_code = subprocess.call(command, env=no_color_env)
254 if exit_code != 0: 284 if exit_code != 0:
255 raise OSError(exit_code) 285 raise OSError(exit_code)
256 286
257 287
258 def GetStepName(name, flags): 288 def GetStepName(name, flags):
259 """ 289 """
260 Filters out flags with '=' as this breaks the /stats feature of the buildbot. 290 Filters out flags with '=' as this breaks the /stats feature of the buildbot.
261 """ 291 """
262 flags = [x for x in flags if not '=' in x] 292 flags = [x for x in flags if not '=' in x]
263 return ('%s tests %s' % (name, ' '.join(flags))).strip() 293 return ('%s tests %s' % (name, ' '.join(flags))).strip()
OLDNEW
« no previous file with comments | « DEPS ('k') | tools/bots/pkg.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698