| Index: tools/cygprofile/profile_android_startup.py
|
| diff --git a/tools/cygprofile/profile_android_startup.py b/tools/cygprofile/profile_android_startup.py
|
| index 29fad7484afd274c4af3baf15d397df12a1daa5d..9e49bef0a899887f7e5ab1413366999d472c8e0a 100644
|
| --- a/tools/cygprofile/profile_android_startup.py
|
| +++ b/tools/cygprofile/profile_android_startup.py
|
| @@ -218,15 +218,12 @@
|
| The exit code for the tests.
|
| """
|
| device_path = '/data/local/tmp/cygprofile_unittests'
|
| - 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
|
| + 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
|
|
|
| def CollectProfile(self, apk, package_info):
|
| """Run a profile and collect the log files.
|
| @@ -240,7 +237,8 @@
|
| Raises:
|
| NoCyglogDataError: No data was found on the device.
|
| """
|
| - self._Install(apk)
|
| + self._Install(apk, package_info)
|
| +
|
| try:
|
| changer = self._SetChromeFlags(package_info)
|
| self._SetUpDeviceFolders()
|
| @@ -268,7 +266,7 @@
|
| self._DeleteDeviceData()
|
| self._DeleteHostData()
|
|
|
| - def _Install(self, apk):
|
| + def _Install(self, apk, package_info):
|
| """Installs Chrome.apk on the device.
|
| Args:
|
| apk: The location of the chrome apk to profile.
|
| @@ -276,7 +274,7 @@
|
| as from pylib/constants.
|
| """
|
| print 'Installing apk...'
|
| - self._device.Install(apk)
|
| + self._device.old_interface.ManagedInstall(apk, package_info.package)
|
|
|
| def _SetUpDevice(self):
|
| """When profiling, files are output to the disk by every process. This
|
| @@ -289,7 +287,7 @@
|
| # SELinux need to be in permissive mode, otherwise the process cannot
|
| # write the log files.
|
| print 'Putting SELinux in permissive mode...'
|
| - self._device.RunShellCommand(['setenforce' '0'], check_return=True)
|
| + self._device.old_interface.RunShellCommand('setenforce 0')
|
| except device_errors.CommandFailedError as e:
|
| # TODO(jbudorick) Handle this exception appropriately once interface
|
| # conversions are finished.
|
| @@ -311,15 +309,13 @@
|
| """Creates folders on the device to store cyglog data. """
|
| print 'Setting up device folders...'
|
| self._DeleteDeviceData()
|
| - self._device.RunShellCommand(
|
| - ['mkdir', '-p', str(self._DEVICE_CYGLOG_DIR)],
|
| - check_return=True)
|
| + self._device.old_interface.RunShellCommand(
|
| + 'mkdir -p %s' % self._DEVICE_CYGLOG_DIR)
|
|
|
| def _DeleteDeviceData(self):
|
| """Clears out cyglog storage locations on the device. """
|
| - self._device.RunShellCommand(
|
| - ['rm', '-rf', str(self._DEVICE_CYGLOG_DIR)],
|
| - check_return=True)
|
| + self._device.old_interface.RunShellCommand(
|
| + 'rm -rf %s' % self._DEVICE_CYGLOG_DIR)
|
|
|
| def _StartChrome(self, package_info, url):
|
| print 'Launching chrome...'
|
| @@ -351,7 +347,7 @@
|
| """
|
| print 'Pulling cyglog data...'
|
| self._SetUpHostFolders()
|
| - self._device.PullFile(
|
| + self._device.old_interface.Adb().Pull(
|
| self._DEVICE_CYGLOG_DIR, self._host_cyglog_dir)
|
| files = os.listdir(self._host_cyglog_dir)
|
|
|
|
|