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

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

Issue 669573003: Reland of 'New run shell implementation for DeviceUtils' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pass timeout option to adb.Shell Created 6 years, 2 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
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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 351
352 Returns: 352 Returns:
353 The raw output of am instrument as a list of lines. 353 The raw output of am instrument as a list of lines.
354 """ 354 """
355 # Build the 'am instrument' command 355 # Build the 'am instrument' command
356 instrumentation_path = ( 356 instrumentation_path = (
357 '%s/%s' % (self.test_pkg.GetPackageName(), self.options.test_runner)) 357 '%s/%s' % (self.test_pkg.GetPackageName(), self.options.test_runner))
358 358
359 cmd = ['am', 'instrument', '-r'] 359 cmd = ['am', 'instrument', '-r']
360 for k, v in self._GetInstrumentationArgs().iteritems(): 360 for k, v in self._GetInstrumentationArgs().iteritems():
361 cmd.extend(['-e', k, "'%s'" % v]) 361 cmd.extend(['-e', k, v])
362 cmd.extend(['-e', 'class', "'%s'" % test]) 362 cmd.extend(['-e', 'class', test])
363 cmd.extend(['-w', instrumentation_path]) 363 cmd.extend(['-w', instrumentation_path])
364 return self.device.RunShellCommand(cmd, timeout=timeout, retries=0) 364 return self.device.RunShellCommand(cmd, timeout=timeout, retries=0)
365 365
366 @staticmethod 366 @staticmethod
367 def _ParseAmInstrumentRawOutput(raw_output): 367 def _ParseAmInstrumentRawOutput(raw_output):
368 """Parses the output of an |am instrument -r| call. 368 """Parses the output of an |am instrument -r| call.
369 369
370 Args: 370 Args:
371 raw_output: the output of an |am instrument -r| call as a list of lines 371 raw_output: the output of an |am instrument -r| call as a list of lines
372 Returns: 372 Returns:
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 except device_errors.CommandTimeoutError as e: 505 except device_errors.CommandTimeoutError as e:
506 results.AddResult(test_result.InstrumentationTestResult( 506 results.AddResult(test_result.InstrumentationTestResult(
507 test, base_test_result.ResultType.TIMEOUT, start_ms, duration_ms, 507 test, base_test_result.ResultType.TIMEOUT, start_ms, duration_ms,
508 log=str(e) or 'No information')) 508 log=str(e) or 'No information'))
509 except device_errors.DeviceUnreachableError as e: 509 except device_errors.DeviceUnreachableError as e:
510 results.AddResult(test_result.InstrumentationTestResult( 510 results.AddResult(test_result.InstrumentationTestResult(
511 test, base_test_result.ResultType.CRASH, start_ms, duration_ms, 511 test, base_test_result.ResultType.CRASH, start_ms, duration_ms,
512 log=str(e) or 'No information')) 512 log=str(e) or 'No information'))
513 self.TestTeardown(test, results) 513 self.TestTeardown(test, results)
514 return (results, None if results.DidRunPass() else test) 514 return (results, None if results.DidRunPass() else test)
OLDNEW
« no previous file with comments | « build/android/pylib/device/device_utils_test.py ('k') | build/android/pylib/instrumentation/test_runner_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698