OLD | NEW |
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 |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 os.path.join('third_party', 'pkg', 'test', 'bin', 'test.dart')) | 264 os.path.join('third_party', 'pkg', 'test', 'bin', 'test.dart')) |
265 | 265 |
266 with utils.ChangedWorkingDirectory(path): | 266 with utils.ChangedWorkingDirectory(path): |
267 args = [dart_bin, '--package-root=' + package_root, test_bin, | 267 args = [dart_bin, '--package-root=' + package_root, test_bin, |
268 '--package-root', package_root, '--reporter', 'expanded', | 268 '--package-root', package_root, '--reporter', 'expanded', |
269 '--no-color'] | 269 '--no-color'] |
270 print("Running %s" % ' '.join(args)) | 270 print("Running %s" % ' '.join(args)) |
271 RunProcess(args) | 271 RunProcess(args) |
272 | 272 |
273 | 273 |
274 def RunProcess(command): | 274 def RunProcess(command, env=None): |
275 """ | 275 """ |
276 Runs command. | 276 Runs command. |
277 | 277 |
278 If a non-zero exit code is returned, raises an OSError with errno as the exit | 278 If a non-zero exit code is returned, raises an OSError with errno as the exit |
279 code. | 279 code. |
280 """ | 280 """ |
281 no_color_env = dict(os.environ) | 281 if env is None: |
| 282 no_color_env = dict(os.environ) |
| 283 else: |
| 284 no_color_env = env |
282 no_color_env['TERM'] = 'nocolor' | 285 no_color_env['TERM'] = 'nocolor' |
283 | 286 |
284 exit_code = subprocess.call(command, env=no_color_env) | 287 exit_code = subprocess.call(command, env=no_color_env) |
285 if exit_code != 0: | 288 if exit_code != 0: |
286 raise OSError(exit_code) | 289 raise OSError(exit_code) |
287 | 290 |
288 | 291 |
289 def GetStepName(name, flags): | 292 def GetStepName(name, flags): |
290 """ | 293 """ |
291 Filters out flags with '=' as this breaks the /stats feature of the buildbot. | 294 Filters out flags with '=' as this breaks the /stats feature of the buildbot. |
292 """ | 295 """ |
293 flags = [x for x in flags if not '=' in x] | 296 flags = [x for x in flags if not '=' in x] |
294 return ('%s tests %s' % (name, ' '.join(flags))).strip() | 297 return ('%s tests %s' % (name, ' '.join(flags))).strip() |
OLD | NEW |