diff options
author | bulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-11 15:41:56 +0000 |
---|---|---|
committer | bulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-11 15:41:56 +0000 |
commit | 117cae2668f9004d64df74a642591d41f6bfef2b (patch) | |
tree | 8bac2070ce22ef875628773d717fd858caf4aa58 /build/android/pylib/android_commands.py | |
parent | 3ac8b1c27bd58b0476648678f076150ff60a8713 (diff) | |
download | chromium_src-117cae2668f9004d64df74a642591d41f6bfef2b.zip chromium_src-117cae2668f9004d64df74a642591d41f6bfef2b.tar.gz chromium_src-117cae2668f9004d64df74a642591d41f6bfef2b.tar.bz2 |
Android: upstream latest changes for build/android.
- uses $EXTERNAL_STORAGE rather than /sdcard
- split PerfTEstSetup from android_commands.py
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com/10914199
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@156017 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build/android/pylib/android_commands.py')
-rw-r--r-- | build/android/pylib/android_commands.py | 36 |
1 files changed, 11 insertions, 25 deletions
diff --git a/build/android/pylib/android_commands.py b/build/android/pylib/android_commands.py index a9d8cf9..2b412f3 100644 --- a/build/android/pylib/android_commands.py +++ b/build/android/pylib/android_commands.py @@ -41,10 +41,6 @@ PEXPECT_LINE_RE = re.compile('\n([^\r]*)\r') # appear at the start of any line of a command's output. SHELL_PROMPT = '~+~PQ\x17RS~+~' -# This only works for single core devices. -SCALING_GOVERNOR = '/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor' -DROP_CACHES = '/proc/sys/vm/drop_caches' - # Java properties file LOCAL_PROPERTIES_PATH = '/data/local.prop' @@ -206,10 +202,10 @@ class AndroidCommands(object): if device: self._adb.SetTargetSerial(device) self._logcat = None - self._original_governor = None self._pushed_files = [] self._device_utc_offset = self.RunShellCommand('date +%z')[0] self._md5sum_path = '' + self._external_storage = '' def Adb(self): """Returns our AdbInterface to avoid us wrapping all its methods.""" @@ -224,6 +220,12 @@ class AndroidCommands(object): """Returns the year information of the date on device.""" return self.RunShellCommand('date +%Y')[0] + def GetExternalStorage(self): + if not self._external_storage: + self._external_storage = self.RunShellCommand('echo $EXTERNAL_STORAGE')[0] + assert self._external_storage, 'Unable to find $EXTERNAL_STORAGE' + return self._external_storage + def WaitForDevicePm(self): """Blocks until the device's package manager is available. @@ -296,7 +298,8 @@ class AndroidCommands(object): Returns: A status string returned by adb install """ - assert os.path.isfile(package_file_path) + assert os.path.isfile(package_file_path), ('<%s> is not file' % + package_file_path) install_cmd = ['install'] @@ -405,8 +408,9 @@ class AndroidCommands(object): sdcard_ready = False attempts = 0 wait_period = 5 + external_storage = self.GetExternalStorage() while not sdcard_ready and attempts * wait_period < timeout_time: - output = self.RunShellCommand('ls /sdcard/') + output = self.RunShellCommand('ls ' + external_storage) if output: sdcard_ready = True else: @@ -613,21 +617,6 @@ class AndroidCommands(object): path, self.RunShellCommand('ls -lR %s' % path), re_file, self._device_utc_offset) - def SetupPerformanceTest(self): - """Sets up performance tests.""" - # Disable CPU scaling to reduce noise in tests - if not self._original_governor: - self._original_governor = self.GetFileContents( - SCALING_GOVERNOR, log_result=False) - self.RunShellCommand('echo performance > ' + SCALING_GOVERNOR) - self.DropRamCaches() - - def TearDownPerformanceTest(self): - """Tears down performance tests.""" - if self._original_governor: - self.RunShellCommand('echo %s > %s' % (self._original_governor[0], - SCALING_GOVERNOR)) - self._original_governor = None def SetJavaAssertsEnabled(self, enable): """Sets or removes the device java assertions property. @@ -665,9 +654,6 @@ class AndroidCommands(object): enable and 'all' or '')) return True - def DropRamCaches(self): - """Drops the filesystem ram caches for performance testing.""" - self.RunShellCommand('echo 3 > ' + DROP_CACHES) def StartMonitoringLogcat(self, clear=True, timeout=10, logfile=None, filters=None): |