| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import json | 6 import json |
| 7 import multiprocessing | 7 import multiprocessing |
| 8 import os | 8 import os |
| 9 import platform | 9 import platform |
| 10 import subprocess | 10 import subprocess |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 """Parses the device info for each attached device, and returns a summary | 50 """Parses the device info for each attached device, and returns a summary |
| 51 of the device info and any mismatches. | 51 of the device info and any mismatches. |
| 52 | 52 |
| 53 Returns: | 53 Returns: |
| 54 A dict indicating the result. | 54 A dict indicating the result. |
| 55 """ | 55 """ |
| 56 if not is_linux(): | 56 if not is_linux(): |
| 57 return {} | 57 return {} |
| 58 | 58 |
| 59 with common.temporary_file() as tempfile_path: | 59 with common.temporary_file() as tempfile_path: |
| 60 rc = common.run_command([ | 60 test_cmd = [ |
| 61 sys.executable, | 61 sys.executable, |
| 62 os.path.join(args.paths['checkout'], | 62 os.path.join(args.paths['checkout'], |
| 63 'third_party', | 63 'third_party', |
| 64 'catapult', | 64 'catapult', |
| 65 'devil', | 65 'devil', |
| 66 'devil', | 66 'devil', |
| 67 'android', | 67 'android', |
| 68 'tools', | 68 'tools', |
| 69 'device_status.py'), | 69 'device_status.py'), |
| 70 '--json-output', tempfile_path, | 70 '--json-output', tempfile_path, |
| 71 '--blacklist-file', os.path.join( | 71 '--blacklist-file', os.path.join( |
| 72 args.paths['checkout'], 'out', 'bad_devices.json')]) | 72 args.paths['checkout'], 'out', 'bad_devices.json') |
| 73 ] |
| 74 if args.args: |
| 75 test_cmd.extend(args.args) |
| 73 | 76 |
| 77 rc = common.run_command(test_cmd) |
| 74 if rc: | 78 if rc: |
| 75 failures.append('device_status') | 79 failures.append('device_status') |
| 76 return {} | 80 return {} |
| 77 | 81 |
| 78 with open(tempfile_path, 'r') as src: | 82 with open(tempfile_path, 'r') as src: |
| 79 device_info = json.load(src) | 83 device_info = json.load(src) |
| 80 | 84 |
| 81 results = {} | 85 results = {} |
| 82 results['devices'] = sorted(v['serial'] for v in device_info) | 86 results['devices'] = sorted(v['serial'] for v in device_info) |
| 83 | 87 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 def main_compile_targets(args): | 141 def main_compile_targets(args): |
| 138 json.dump([], args.output) | 142 json.dump([], args.output) |
| 139 | 143 |
| 140 | 144 |
| 141 if __name__ == '__main__': | 145 if __name__ == '__main__': |
| 142 funcs = { | 146 funcs = { |
| 143 'run': main_run, | 147 'run': main_run, |
| 144 'compile_targets': main_compile_targets, | 148 'compile_targets': main_compile_targets, |
| 145 } | 149 } |
| 146 sys.exit(common.run_script(sys.argv[1:], funcs)) | 150 sys.exit(common.run_script(sys.argv[1:], funcs)) |
| OLD | NEW |