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

Unified Diff: build/android/buildbot/bb_run_bot.py

Issue 18325030: [Android] Refactor so that few pieces can be reused downstream. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | build/android/buildbot/tests/bb_run_bot_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/buildbot/bb_run_bot.py
diff --git a/build/android/buildbot/bb_run_bot.py b/build/android/buildbot/bb_run_bot.py
index 72bda44422bb8eb37cfa0b0d02b259d184d5191b..51e4156e96b0a39702d20bd9b0fd145b0fc2021b 100755
--- a/build/android/buildbot/bb_run_bot.py
+++ b/build/android/buildbot/bb_run_bot.py
@@ -209,29 +209,20 @@ def GetRunBotOptParser():
return parser
-def main(argv):
- parser = GetRunBotOptParser()
- options, args = parser.parse_args(argv[1:])
- if args:
- parser.error('Unused args: %s' % args)
-
+def GetBotConfig(options, bot_step_map):
bot_id = options.bot_id or options.factory_properties.get('android_bot_id')
if not bot_id:
- parser.error('A bot id must be specified through option or factory_props.')
+ print (sys.stderr,
+ 'A bot id must be specified through option or factory_props.')
+ return
- bot_config = GetBestMatch(GetBotStepMap(), bot_id)
+ bot_config = GetBestMatch(bot_step_map, bot_id)
if not bot_config:
print 'Error: config for id="%s" cannot be inferred.' % bot_id
- return 1
-
- print 'Using config:', bot_config
+ return bot_config
- commands = GetCommands(options, bot_config)
- for command in commands:
- print 'Will run: ', bb_utils.CommandToString(command)
- print
- env = GetEnvironment(bot_config.host_obj, options.testing)
+def RunBotCommands(options, commands, env):
print 'Environment changes:'
print DictDiff(dict(os.environ), env)
@@ -245,5 +236,26 @@ def main(argv):
return return_code
+def main(argv):
+ parser = GetRunBotOptParser()
+ options, args = parser.parse_args(argv[1:])
+ if args:
+ parser.error('Unused args: %s' % args)
+
+ bot_config = GetBotConfig(options, GetBotStepMap())
+ if not bot_config:
+ sys.exit(1)
+
+ print 'Using config:', bot_config
+
+ commands = GetCommands(options, bot_config)
+ for command in commands:
+ print 'Will run: ', bb_utils.CommandToString(command)
+ print
+
+ env = GetEnvironment(bot_config.host_obj, options.testing)
+ return RunBotCommands(options, commands, env)
+
+
if __name__ == '__main__':
sys.exit(main(sys.argv))
« no previous file with comments | « no previous file | build/android/buildbot/tests/bb_run_bot_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698