OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import contextlib | 5 import contextlib |
6 import datetime | 6 import datetime |
7 import json | 7 import json |
8 import os | 8 import os |
| 9 import pipes |
9 import re | 10 import re |
10 import sys | 11 import sys |
11 import urllib | 12 import urllib |
12 | 13 |
13 from recipe_engine.types import freeze | 14 from recipe_engine.types import freeze |
14 from recipe_engine import recipe_api | 15 from recipe_engine import recipe_api |
15 | 16 |
16 def _TimestampToIsoFormat(timestamp): | 17 def _TimestampToIsoFormat(timestamp): |
17 return datetime.datetime.utcfromtimestamp(timestamp).strftime('%Y%m%dT%H%M%S') | 18 return datetime.datetime.utcfromtimestamp(timestamp).strftime('%Y%m%dT%H%M%S') |
18 | 19 |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 stdout = self.m.raw_io.output(), | 186 stdout = self.m.raw_io.output(), |
186 step_test_data=( | 187 step_test_data=( |
187 lambda: | 188 lambda: |
188 self.m.raw_io.test_api.stream_output('3000\n') | 189 self.m.raw_io.test_api.stream_output('3000\n') |
189 ), | 190 ), |
190 cwd=self.m.path['checkout'], | 191 cwd=self.m.path['checkout'], |
191 infra_step=True, | 192 infra_step=True, |
192 **kwargs) | 193 **kwargs) |
193 | 194 |
194 def java_method_count(self, dexfile, name='java_method_count', perf_id=None): | 195 def java_method_count(self, dexfile, name='java_method_count', perf_id=None): |
195 self.m.chromium.runtest( | 196 # TODO(agrieve): Remove once usages are elimintated. |
196 self.m.path['checkout'].join('build', 'android', 'method_count.py'), | 197 self.resource_sizes(dexfile, perf_id=perf_id) # pragma: no cover |
197 args=[dexfile], | 198 |
198 annotate='graphing', | 199 def resource_sizes(self, apk_path, chartjson_file=False, |
199 results_url='https://chromeperf.appspot.com', | 200 upload_archives_to_bucket=None, perf_id=None): |
| 201 cmd = ['build/android/resource_sizes.py', str(apk_path)] |
| 202 if chartjson_file: |
| 203 cmd.append('--chartjson') |
| 204 |
| 205 config = { |
| 206 'steps': { |
| 207 'resource_sizes': { |
| 208 'cmd': ' '.join(pipes.quote(x) for x in cmd), |
| 209 'device_affinity': None, |
| 210 'archive_output_dir': True |
| 211 } |
| 212 }, |
| 213 'version': 1 |
| 214 } |
| 215 self.run_sharded_perf_tests( |
| 216 config=self.m.json.input(config), |
| 217 flaky_config=None, |
200 perf_id=perf_id or self.m.properties['buildername'], | 218 perf_id=perf_id or self.m.properties['buildername'], |
201 perf_dashboard_id=name, | 219 chartjson_file=chartjson_file, |
202 test_type=name) | 220 upload_archives_to_bucket=upload_archives_to_bucket) |
203 | |
204 def resource_sizes(self, apk_path, so_path=None, so_with_symbols_path=None, | |
205 chartjson_file=False): | |
206 args=[apk_path, '--build_type', self.m.chromium.c.BUILD_CONFIG] | |
207 if chartjson_file: | |
208 args.extend(['--chartjson']) | |
209 if so_path: | |
210 args.extend(['--so-path', so_path]) | |
211 if so_with_symbols_path: | |
212 args.extend(['--so-with-symbols-path', so_with_symbols_path]) | |
213 | |
214 self.m.chromium.runtest( | |
215 self.m.path['checkout'].join('build', 'android', 'resource_sizes.py'), | |
216 args=args, | |
217 annotate='graphing', | |
218 results_url='https://chromeperf.appspot.com', | |
219 perf_id=self.m.properties['buildername'], | |
220 perf_dashboard_id='resource_sizes', | |
221 test_type='resource_sizes', | |
222 env={'CHROMIUM_OUTPUT_DIR': self.m.chromium.output_dir}, | |
223 chartjson_file=chartjson_file) | |
224 | 221 |
225 def check_webview_licenses(self, name='check licenses'): | 222 def check_webview_licenses(self, name='check licenses'): |
226 self.m.python( | 223 self.m.python( |
227 name, | 224 name, |
228 self.m.path['checkout'].join('android_webview', | 225 self.m.path['checkout'].join('android_webview', |
229 'tools', | 226 'tools', |
230 'webview_licenses.py'), | 227 'webview_licenses.py'), |
231 args=['scan'], | 228 args=['scan'], |
232 cwd=self.m.path['checkout']) | 229 cwd=self.m.path['checkout']) |
233 | 230 |
(...skipping 1261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1495 script = self.c.test_runner | 1492 script = self.c.test_runner |
1496 if wrapper_script_suite_name: | 1493 if wrapper_script_suite_name: |
1497 script = self.m.chromium.output_dir.join('bin', 'run_%s' % | 1494 script = self.m.chromium.output_dir.join('bin', 'run_%s' % |
1498 wrapper_script_suite_name) | 1495 wrapper_script_suite_name) |
1499 else: | 1496 else: |
1500 env = kwargs.get('env', {}) | 1497 env = kwargs.get('env', {}) |
1501 env['CHROMIUM_OUTPUT_DIR'] = env.get('CHROMIUM_OUTPUT_DIR', | 1498 env['CHROMIUM_OUTPUT_DIR'] = env.get('CHROMIUM_OUTPUT_DIR', |
1502 self.m.chromium.output_dir) | 1499 self.m.chromium.output_dir) |
1503 kwargs['env'] = env | 1500 kwargs['env'] = env |
1504 return self.m.python(step_name, script, args, **kwargs) | 1501 return self.m.python(step_name, script, args, **kwargs) |
OLD | NEW |