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

Side by Side Diff: build/android/buildbot/bb_utils.py

Issue 26747004: Add option to restart usb on device status check before performing check. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make failed restart_usb.py fail on error. Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import json 5 import json
6 import optparse 6 import optparse
7 import os 7 import os
8 import pipes 8 import pipes
9 import subprocess 9 import subprocess
10 import sys 10 import sys
(...skipping 27 matching lines...) Expand all
38 38
39 def SpawnCmd(command, stdout=None, cwd=CHROME_SRC): 39 def SpawnCmd(command, stdout=None, cwd=CHROME_SRC):
40 """Spawn a process without waiting for termination.""" 40 """Spawn a process without waiting for termination."""
41 print '>', CommandToString(command) 41 print '>', CommandToString(command)
42 sys.stdout.flush() 42 sys.stdout.flush()
43 if TESTING: 43 if TESTING:
44 class MockPopen(object): 44 class MockPopen(object):
45 @staticmethod 45 @staticmethod
46 def wait(): 46 def wait():
47 return 0 47 return 0
48 @staticmethod
49 def communicate():
50 return '', ''
48 return MockPopen() 51 return MockPopen()
49 return subprocess.Popen(command, cwd=cwd, stdout=stdout) 52 return subprocess.Popen(command, cwd=cwd, stdout=stdout)
50 53
51 54
52 def RunCmd(command, flunk_on_failure=True, halt_on_failure=False, 55 def RunCmd(command, flunk_on_failure=True, halt_on_failure=False,
53 warning_code=constants.WARNING_EXIT_CODE, stdout=None, 56 warning_code=constants.WARNING_EXIT_CODE, stdout=None,
54 cwd=CHROME_SRC): 57 cwd=CHROME_SRC):
55 """Run a command relative to the chrome source root.""" 58 """Run a command relative to the chrome source root."""
56 code = SpawnCmd(command, stdout, cwd).wait() 59 code = SpawnCmd(command, stdout, cwd).wait()
57 print '<', CommandToString(command) 60 print '<', CommandToString(command)
(...skipping 30 matching lines...) Expand all
88 91
89 def RunSteps(steps, step_cmds, options): 92 def RunSteps(steps, step_cmds, options):
90 unknown_steps = set(steps) - set(step for step, _ in step_cmds) 93 unknown_steps = set(steps) - set(step for step, _ in step_cmds)
91 if unknown_steps: 94 if unknown_steps:
92 print >> sys.stderr, 'FATAL: Unknown steps %s' % list(unknown_steps) 95 print >> sys.stderr, 'FATAL: Unknown steps %s' % list(unknown_steps)
93 sys.exit(1) 96 sys.exit(1)
94 97
95 for step, cmd in step_cmds: 98 for step, cmd in step_cmds:
96 if step in steps: 99 if step in steps:
97 cmd(options) 100 cmd(options)
OLDNEW
« build/android/buildbot/bb_device_status_check.py ('K') | « build/android/buildbot/bb_device_steps.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698