diff --git a/wlauto/workloads/geekbench/__init__.py b/wlauto/workloads/geekbench/__init__.py index f3abfde8..efff9aac 100644 --- a/wlauto/workloads/geekbench/__init__.py +++ b/wlauto/workloads/geekbench/__init__.py @@ -87,6 +87,14 @@ class Geekbench(AndroidUiAutoBenchmark): Parameter('times', kind=int, default=1, description=('Specfies the number of times the benchmark will be run in a "tight ' 'loop", i.e. without performaing setup/teardown inbetween.')), + Parameter('timeout', kind=int, default=900, + description=('Timeout for a single iteration of the benchmark. This value is ' + 'multiplied by ``times`` to calculate the overall run timeout. ')), + Parameter('disable_update_result', kind=bool, default=False, + description=('If ``True`` the results file will not be pulled from the devices ' + '/data/data/com.primatelabs.geekbench folder. This allows the ' + 'workload to be run on unrooted devices and the results extracted ' + 'manually later. ' )), ] @property @@ -101,14 +109,15 @@ class Geekbench(AndroidUiAutoBenchmark): super(Geekbench, self).__init__(device, **kwargs) self.uiauto_params['version'] = self.version self.uiauto_params['times'] = self.times - self.run_timeout = 10 * 60 * self.times + self.run_timeout = self.timeout * self.times self.exact_apk_version = self.version def update_result(self, context): super(Geekbench, self).update_result(context) - major_version = versiontuple(self.version)[0] - update_method = getattr(self, 'update_result_{}'.format(major_version)) - update_method(context) + if not self.disable_update_result: + major_version = versiontuple(self.version)[0] + update_method = getattr(self, 'update_result_{}'.format(major_version)) + update_method(context) def validate(self): if (self.times > 1) and (self.version == '2'): diff --git a/wlauto/workloads/geekbench/com.arm.wlauto.uiauto.geekbench.jar b/wlauto/workloads/geekbench/com.arm.wlauto.uiauto.geekbench.jar index 69955503..c807b1cd 100644 Binary files a/wlauto/workloads/geekbench/com.arm.wlauto.uiauto.geekbench.jar and b/wlauto/workloads/geekbench/com.arm.wlauto.uiauto.geekbench.jar differ diff --git a/wlauto/workloads/geekbench/uiauto/src/com/arm/wlauto/uiauto/UiAutomation.java b/wlauto/workloads/geekbench/uiauto/src/com/arm/wlauto/uiauto/UiAutomation.java index 8f1bc0b2..140e35e4 100644 --- a/wlauto/workloads/geekbench/uiauto/src/com/arm/wlauto/uiauto/UiAutomation.java +++ b/wlauto/workloads/geekbench/uiauto/src/com/arm/wlauto/uiauto/UiAutomation.java @@ -35,9 +35,8 @@ import java.util.concurrent.TimeUnit; public class UiAutomation extends UxPerfUiAutomation { public static String TAG = "geekbench"; - public static final int WAIT_TIMEOUT_1SEC = 1000; - public static final long WAIT_TIMEOUT_5MIN = TimeUnit.SECONDS.toMillis(5 * 60); - public static final long WAIT_TIMEOUT_10MIN = TimeUnit.SECONDS.toMillis(10 * 60); + public static final long WAIT_TIMEOUT_5SEC = TimeUnit.SECONDS.toMillis(5); + public static final long WAIT_TIMEOUT_20MIN = TimeUnit.SECONDS.toMillis(20 * 60); public void runUiAutomation() throws Exception { Bundle params = getParams(); @@ -93,7 +92,7 @@ public class UiAutomation extends UxPerfUiAutomation { // new UiObject(new UiSelector().textContains("Accept") new UiObject(new UiSelector().resourceId("android:id/button1") .className("android.widget.Button")); - if (!acceptButton.waitForExists(WAIT_TIMEOUT_1SEC)) { + if (!acceptButton.waitForExists(WAIT_TIMEOUT_5SEC)) { throw new UiObjectNotFoundException("Could not find Accept button"); } acceptButton.click(); @@ -103,7 +102,7 @@ public class UiAutomation extends UxPerfUiAutomation { UiObject runButton = new UiObject(new UiSelector().textContains("Run Benchmarks") .className("android.widget.Button")); - if (!runButton.waitForExists(WAIT_TIMEOUT_1SEC)) { + if (!runButton.waitForExists(WAIT_TIMEOUT_5SEC)) { throw new UiObjectNotFoundException("Could not find Run button"); } runButton.click(); @@ -116,7 +115,7 @@ public class UiAutomation extends UxPerfUiAutomation { UiObject runButton = new UiObject(new UiSelector().resourceId("com.primatelabs.geekbench:id/runCpuBenchmarks") .className("android.widget.Button")); - if (!runButton.waitForExists(WAIT_TIMEOUT_1SEC)) { + if (!runButton.waitForExists(WAIT_TIMEOUT_5SEC)) { throw new UiObjectNotFoundException("Could not find Run button"); } runButton.click(); @@ -125,7 +124,7 @@ public class UiAutomation extends UxPerfUiAutomation { public void waitForResultsv2() throws Exception { UiSelector selector = new UiSelector(); UiObject resultsWebview = new UiObject(selector.className("android.webkit.WebView")); - if (!resultsWebview.waitForExists(WAIT_TIMEOUT_5MIN)) { + if (!resultsWebview.waitForExists(WAIT_TIMEOUT_20MIN)) { throw new UiObjectNotFoundException("Did not see Geekbench results screen."); } } @@ -135,10 +134,7 @@ public class UiAutomation extends UxPerfUiAutomation { UiObject runningTextView = new UiObject(selector.text("Running Benchmarks...") .className("android.widget.TextView")); - if (!runningTextView.waitForExists(WAIT_TIMEOUT_1SEC)) { - throw new UiObjectNotFoundException("Did not get to Running Benchmarks... screen."); - } - if (!runningTextView.waitUntilGone(WAIT_TIMEOUT_10MIN)) { + if (!runningTextView.waitUntilGone(WAIT_TIMEOUT_20MIN)) { throw new UiObjectNotFoundException("Did not get to Geekbench results screen."); } } @@ -160,7 +156,7 @@ public class UiAutomation extends UxPerfUiAutomation { getUiDevice().pressMenu(); UiObject shareButton = new UiObject(selector.text("Share") .className("android.widget.TextView")); - shareButton.waitForExists(WAIT_TIMEOUT_1SEC); + shareButton.waitForExists(WAIT_TIMEOUT_5SEC); shareButton.click(); } }