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

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: move constant to common 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 | « testing/scripts/common.py ('k') | 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
14 import common 13 import common
15 14
16 15
17 def is_linux(): 16 def is_linux():
18 return sys.platform.startswith('linux') 17 return sys.platform.startswith('linux')
19 18
20 19
21 def get_free_disk_space(failures): 20 def get_free_disk_space(failures):
22 """Returns the amount of free space on the current disk, in GiB. 21 """Returns the amount of free space on the current disk, in GiB.
23 22
(...skipping 30 matching lines...) Expand all
54 Returns: 53 Returns:
55 A dict indicating the result. 54 A dict indicating the result.
56 """ 55 """
57 if not is_linux(): 56 if not is_linux():
58 return {} 57 return {}
59 58
60 with common.temporary_file() as tempfile_path: 59 with common.temporary_file() as tempfile_path:
61 rc = common.run_command([ 60 rc = common.run_command([
62 sys.executable, 61 sys.executable,
63 os.path.join(args.paths['checkout'], 62 os.path.join(args.paths['checkout'],
64 'build', 63 'third_party',
64 'catapult',
65 'devil',
66 'devil',
65 'android', 67 'android',
66 'buildbot', 68 'tools',
67 'bb_device_status_check.py'), 69 'device_status.py'),
68 '--json-output', tempfile_path, 70 '--json-output', tempfile_path,
69 '--blacklist-file', os.path.join( 71 '--blacklist-file', os.path.join(
70 args.paths['checkout'], 'out', 'bad_devices.json')]) 72 args.paths['checkout'], 'out', 'bad_devices.json')])
71 73
72 if rc: 74 if rc:
73 failures.append('bb_device_status_check') 75 failures.append('device_status')
74 return {} 76 return {}
75 77
76 with open(tempfile_path, 'r') as src: 78 with open(tempfile_path, 'r') as src:
77 device_info = json.load(src) 79 device_info = json.load(src)
78 80
79 results = {} 81 results = {}
80 results['devices'] = sorted(v['serial'] for v in device_info) 82 results['devices'] = sorted(v['serial'] for v in device_info)
81 83
82 details = [v['build_detail'] for v in device_info if not v['blacklisted']] 84 details = [
85 v['ro.build.fingerprint'] for v in device_info if not v['blacklisted']]
83 86
84 def unique_build_details(index): 87 def unique_build_details(index):
85 return sorted(list(set([v.split(':')[index] for v in details]))) 88 return sorted(list(set([v.split(':')[index] for v in details])))
86 89
87 parsed_details = { 90 parsed_details = {
88 'device_names': unique_build_details(0), 91 'device_names': unique_build_details(0),
89 'build_versions': unique_build_details(1), 92 'build_versions': unique_build_details(1),
90 'build_types': unique_build_details(2), 93 'build_types': unique_build_details(2),
91 } 94 }
92 95
(...skipping 26 matching lines...) Expand all
119 host_info['python_path'] = sys.executable 122 host_info['python_path'] = sys.executable
120 123
121 host_info['devices'] = get_device_info(args, failures) 124 host_info['devices'] = get_device_info(args, failures)
122 125
123 json.dump({ 126 json.dump({
124 'valid': True, 127 'valid': True,
125 'failures': failures, 128 'failures': failures,
126 '_host_info': host_info, 129 '_host_info': host_info,
127 }, args.output) 130 }, args.output)
128 131
129 return len(failures) != 0 132 if len(failures) != 0:
133 return common.INFRA_FAILURE_EXIT_CODE
134 return 0
130 135
131 136
132 def main_compile_targets(args): 137 def main_compile_targets(args):
133 json.dump([], args.output) 138 json.dump([], args.output)
134 139
135 140
136 if __name__ == '__main__': 141 if __name__ == '__main__':
137 funcs = { 142 funcs = {
138 'run': main_run, 143 'run': main_run,
139 'compile_targets': main_compile_targets, 144 'compile_targets': main_compile_targets,
140 } 145 }
141 sys.exit(common.run_script(sys.argv[1:], funcs)) 146 sys.exit(common.run_script(sys.argv[1:], funcs))
OLDNEW
« no previous file with comments | « testing/scripts/common.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698