OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 import collections | 7 import collections |
8 import copy | 8 import copy |
9 import json | 9 import json |
10 import os | 10 import os |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 print bb_utils.CommandToString(command) | 266 print bb_utils.CommandToString(command) |
267 sys.stdout.flush() | 267 sys.stdout.flush() |
268 if options.testing: | 268 if options.testing: |
269 env['BUILDBOT_TESTING'] = '1' | 269 env['BUILDBOT_TESTING'] = '1' |
270 return_code = subprocess.call(command, cwd=bb_utils.CHROME_SRC, env=env) | 270 return_code = subprocess.call(command, cwd=bb_utils.CHROME_SRC, env=env) |
271 if return_code != 0: | 271 if return_code != 0: |
272 return return_code | 272 return return_code |
273 | 273 |
274 | 274 |
275 def main(argv): | 275 def main(argv): |
| 276 proc = subprocess.Popen( |
| 277 ['/bin/hostname', '-f'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
| 278 hostname_stdout, hostname_stderr = proc.communicate() |
| 279 if proc.returncode == 0: |
| 280 print 'Running on: ' + hostname_stdout |
| 281 else: |
| 282 print >> sys.stderr, 'WARNING: failed to run hostname' |
| 283 print >> sys.stderr, hostname_stdout |
| 284 print >> sys.stderr, hostname_stderr |
| 285 sys.exit(1) |
| 286 |
276 parser = GetRunBotOptParser() | 287 parser = GetRunBotOptParser() |
277 options, args = parser.parse_args(argv[1:]) | 288 options, args = parser.parse_args(argv[1:]) |
278 if args: | 289 if args: |
279 parser.error('Unused args: %s' % args) | 290 parser.error('Unused args: %s' % args) |
280 | 291 |
281 bot_config = GetBotConfig(options, GetBotStepMap()) | 292 bot_config = GetBotConfig(options, GetBotStepMap()) |
282 if not bot_config: | 293 if not bot_config: |
283 sys.exit(1) | 294 sys.exit(1) |
284 | 295 |
285 print 'Using config:', bot_config | 296 print 'Using config:', bot_config |
286 | 297 |
287 commands = GetCommands(options, bot_config) | 298 commands = GetCommands(options, bot_config) |
288 for command in commands: | 299 for command in commands: |
289 print 'Will run: ', bb_utils.CommandToString(command) | 300 print 'Will run: ', bb_utils.CommandToString(command) |
290 print | 301 print |
291 | 302 |
292 env = GetEnvironment(bot_config.host_obj, options.testing) | 303 env = GetEnvironment(bot_config.host_obj, options.testing) |
293 return RunBotCommands(options, commands, env) | 304 return RunBotCommands(options, commands, env) |
294 | 305 |
295 | 306 |
296 if __name__ == '__main__': | 307 if __name__ == '__main__': |
297 sys.exit(main(sys.argv)) | 308 sys.exit(main(sys.argv)) |
OLD | NEW |