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

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

Issue 15979032: Android: renames pylib.constants.CHROME_DIR to DIR_SOURCE_ROOT. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 #!/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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 import signal 54 import signal
55 import shutil 55 import shutil
56 import sys 56 import sys
57 57
58 from pylib import android_commands 58 from pylib import android_commands
59 from pylib import cmd_helper 59 from pylib import cmd_helper
60 from pylib import constants 60 from pylib import constants
61 from pylib import ports 61 from pylib import ports
62 62
63 63
64 _OUTPUT_DIR = os.path.join(constants.CHROME_DIR, 'out', 'step_results') 64 _OUTPUT_DIR = os.path.join(constants.DIR_SOURCE_ROOT, 'out', 'step_results')
65 65
66 66
67 def _SaveResult(result): 67 def _SaveResult(result):
68 with file(os.path.join(_OUTPUT_DIR, result['name']), 'w') as f: 68 with file(os.path.join(_OUTPUT_DIR, result['name']), 'w') as f:
69 f.write(pickle.dumps(result)) 69 f.write(pickle.dumps(result))
70 70
71 71
72 def _RunStepsPerDevice(steps): 72 def _RunStepsPerDevice(steps):
73 results = [] 73 results = []
74 for step in steps: 74 for step in steps:
75 start_time = datetime.datetime.now() 75 start_time = datetime.datetime.now()
76 print 'Starting %s: %s %s at %s' % (step['name'], step['cmd'], 76 print 'Starting %s: %s %s at %s' % (step['name'], step['cmd'],
77 start_time, step['device']) 77 start_time, step['device'])
78 output, exit_code = pexpect.run( 78 output, exit_code = pexpect.run(
79 step['cmd'], cwd=os.path.abspath(constants.CHROME_DIR), 79 step['cmd'], cwd=os.path.abspath(constants.DIR_SOURCE_ROOT),
80 withexitstatus=True, logfile=sys.stdout, timeout=1800, 80 withexitstatus=True, logfile=sys.stdout, timeout=1800,
81 env=os.environ) 81 env=os.environ)
82 exit_code = exit_code or 0 82 exit_code = exit_code or 0
83 end_time = datetime.datetime.now() 83 end_time = datetime.datetime.now()
84 exit_msg = '%s %s' % (exit_code, 84 exit_msg = '%s %s' % (exit_code,
85 '(ignored, flaky step)' if step['is_flaky'] else '') 85 '(ignored, flaky step)' if step['is_flaky'] else '')
86 print 'Finished %s: %s %s %s at %s' % (step['name'], exit_msg, step['cmd'], 86 print 'Finished %s: %s %s %s at %s' % (step['name'], exit_msg, step['cmd'],
87 end_time, step['device']) 87 end_time, step['device'])
88 if step['is_flaky']: 88 if step['is_flaky']:
89 exit_code = 0 89 exit_code = 0
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 steps = json.load(f) 200 steps = json.load(f)
201 flaky_steps = [] 201 flaky_steps = []
202 if options.flaky_steps: 202 if options.flaky_steps:
203 with file(options.flaky_steps, 'r') as f: 203 with file(options.flaky_steps, 'r') as f:
204 flaky_steps = json.load(f) 204 flaky_steps = json.load(f)
205 return _RunShardedSteps(steps, flaky_steps, devices) 205 return _RunShardedSteps(steps, flaky_steps, devices)
206 206
207 207
208 if __name__ == '__main__': 208 if __name__ == '__main__':
209 sys.exit(main(sys.argv)) 209 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | build/android/buildbot/bb_device_steps.py » ('j') | build/android/pylib/constants.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698