| OLD | NEW |
| 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 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 cmd_helper.OutDirectory().get(), default_build_type) | 718 cmd_helper.OutDirectory().get(), default_build_type) |
| 719 md5sum_dist_path = '%s/md5sum_dist' % build_dir | 719 md5sum_dist_path = '%s/md5sum_dist' % build_dir |
| 720 if not os.path.exists(md5sum_dist_path): | 720 if not os.path.exists(md5sum_dist_path): |
| 721 build_dir = '%s/Release/' % cmd_helper.OutDirectory().get() | 721 build_dir = '%s/Release/' % cmd_helper.OutDirectory().get() |
| 722 md5sum_dist_path = '%s/md5sum_dist' % build_dir | 722 md5sum_dist_path = '%s/md5sum_dist' % build_dir |
| 723 assert os.path.exists(md5sum_dist_path), 'Please build md5sum.' | 723 assert os.path.exists(md5sum_dist_path), 'Please build md5sum.' |
| 724 command = 'push %s %s' % (md5sum_dist_path, MD5SUM_DEVICE_FOLDER) | 724 command = 'push %s %s' % (md5sum_dist_path, MD5SUM_DEVICE_FOLDER) |
| 725 assert _HasAdbPushSucceeded(self._adb.SendCommand(command)) | 725 assert _HasAdbPushSucceeded(self._adb.SendCommand(command)) |
| 726 self._md5sum_build_dir = build_dir | 726 self._md5sum_build_dir = build_dir |
| 727 | 727 |
| 728 cmd = (MD5SUM_LD_LIBRARY_PATH + ' ' + self._util_wrapper + ' ' + |
| 729 MD5SUM_DEVICE_PATH + ' ' + device_path) |
| 728 hashes_on_device = _ComputeFileListHash( | 730 hashes_on_device = _ComputeFileListHash( |
| 729 self.RunShellCommand(MD5SUM_LD_LIBRARY_PATH + ' ' + self._util_wrapper + | 731 self.RunShellCommand(cmd, timeout_time=2 * 60)) |
| 730 ' ' + MD5SUM_DEVICE_PATH + ' ' + device_path)) | |
| 731 assert os.path.exists(local_path), 'Local path not found %s' % local_path | 732 assert os.path.exists(local_path), 'Local path not found %s' % local_path |
| 732 md5sum_output = cmd_helper.GetCmdOutput( | 733 md5sum_output = cmd_helper.GetCmdOutput( |
| 733 ['%s/md5sum_bin_host' % self._md5sum_build_dir, local_path]) | 734 ['%s/md5sum_bin_host' % self._md5sum_build_dir, local_path]) |
| 734 hashes_on_host = _ComputeFileListHash(md5sum_output.splitlines()) | 735 hashes_on_host = _ComputeFileListHash(md5sum_output.splitlines()) |
| 735 | 736 |
| 736 if ignore_paths: | 737 if ignore_paths: |
| 737 hashes_on_device = [h.split()[0] for h in hashes_on_device] | 738 hashes_on_device = [h.split()[0] for h in hashes_on_device] |
| 738 hashes_on_host = [h.split()[0] for h in hashes_on_host] | 739 hashes_on_host = [h.split()[0] for h in hashes_on_host] |
| 739 | 740 |
| 740 return hashes_on_device == hashes_on_host | 741 return hashes_on_device == hashes_on_host |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1367 """ | 1368 """ |
| 1368 def __init__(self, output): | 1369 def __init__(self, output): |
| 1369 self._output = output | 1370 self._output = output |
| 1370 | 1371 |
| 1371 def write(self, data): | 1372 def write(self, data): |
| 1372 data = data.replace('\r\r\n', '\n') | 1373 data = data.replace('\r\r\n', '\n') |
| 1373 self._output.write(data) | 1374 self._output.write(data) |
| 1374 | 1375 |
| 1375 def flush(self): | 1376 def flush(self): |
| 1376 self._output.flush() | 1377 self._output.flush() |
| OLD | NEW |