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

Side by Side Diff: build/android/pylib/android_commands.py

Issue 22903016: [android] Adds constants.GetOutDirectory() and converts test scripts to use it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix provision_devices.py which never set the build type Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « build/android/provision_devices.py ('k') | build/android/pylib/base/base_test_runner.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 """Provides an interface to communicate with the device via the adb command. 5 """Provides an interface to communicate with the device via the adb command.
6 6
7 Assumes adb binary is currently on system path. 7 Assumes adb binary is currently on system path.
8 """ 8 """
9 9
10 import collections 10 import collections
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 if device: 240 if device:
241 self._adb.SetTargetSerial(device) 241 self._adb.SetTargetSerial(device)
242 self._device = device 242 self._device = device
243 self._logcat = None 243 self._logcat = None
244 self.logcat_process = None 244 self.logcat_process = None
245 self._logcat_tmpoutfile = None 245 self._logcat_tmpoutfile = None
246 self._pushed_files = [] 246 self._pushed_files = []
247 self._device_utc_offset = None 247 self._device_utc_offset = None
248 self._potential_push_size = 0 248 self._potential_push_size = 0
249 self._actual_push_size = 0 249 self._actual_push_size = 0
250 self._md5sum_build_dir = ''
251 self._external_storage = '' 250 self._external_storage = ''
252 self._util_wrapper = '' 251 self._util_wrapper = ''
253 252
254 def _LogShell(self, cmd): 253 def _LogShell(self, cmd):
255 """Logs the adb shell command.""" 254 """Logs the adb shell command."""
256 if self._device: 255 if self._device:
257 device_repr = self._device[-4:] 256 device_repr = self._device[-4:]
258 else: 257 else:
259 device_repr = '????' 258 device_repr = '????'
260 logging.info('[%s]> %s', device_repr, cmd) 259 logging.info('[%s]> %s', device_repr, cmd)
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 """Gets the md5sum of a host path and device path. 775 """Gets the md5sum of a host path and device path.
777 776
778 Args: 777 Args:
779 host_path: Path (file or directory) on the host. 778 host_path: Path (file or directory) on the host.
780 device_path: Path on the device. 779 device_path: Path on the device.
781 780
782 Returns: 781 Returns:
783 A tuple containing lists of the host and device md5sum results as 782 A tuple containing lists of the host and device md5sum results as
784 created by _ParseMd5SumOutput(). 783 created by _ParseMd5SumOutput().
785 """ 784 """
786 if not self._md5sum_build_dir: 785 md5sum_dist_path = os.path.join(constants.GetOutDirectory(),
787 default_build_type = os.environ.get('BUILD_TYPE', 'Debug') 786 'md5sum_dist')
788 build_dir = '%s/%s/' % ( 787 assert os.path.exists(md5sum_dist_path), 'Please build md5sum.'
789 cmd_helper.OutDirectory().get(), default_build_type) 788 command = 'push %s %s' % (md5sum_dist_path, MD5SUM_DEVICE_FOLDER)
790 md5sum_dist_path = '%s/md5sum_dist' % build_dir 789 assert _HasAdbPushSucceeded(self._adb.SendCommand(command))
791 if not os.path.exists(md5sum_dist_path):
792 build_dir = '%s/Release/' % cmd_helper.OutDirectory().get()
793 md5sum_dist_path = '%s/md5sum_dist' % build_dir
794 assert os.path.exists(md5sum_dist_path), 'Please build md5sum.'
795 command = 'push %s %s' % (md5sum_dist_path, MD5SUM_DEVICE_FOLDER)
796 assert _HasAdbPushSucceeded(self._adb.SendCommand(command))
797 self._md5sum_build_dir = build_dir
798 790
799 cmd = (MD5SUM_LD_LIBRARY_PATH + ' ' + self._util_wrapper + ' ' + 791 cmd = (MD5SUM_LD_LIBRARY_PATH + ' ' + self._util_wrapper + ' ' +
800 MD5SUM_DEVICE_PATH + ' ' + device_path) 792 MD5SUM_DEVICE_PATH + ' ' + device_path)
801 device_hash_tuples = _ParseMd5SumOutput( 793 device_hash_tuples = _ParseMd5SumOutput(
802 self.RunShellCommand(cmd, timeout_time=2 * 60)) 794 self.RunShellCommand(cmd, timeout_time=2 * 60))
803 assert os.path.exists(host_path), 'Local path not found %s' % host_path 795 assert os.path.exists(host_path), 'Local path not found %s' % host_path
804 md5sum_output = cmd_helper.GetCmdOutput( 796 md5sum_output = cmd_helper.GetCmdOutput(
805 ['%s/md5sum_bin_host' % self._md5sum_build_dir, host_path]) 797 [os.path.join(constants.GetOutDirectory(), 'md5sum_bin_host'),
798 host_path])
806 host_hash_tuples = _ParseMd5SumOutput(md5sum_output.splitlines()) 799 host_hash_tuples = _ParseMd5SumOutput(md5sum_output.splitlines())
807 return (host_hash_tuples, device_hash_tuples) 800 return (host_hash_tuples, device_hash_tuples)
808 801
809 def GetFilesChanged(self, host_path, device_path, ignore_filenames=False): 802 def GetFilesChanged(self, host_path, device_path, ignore_filenames=False):
810 """Compares the md5sum of a host path against a device path. 803 """Compares the md5sum of a host path against a device path.
811 804
812 Note: Ignores extra files on the device. 805 Note: Ignores extra files on the device.
813 806
814 Args: 807 Args:
815 host_path: Path (file or directory) on the host. 808 host_path: Path (file or directory) on the host.
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
1552 """ 1545 """
1553 def __init__(self, output): 1546 def __init__(self, output):
1554 self._output = output 1547 self._output = output
1555 1548
1556 def write(self, data): 1549 def write(self, data):
1557 data = data.replace('\r\r\n', '\n') 1550 data = data.replace('\r\r\n', '\n')
1558 self._output.write(data) 1551 self._output.write(data)
1559 1552
1560 def flush(self): 1553 def flush(self):
1561 self._output.flush() 1554 self._output.flush()
OLDNEW
« no previous file with comments | « build/android/provision_devices.py ('k') | build/android/pylib/base/base_test_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698