Commit 2fdebc04 authored by machenbach's avatar machenbach Committed by Commit bot

[test] Replace android_commands in v8 perf runner.

BUG=chromium:267773
LOG=n
NOTRY=true

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

Cr-Commit-Position: refs/heads/master@{#29875}
parent f6745517
...@@ -126,16 +126,16 @@ def LoadAndroidBuildTools(path): # pragma: no cover ...@@ -126,16 +126,16 @@ def LoadAndroidBuildTools(path): # pragma: no cover
assert os.path.exists(path) assert os.path.exists(path)
sys.path.insert(0, path) sys.path.insert(0, path)
from pylib.device import device_utils # pylint: disable=F0401 from pylib.device import adb_wrapper # pylint: disable=F0401
from pylib.device import device_errors # pylint: disable=F0401 from pylib.device import device_errors # pylint: disable=F0401
from pylib.device import device_utils # pylint: disable=F0401
from pylib.perf import cache_control # pylint: disable=F0401 from pylib.perf import cache_control # pylint: disable=F0401
from pylib.perf import perf_control # pylint: disable=F0401 from pylib.perf import perf_control # pylint: disable=F0401
import pylib.android_commands # pylint: disable=F0401 global adb_wrapper
global cache_control global cache_control
global device_errors global device_errors
global device_utils global device_utils
global perf_control global perf_control
global pylib
def GeometricMean(values): def GeometricMean(values):
...@@ -652,15 +652,13 @@ class AndroidPlatform(Platform): # pragma: no cover ...@@ -652,15 +652,13 @@ class AndroidPlatform(Platform): # pragma: no cover
if not options.device: if not options.device:
# Detect attached device if not specified. # Detect attached device if not specified.
devices = pylib.android_commands.GetAttachedDevices( devices = adb_wrapper.AdbWrapper.Devices()
hardware=True, emulator=False, offline=False)
assert devices and len(devices) == 1, ( assert devices and len(devices) == 1, (
"None or multiple devices detected. Please specify the device on " "None or multiple devices detected. Please specify the device on "
"the command-line with --device") "the command-line with --device")
options.device = devices[0] options.device = str(devices[0])
adb_wrapper = pylib.android_commands.AndroidCommands(options.device) self.adb_wrapper = adb_wrapper.AdbWrapper(options.device)
self.device = device_utils.DeviceUtils(adb_wrapper) self.device = device_utils.DeviceUtils(self.adb_wrapper)
self.adb = adb_wrapper.Adb()
def PreExecution(self): def PreExecution(self):
perf = perf_control.PerfControl(self.device) perf = perf_control.PerfControl(self.device)
...@@ -674,10 +672,6 @@ class AndroidPlatform(Platform): # pragma: no cover ...@@ -674,10 +672,6 @@ class AndroidPlatform(Platform): # pragma: no cover
perf.SetDefaultPerfMode() perf.SetDefaultPerfMode()
self.device.RunShellCommand(["rm", "-rf", AndroidPlatform.DEVICE_DIR]) self.device.RunShellCommand(["rm", "-rf", AndroidPlatform.DEVICE_DIR])
def _SendCommand(self, cmd):
logging.info("adb -s %s %s" % (str(self.device), cmd))
return self.adb.SendCommand(cmd, timeout_time=60)
def _PushFile(self, host_dir, file_name, target_rel=".", def _PushFile(self, host_dir, file_name, target_rel=".",
skip_if_missing=False): skip_if_missing=False):
file_on_host = os.path.join(host_dir, file_name) file_on_host = os.path.join(host_dir, file_name)
...@@ -701,14 +695,13 @@ class AndroidPlatform(Platform): # pragma: no cover ...@@ -701,14 +695,13 @@ class AndroidPlatform(Platform): # pragma: no cover
# Work-around for "text file busy" errors. Push the files to a temporary # Work-around for "text file busy" errors. Push the files to a temporary
# location and then copy them with a shell command. # location and then copy them with a shell command.
output = self._SendCommand( output = self.adb_wrapper.Push(file_on_host, file_on_device_tmp)
"push %s %s" % (file_on_host, file_on_device_tmp))
# Success looks like this: "3035 KB/s (12512056 bytes in 4.025s)". # Success looks like this: "3035 KB/s (12512056 bytes in 4.025s)".
# Errors look like this: "failed to copy ... ". # Errors look like this: "failed to copy ... ".
if output and not re.search('^[0-9]', output.splitlines()[-1]): if output and not re.search('^[0-9]', output.splitlines()[-1]):
logging.critical('PUSH FAILED: ' + output) logging.critical('PUSH FAILED: ' + output)
self._SendCommand("shell mkdir -p %s" % folder_on_device) self.adb_wrapper.Shell("mkdir -p %s" % folder_on_device)
self._SendCommand("shell cp %s %s" % (file_on_device_tmp, file_on_device)) self.adb_wrapper.Shell("cp %s %s" % (file_on_device_tmp, file_on_device))
def _PushExecutable(self, shell_dir, target_dir, binary): def _PushExecutable(self, shell_dir, target_dir, binary):
self._PushFile(shell_dir, binary, target_dir) self._PushFile(shell_dir, binary, target_dir)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment