Work around 'Text file busy' errors in android perf runner.

BUG=374740
TBR=ulan@chromium.org
NOTRY=true

Review URL: https://codereview.chromium.org/830753002

Cr-Commit-Position: refs/heads/master@{#25946}
This commit is contained in:
machenbach 2014-12-31 03:16:00 -08:00 committed by Commit bot
parent ef41f70684
commit ce1b433e8f

View File

@ -539,6 +539,7 @@ class AndroidPlatform(Platform): # pragma: no cover
AndroidPlatform.DEVICE_DIR, "_tmp_", file_name)
file_on_device = os.path.join(
AndroidPlatform.DEVICE_DIR, target_rel, file_name)
folder_on_device = os.path.dirname(file_on_device)
# Only push files not yet pushed in one execution.
if file_on_host in self.pushed:
@ -547,14 +548,15 @@ class AndroidPlatform(Platform): # pragma: no cover
self.pushed.add(file_on_host)
# Work-around for "text file busy" errors. Push the files to a temporary
# location and then move them with a shell command.
# location and then copy them with a shell command.
output = self._SendCommand(
"push %s %s" % (file_on_host, file_on_device_tmp))
# Success looks like this: "3035 KB/s (12512056 bytes in 4.025s)".
# Errors look like this: "failed to copy ... ".
if output and not re.search('^[0-9]', output.splitlines()[-1]):
logging.critical('PUSH FAILED: ' + output)
self._SendCommand("shell mv %s %s" % (file_on_device_tmp, file_on_device))
self._SendCommand("shell mkdir -p %s" % folder_on_device)
self._SendCommand("shell cp %s %s" % (file_on_device_tmp, file_on_device))
def PreTests(self, node, path):
suite_dir = os.path.abspath(os.path.dirname(path))