mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 18:47:53 +00:00
Bug 1486004 - Part 6 - Update mach perftest to support unrooted android devices using mozdevice 4.0.0, ? r=tarek
Depends on D82748 Differential Revision: https://phabricator.services.mozilla.com/D82749
This commit is contained in:
parent
010a210fff
commit
6b2b24ee30
@ -45,7 +45,7 @@ class ADBLoggedDevice(ADBDevice):
|
||||
self._provided_logger = kw.pop("logger")
|
||||
super(ADBLoggedDevice, self).__init__(*args, **kw)
|
||||
|
||||
def _get_logger(self, logger_name):
|
||||
def _get_logger(self, logger_name, verbose):
|
||||
return self._provided_logger
|
||||
|
||||
|
||||
|
@ -22,7 +22,7 @@ class PerformanceTuner:
|
||||
def tune_performance(self):
|
||||
self.log.info("tuning android device performance")
|
||||
self.set_svc_power_stayon()
|
||||
if self.device._have_su or self.device._have_android_su:
|
||||
if self.device.is_rooted:
|
||||
device_name = self.device.shell_output(
|
||||
"getprop ro.product.model", timeout=self.timeout
|
||||
)
|
||||
@ -36,12 +36,10 @@ class PerformanceTuner:
|
||||
self.device.clear_logcat(timeout=self.timeout)
|
||||
self.log.info("android device performance tuning complete")
|
||||
|
||||
def _set_value_and_check_exitcode(self, file_name, value, root=False):
|
||||
def _set_value_and_check_exitcode(self, file_name, value):
|
||||
self.log.info("setting {} to {}".format(file_name, value))
|
||||
if self.device.shell_bool(
|
||||
" ".join(["echo", str(value), ">", str(file_name)]),
|
||||
root=root,
|
||||
timeout=self.timeout,
|
||||
" ".join(["echo", str(value), ">", str(file_name)]), timeout=self.timeout,
|
||||
):
|
||||
self.log.info("successfully set {} to {}".format(file_name, value))
|
||||
else:
|
||||
@ -65,9 +63,7 @@ class PerformanceTuner:
|
||||
]
|
||||
for service in services:
|
||||
self.log.info(" ".join(["turning off service:", service]))
|
||||
self.device.shell_bool(
|
||||
" ".join(["stop", service]), root=True, timeout=self.timeout
|
||||
)
|
||||
self.device.shell_bool(" ".join(["stop", service]), timeout=self.timeout)
|
||||
|
||||
services_list_output = self.device.shell_output(
|
||||
"service list", timeout=self.timeout
|
||||
@ -113,7 +109,7 @@ class PerformanceTuner:
|
||||
}
|
||||
|
||||
for key, value in commands.items():
|
||||
self._set_value_and_check_exitcode(key, value, root=True)
|
||||
self._set_value_and_check_exitcode(key, value)
|
||||
|
||||
def set_cpu_performance_parameters(self, device_name=None):
|
||||
self.log.info("setting cpu performance parameters")
|
||||
@ -158,7 +154,7 @@ class PerformanceTuner:
|
||||
)
|
||||
|
||||
for key, value in commands.items():
|
||||
self._set_value_and_check_exitcode(key, value, root=True)
|
||||
self._set_value_and_check_exitcode(key, value)
|
||||
|
||||
def set_gpu_performance_parameters(self, device_name=None):
|
||||
self.log.info("setting gpu performance parameters")
|
||||
@ -208,7 +204,7 @@ class PerformanceTuner:
|
||||
)
|
||||
|
||||
for key, value in commands.items():
|
||||
self._set_value_and_check_exitcode(key, value, root=True)
|
||||
self._set_value_and_check_exitcode(key, value)
|
||||
|
||||
def set_kernel_performance_parameters(self):
|
||||
self.log.info("setting kernel performance parameters")
|
||||
@ -219,4 +215,4 @@ class PerformanceTuner:
|
||||
"/sys/kernel/debug/msm-bus-dbg/shell-client/slv": "512",
|
||||
}
|
||||
for key, value in commands.items():
|
||||
self._set_value_and_check_exitcode(key, value, root=True)
|
||||
self._set_value_and_check_exitcode(key, value)
|
||||
|
@ -16,6 +16,8 @@ class FakeDevice:
|
||||
self._logger = mock.MagicMock()
|
||||
self._have_su = True
|
||||
self._have_android_su = True
|
||||
self._have_root_shell = True
|
||||
self.is_rooted = True
|
||||
|
||||
def clear_logcat(self, *args, **kwargs):
|
||||
return True
|
||||
@ -60,6 +62,8 @@ def test_android_perf_tuning_rooted(device):
|
||||
# on rooted devices correctly
|
||||
device._have_su = True
|
||||
device._have_android_su = True
|
||||
device._have_root_shell = True
|
||||
device.is_rooted = True
|
||||
with mock.patch(
|
||||
"mozperftest.system.android_perf_tuner.PerformanceTuner.set_kernel_performance_parameters"
|
||||
) as mockfunc:
|
||||
@ -74,6 +78,8 @@ def test_android_perf_tuning_nonrooted(device):
|
||||
# on non-rooted devices correctly
|
||||
device._have_su = False
|
||||
device._have_android_su = False
|
||||
device._have_root_shell = False
|
||||
device.is_rooted = False
|
||||
with mock.patch(
|
||||
"mozperftest.system.android_perf_tuner.PerformanceTuner.set_kernel_performance_parameters"
|
||||
) as mockfunc:
|
||||
|
@ -7,9 +7,9 @@ from __future__ import absolute_import
|
||||
from setuptools import setup
|
||||
|
||||
PACKAGE_NAME = "mozperftest"
|
||||
PACKAGE_VERSION = "0.1"
|
||||
PACKAGE_VERSION = "0.2"
|
||||
|
||||
deps = ["jsonschema", "mozlog >= 6.0", "mozdevice >= 3.0.2,<4", "mozproxy", "mozinfo"]
|
||||
deps = ["jsonschema", "mozlog >= 6.0", "mozdevice >= 4.0.0", "mozproxy", "mozinfo"]
|
||||
|
||||
setup(
|
||||
name=PACKAGE_NAME,
|
||||
|
Loading…
Reference in New Issue
Block a user