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

Unified Diff: build/android/pylib/device/device_utils.py

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/pylib/device/adb_wrapper.py ('k') | build/android/pylib/device/device_utils_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/device/device_utils.py
diff --git a/build/android/pylib/device/device_utils.py b/build/android/pylib/device/device_utils.py
index a1b4117f7b963887e8516526ec0fc878ba5c1c8a..eba5e0203a2d247223b9628284fb96708db924e2 100644
--- a/build/android/pylib/device/device_utils.py
+++ b/build/android/pylib/device/device_utils.py
@@ -412,8 +412,8 @@ class DeviceUtils(object):
@decorators.WithTimeoutAndRetriesFromInstance()
def RunShellCommand(self, cmd, check_return=False, cwd=None, env=None,
- as_root=False, single_line=False,
- timeout=None, retries=None):
+ as_root=False, single_line=False, timeout=None,
+ retries=None):
"""Run an ADB shell command.
The command to run |cmd| should be a sequence of program arguments or else
@@ -847,7 +847,7 @@ class DeviceUtils(object):
self.RunShellCommand(
['unzip', zip_on_device],
as_root=True,
- env={'PATH': '$PATH:%s' % install_commands.BIN_DIR},
+ env={'PATH': '%s:$PATH' % install_commands.BIN_DIR},
check_return=True)
finally:
if zip_proc.is_alive():
@@ -1297,23 +1297,6 @@ class DeviceUtils(object):
return host_path
@decorators.WithTimeoutAndRetriesFromInstance()
- def GetIOStats(self, timeout=None, retries=None):
- """Gets cumulative disk IO stats since boot for all processes.
-
- Args:
- timeout: timeout in seconds
- retries: number of retries
-
- Returns:
- A dict containing |num_reads|, |num_writes|, |read_ms|, and |write_ms|.
-
- Raises:
- CommandTimeoutError on timeout.
- DeviceUnreachableError on missing device.
- """
- return self.old_interface.GetIoStats()
-
- @decorators.WithTimeoutAndRetriesFromInstance()
def GetMemoryUsageForPid(self, pid, timeout=None, retries=None):
"""Gets the memory usage for the given PID.
@@ -1349,6 +1332,41 @@ class DeviceUtils(object):
"""Returns the device serial."""
return self.adb.GetDeviceSerial()
+ @decorators.WithTimeoutAndRetriesFromInstance()
+ def GetDevicePieWrapper(self, timeout=None, retries=None):
+ """Gets the absolute path to the run_pie wrapper on the device.
+
+ We have to build our device executables to be PIE, but they need to be able
+ to run on versions of android that don't support PIE (i.e. ICS and below).
+ To do so, we push a wrapper to the device that lets older android versions
+ run PIE executables. This method pushes that wrapper to the device if
+ necessary and returns the path to it.
+
+ This is exposed publicly to allow clients to write scripts using run_pie
+ (e.g. md5sum.CalculateDeviceMd5Sum).
+
+ Args:
+ timeout: timeout in seconds
+ retries: number of retries
+
+ Returns:
+ The path to the PIE wrapper on the device, or an empty string if the
+ device does not require the wrapper.
+ """
+ if 'run_pie' not in self._cache:
+ pie = ''
+ if (self.build_version_sdk <
+ constants.ANDROID_SDK_VERSION_CODES.JELLY_BEAN):
+ host_pie_path = os.path.join(constants.GetOutDirectory(), 'run_pie')
+ if not os.path.exists(host_pie_path):
+ raise device_errors.CommandFailedError('Please build run_pie')
+ pie = '%s/run_pie' % constants.TEST_EXECUTABLE_DIR
+ self.adb.Push(host_pie_path, pie)
+
+ self._cache['run_pie'] = pie
+
+ return self._cache['run_pie']
+
@classmethod
def parallel(cls, devices=None, async=False):
"""Creates a Parallelizer to operate over the provided list of devices.
« no previous file with comments | « build/android/pylib/device/adb_wrapper.py ('k') | build/android/pylib/device/device_utils_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698