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

Side by Side Diff: testing/scripts/host_info.py

Issue 2106063006: [Android] Make host_info.py use device_status.py instead of bb_device_status_check.py (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ~ Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | 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 # 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
11 import sys 11 import sys
12 12
13 import common
13 14
14 import common 15
16 INFRA_EXIT_CODE = 87
Paweł Hajdan Jr. 2016/07/04 10:38:08 Can we move that to testing/scripts/common? I'd al
rnephew (Reviews Here) 2016/07/06 15:37:09 Done.
15 17
16 18
17 def is_linux(): 19 def is_linux():
18 return sys.platform.startswith('linux') 20 return sys.platform.startswith('linux')
19 21
20 22
21 def get_free_disk_space(failures): 23 def get_free_disk_space(failures):
22 """Returns the amount of free space on the current disk, in GiB. 24 """Returns the amount of free space on the current disk, in GiB.
23 25
24 Returns: 26 Returns:
(...skipping 29 matching lines...) Expand all
54 Returns: 56 Returns:
55 A dict indicating the result. 57 A dict indicating the result.
56 """ 58 """
57 if not is_linux(): 59 if not is_linux():
58 return {} 60 return {}
59 61
60 with common.temporary_file() as tempfile_path: 62 with common.temporary_file() as tempfile_path:
61 rc = common.run_command([ 63 rc = common.run_command([
62 sys.executable, 64 sys.executable,
63 os.path.join(args.paths['checkout'], 65 os.path.join(args.paths['checkout'],
64 'build', 66 'third_party',
67 'catapult',
68 'devil',
69 'devil',
65 'android', 70 'android',
66 'buildbot', 71 'tools',
67 'bb_device_status_check.py'), 72 'device_status.py'),
68 '--json-output', tempfile_path, 73 '--json-output', tempfile_path,
69 '--blacklist-file', os.path.join( 74 '--blacklist-file', os.path.join(
70 args.paths['checkout'], 'out', 'bad_devices.json')]) 75 args.paths['checkout'], 'out', 'bad_devices.json')])
71 76
72 if rc: 77 if rc:
73 failures.append('bb_device_status_check') 78 failures.append('device_status')
74 return {} 79 return {}
75 80
76 with open(tempfile_path, 'r') as src: 81 with open(tempfile_path, 'r') as src:
77 device_info = json.load(src) 82 device_info = json.load(src)
78 83
79 results = {} 84 results = {}
80 results['devices'] = sorted(v['serial'] for v in device_info) 85 results['devices'] = sorted(v['serial'] for v in device_info)
81 86
82 details = [v['build_detail'] for v in device_info if not v['blacklisted']] 87 details = [
88 v['ro.build.fingerprint'] for v in device_info if not v['blacklisted']]
83 89
84 def unique_build_details(index): 90 def unique_build_details(index):
85 return sorted(list(set([v.split(':')[index] for v in details]))) 91 return sorted(list(set([v.split(':')[index] for v in details])))
86 92
87 parsed_details = { 93 parsed_details = {
88 'device_names': unique_build_details(0), 94 'device_names': unique_build_details(0),
89 'build_versions': unique_build_details(1), 95 'build_versions': unique_build_details(1),
90 'build_types': unique_build_details(2), 96 'build_types': unique_build_details(2),
91 } 97 }
92 98
(...skipping 26 matching lines...) Expand all
119 host_info['python_path'] = sys.executable 125 host_info['python_path'] = sys.executable
120 126
121 host_info['devices'] = get_device_info(args, failures) 127 host_info['devices'] = get_device_info(args, failures)
122 128
123 json.dump({ 129 json.dump({
124 'valid': True, 130 'valid': True,
125 'failures': failures, 131 'failures': failures,
126 '_host_info': host_info, 132 '_host_info': host_info,
127 }, args.output) 133 }, args.output)
128 134
129 return len(failures) != 0 135 if len(failures) != 0:
136 return INFRA_EXIT_CODE
137 return 0
130 138
131 139
132 def main_compile_targets(args): 140 def main_compile_targets(args):
133 json.dump([], args.output) 141 json.dump([], args.output)
134 142
135 143
136 if __name__ == '__main__': 144 if __name__ == '__main__':
137 funcs = { 145 funcs = {
138 'run': main_run, 146 'run': main_run,
139 'compile_targets': main_compile_targets, 147 'compile_targets': main_compile_targets,
140 } 148 }
141 sys.exit(common.run_script(sys.argv[1:], funcs)) 149 sys.exit(common.run_script(sys.argv[1:], funcs))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698