Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / build / android / buildbot / tests / bb_run_bot_test.py
blob810c60dac2f39773d6f680f9c1d537f08f942f6d
1 #!/usr/bin/env python
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
6 import os
7 import subprocess
8 import sys
10 BUILDBOT_DIR = os.path.join(os.path.dirname(__file__), '..')
11 sys.path.append(BUILDBOT_DIR)
12 import bb_run_bot
14 def RunBotProcesses(bot_process_map):
15 code = 0
16 for bot, proc in bot_process_map:
17 _, err = proc.communicate()
18 code |= proc.returncode
19 if proc.returncode != 0:
20 print 'Error running the bot script with id="%s"' % bot, err
22 return code
25 def main():
26 procs = [
27 (bot, subprocess.Popen(
28 [os.path.join(BUILDBOT_DIR, 'bb_run_bot.py'), '--bot-id', bot,
29 '--testing'], stdout=subprocess.PIPE, stderr=subprocess.PIPE))
30 for bot in bb_run_bot.GetBotStepMap()]
31 return RunBotProcesses(procs)
34 if __name__ == '__main__':
35 sys.exit(main())