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

Side by Side Diff: build/android/bb_run_sharded_steps.py

Issue 22430003: Enables (temporarily) adb trace for sharded perf tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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
« no previous file with comments | « no previous file | third_party/android_testrunner/run_command.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2012 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 """Helper script to shard build bot steps and save results to disk. 7 """Helper script to shard build bot steps and save results to disk.
8 8
9 Our buildbot infrastructure requires each slave to run steps serially. 9 Our buildbot infrastructure requires each slave to run steps serially.
10 This is sub-optimal for android, where these steps can run independently on 10 This is sub-optimal for android, where these steps can run independently on
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 import json 47 import json
48 import logging 48 import logging
49 import multiprocessing 49 import multiprocessing
50 import optparse 50 import optparse
51 import pexpect 51 import pexpect
52 import pickle 52 import pickle
53 import os 53 import os
54 import signal 54 import signal
55 import shutil 55 import shutil
56 import sys 56 import sys
57 import time
57 58
58 from pylib import android_commands 59 from pylib import android_commands
59 from pylib import cmd_helper 60 from pylib import cmd_helper
60 from pylib import constants 61 from pylib import constants
61 from pylib import forwarder 62 from pylib import forwarder
62 from pylib import ports 63 from pylib import ports
63 64
64 65
65 _OUTPUT_DIR = os.path.join(constants.DIR_SOURCE_ROOT, 'out', 'step_results') 66 _OUTPUT_DIR = os.path.join(constants.DIR_SOURCE_ROOT, 'out', 'step_results')
66 67
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 for retry in range(5): 168 for retry in range(5):
168 for server in ['lighttpd', 'web-page-replay']: 169 for server in ['lighttpd', 'web-page-replay']:
169 pids = cmd_helper.GetCmdOutput(['pgrep', '-f', server]) 170 pids = cmd_helper.GetCmdOutput(['pgrep', '-f', server])
170 pids = [pid.strip() for pid in pids.split('\n') if pid.strip()] 171 pids = [pid.strip() for pid in pids.split('\n') if pid.strip()]
171 for pid in pids: 172 for pid in pids:
172 try: 173 try:
173 logging.warning('Killing %s %s', server, pid) 174 logging.warning('Killing %s %s', server, pid)
174 os.kill(int(pid), signal.SIGQUIT) 175 os.kill(int(pid), signal.SIGQUIT)
175 except Exception as e: 176 except Exception as e:
176 logging.warning('Failed killing %s %s %s', server, pid, e) 177 logging.warning('Failed killing %s %s %s', server, pid, e)
178 # Restart the adb server with full trace, and redirect stderr to stdout
179 # so the extra tracing won't confuse higher up layers.
180 os.environ['ADB_TRACE'] = 'all'
181 cmd_helper.RunCmd(['adb', 'kill-server'])
182 cmd_helper.RunCmd(['adb', 'start-server'])
183 cmd_helper.RunCmd(['adb', 'root'])
184 i = 1
185 while not android_commands.GetAttachedDevices():
186 time.sleep(i)
187 i *= 2
188 if i > 10:
189 break
177 190
178 191
179 def main(argv): 192 def main(argv):
180 parser = optparse.OptionParser() 193 parser = optparse.OptionParser()
181 parser.add_option('-s', '--steps', 194 parser.add_option('-s', '--steps',
182 help='A JSON file containing all the steps to be ' 195 help='A JSON file containing all the steps to be '
183 'sharded.') 196 'sharded.')
184 parser.add_option('--flaky_steps', 197 parser.add_option('--flaky_steps',
185 help='A JSON file containing steps that are flaky and ' 198 help='A JSON file containing steps that are flaky and '
186 'will have its exit code ignored.') 199 'will have its exit code ignored.')
(...skipping 30 matching lines...) Expand all
217 steps = json.load(f) 230 steps = json.load(f)
218 flaky_steps = [] 231 flaky_steps = []
219 if options.flaky_steps: 232 if options.flaky_steps:
220 with file(options.flaky_steps, 'r') as f: 233 with file(options.flaky_steps, 'r') as f:
221 flaky_steps = json.load(f) 234 flaky_steps = json.load(f)
222 return _RunShardedSteps(steps, flaky_steps, devices) 235 return _RunShardedSteps(steps, flaky_steps, devices)
223 236
224 237
225 if __name__ == '__main__': 238 if __name__ == '__main__':
226 sys.exit(main(sys.argv)) 239 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | third_party/android_testrunner/run_command.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698