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

Unified Diff: build/android/provision_devices.py

Issue 1370873002: [Android] remount file system as writeable when failing to push files to external storage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/provision_devices.py
diff --git a/build/android/provision_devices.py b/build/android/provision_devices.py
index faf980f73dfd14ed9c7e917294d0010421327618..745248b85d8609316f11e3135c1bc0256e65c168 100755
--- a/build/android/provision_devices.py
+++ b/build/android/provision_devices.py
@@ -24,6 +24,7 @@ import time
from devil.android import battery_utils
from devil.android import device_blacklist
from devil.android import device_errors
+from devil.android import device_temp_file
from devil.android import device_utils
from devil.android.sdk import version_codes
from devil.utils import run_tests_helper
@@ -99,6 +100,7 @@ def ProvisionDevice(device, blacklist, options):
device.adb.WaitForDevice()
try:
+ CheckExternalStorage(device)
if should_run_phase(_PHASES.WIPE):
if options.chrome_specific_wipe:
run_phase(WipeChromeData)
@@ -126,6 +128,23 @@ def ProvisionDevice(device, blacklist, options):
str(device))
blacklist.Extend([str(device)])
+def CheckExternalStorage(device):
+ """Checks that storage is writable and if not makes it writable.
+
+ Arguments:
+ device: The device to check.
+ """
+ try:
+ with device_temp_file.DeviceTempFile(
+ device.adb, suffix='.sh', dir=device.GetExternalStoragePath()):
+ pass
+ except device_errors.CommandFailedError:
+ logging.info('External storage not writable. Remounting / as RW')
+ device.RunShellCommand(['mount', '-o', 'remount,rw', '/'],
+ check_return=True, as_root=True)
+ with device_temp_file.DeviceTempFile(
+ device.adb, suffix='.sh', dir=device.GetExternalStoragePath()):
+ pass
def WipeChromeData(device, options):
"""Wipes chrome specific data from device
@@ -392,7 +411,6 @@ def _LaunchHostHeartbeat():
subprocess.Popen([os.path.join(constants.DIR_SOURCE_ROOT,
'build/android/host_heartbeat.py')])
-
def KillHostHeartbeat():
ps = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
stdout, _ = ps.communicate()
@@ -402,7 +420,6 @@ def KillHostHeartbeat():
pid = re.findall(r'(\S+)', match)[1]
subprocess.call(['kill', str(pid)])
-
def main():
# Recommended options on perf bots:
# --disable-network
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698