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

Side by Side Diff: build/android/pylib/instrumentation/test_runner.py

Issue 806843002: Reland of Migrate DeviceUtils.ReadFile to adb_wrapper (try 3) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: enable command line test only for android Created 5 years, 10 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 | « build/android/pylib/flag_changer.py ('k') | build/android/pylib/perf/thermal_throttle.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 """Class for running instrumentation tests on a single device.""" 5 """Class for running instrumentation tests on a single device."""
6 6
7 import logging 7 import logging
8 import os 8 import os
9 import re 9 import re
10 import sys 10 import sys
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 # us so we know to ignore the results. 230 # us so we know to ignore the results.
231 # The --NORUN-- tag is managed by MainActivityTestBase.java 231 # The --NORUN-- tag is managed by MainActivityTestBase.java
232 if regex.group(1) != '--NORUN--': 232 if regex.group(1) != '--NORUN--':
233 233
234 # Obtain the relevant perf data. The data is dumped to a 234 # Obtain the relevant perf data. The data is dumped to a
235 # JSON formatted file. 235 # JSON formatted file.
236 json_string = self.device.ReadFile( 236 json_string = self.device.ReadFile(
237 '/data/data/com.google.android.apps.chrome/files/PerfTestData.txt', 237 '/data/data/com.google.android.apps.chrome/files/PerfTestData.txt',
238 as_root=True) 238 as_root=True)
239 239
240 if json_string: 240 if not json_string:
241 json_string = '\n'.join(json_string) 241 raise Exception('Perf file is empty')
242 else:
243 raise Exception('Perf file does not exist or is empty')
244 242
245 if self.options.save_perf_json: 243 if self.options.save_perf_json:
246 json_local_file = '/tmp/chromium-android-perf-json-' + raw_test_name 244 json_local_file = '/tmp/chromium-android-perf-json-' + raw_test_name
247 with open(json_local_file, 'w') as f: 245 with open(json_local_file, 'w') as f:
248 f.write(json_string) 246 f.write(json_string)
249 logging.info('Saving Perf UI JSON from test ' + 247 logging.info('Saving Perf UI JSON from test ' +
250 test + ' to ' + json_local_file) 248 test + ' to ' + json_local_file)
251 249
252 raw_perf_data = regex.group(1).split(';') 250 raw_perf_data = regex.group(1).split(';')
253 251
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 except device_errors.CommandTimeoutError as e: 354 except device_errors.CommandTimeoutError as e:
357 results.AddResult(test_result.InstrumentationTestResult( 355 results.AddResult(test_result.InstrumentationTestResult(
358 test, base_test_result.ResultType.TIMEOUT, start_ms, duration_ms, 356 test, base_test_result.ResultType.TIMEOUT, start_ms, duration_ms,
359 log=str(e) or 'No information')) 357 log=str(e) or 'No information'))
360 except device_errors.DeviceUnreachableError as e: 358 except device_errors.DeviceUnreachableError as e:
361 results.AddResult(test_result.InstrumentationTestResult( 359 results.AddResult(test_result.InstrumentationTestResult(
362 test, base_test_result.ResultType.CRASH, start_ms, duration_ms, 360 test, base_test_result.ResultType.CRASH, start_ms, duration_ms,
363 log=str(e) or 'No information')) 361 log=str(e) or 'No information'))
364 self.TestTeardown(test, results) 362 self.TestTeardown(test, results)
365 return (results, None if results.DidRunPass() else test) 363 return (results, None if results.DidRunPass() else test)
OLDNEW
« no previous file with comments | « build/android/pylib/flag_changer.py ('k') | build/android/pylib/perf/thermal_throttle.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698