diff options
author | jbudorick <jbudorick@chromium.org> | 2015-08-13 12:33:54 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-13 19:34:26 +0000 |
commit | cd661e4ff1097b6916891a99ec9654e39e265fba (patch) | |
tree | 7c633b9f88c9fa528635bf61b1bc75b72cfad026 /tools/cygprofile | |
parent | 89c98ebd4b2c5b2fefb8560d18a3386604f85a1a (diff) | |
download | chromium_src-cd661e4ff1097b6916891a99ec9654e39e265fba.zip chromium_src-cd661e4ff1097b6916891a99ec9654e39e265fba.tar.gz chromium_src-cd661e4ff1097b6916891a99ec9654e39e265fba.tar.bz2 |
[Android] Reland of Remove android_commands and android_testrunner.
Original CL: https://codereview.chromium.org/1290773009/
Revert: https://codereview.chromium.org/1288993002/
BUG=267773
TBR=thakis@chromium.org,maruel@chromium.org
Review URL: https://codereview.chromium.org/1290173003
Cr-Commit-Position: refs/heads/master@{#343257}
Diffstat (limited to 'tools/cygprofile')
-rw-r--r-- | tools/cygprofile/profile_android_startup.py | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/tools/cygprofile/profile_android_startup.py b/tools/cygprofile/profile_android_startup.py index 9e49bef..29fad74 100644 --- a/tools/cygprofile/profile_android_startup.py +++ b/tools/cygprofile/profile_android_startup.py @@ -218,12 +218,15 @@ class AndroidProfileTool(object): The exit code for the tests. """ device_path = '/data/local/tmp/cygprofile_unittests' - self._device.old_interface.PushIfNeeded( - self._cygprofile_tests, device_path) - (exit_code, _) = ( - self._device.old_interface.GetShellCommandStatusAndOutput( - command=device_path, log_result=True)) - return exit_code + self._device.PushChangedFiles([(self._cygprofile_tests, device_path)]) + try: + self._device.RunShellCommand(device_path, check_return=True) + except device_errors.CommandFailedError: + # TODO(jbudorick): Let the exception propagate up once clients can + # handle it. + logging.exception('Failure while running cygprofile_unittests:') + return 1 + return 0 def CollectProfile(self, apk, package_info): """Run a profile and collect the log files. @@ -237,8 +240,7 @@ class AndroidProfileTool(object): Raises: NoCyglogDataError: No data was found on the device. """ - self._Install(apk, package_info) - + self._Install(apk) try: changer = self._SetChromeFlags(package_info) self._SetUpDeviceFolders() @@ -266,7 +268,7 @@ class AndroidProfileTool(object): self._DeleteDeviceData() self._DeleteHostData() - def _Install(self, apk, package_info): + def _Install(self, apk): """Installs Chrome.apk on the device. Args: apk: The location of the chrome apk to profile. @@ -274,7 +276,7 @@ class AndroidProfileTool(object): as from pylib/constants. """ print 'Installing apk...' - self._device.old_interface.ManagedInstall(apk, package_info.package) + self._device.Install(apk) def _SetUpDevice(self): """When profiling, files are output to the disk by every process. This @@ -287,7 +289,7 @@ class AndroidProfileTool(object): # SELinux need to be in permissive mode, otherwise the process cannot # write the log files. print 'Putting SELinux in permissive mode...' - self._device.old_interface.RunShellCommand('setenforce 0') + self._device.RunShellCommand(['setenforce' '0'], check_return=True) except device_errors.CommandFailedError as e: # TODO(jbudorick) Handle this exception appropriately once interface # conversions are finished. @@ -309,13 +311,15 @@ class AndroidProfileTool(object): """Creates folders on the device to store cyglog data. """ print 'Setting up device folders...' self._DeleteDeviceData() - self._device.old_interface.RunShellCommand( - 'mkdir -p %s' % self._DEVICE_CYGLOG_DIR) + self._device.RunShellCommand( + ['mkdir', '-p', str(self._DEVICE_CYGLOG_DIR)], + check_return=True) def _DeleteDeviceData(self): """Clears out cyglog storage locations on the device. """ - self._device.old_interface.RunShellCommand( - 'rm -rf %s' % self._DEVICE_CYGLOG_DIR) + self._device.RunShellCommand( + ['rm', '-rf', str(self._DEVICE_CYGLOG_DIR)], + check_return=True) def _StartChrome(self, package_info, url): print 'Launching chrome...' @@ -347,7 +351,7 @@ class AndroidProfileTool(object): """ print 'Pulling cyglog data...' self._SetUpHostFolders() - self._device.old_interface.Adb().Pull( + self._device.PullFile( self._DEVICE_CYGLOG_DIR, self._host_cyglog_dir) files = os.listdir(self._host_cyglog_dir) |