1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-03-22 02:29:10 +00:00

Merge pull request #294 from jimboatarm/improve-geekbench-timeouts

geekbench: Improve UiAutomator timeouts for slower devices
This commit is contained in:
setrofim 2016-12-02 17:04:01 +00:00 committed by GitHub
commit c7de8cabd6
3 changed files with 21 additions and 16 deletions

View File

@ -87,6 +87,14 @@ class Geekbench(AndroidUiAutoBenchmark):
Parameter('times', kind=int, default=1, Parameter('times', kind=int, default=1,
description=('Specfies the number of times the benchmark will be run in a "tight ' description=('Specfies the number of times the benchmark will be run in a "tight '
'loop", i.e. without performaing setup/teardown inbetween.')), '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 @property
@ -101,14 +109,15 @@ class Geekbench(AndroidUiAutoBenchmark):
super(Geekbench, self).__init__(device, **kwargs) super(Geekbench, self).__init__(device, **kwargs)
self.uiauto_params['version'] = self.version self.uiauto_params['version'] = self.version
self.uiauto_params['times'] = self.times 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 self.exact_apk_version = self.version
def update_result(self, context): def update_result(self, context):
super(Geekbench, self).update_result(context) super(Geekbench, self).update_result(context)
major_version = versiontuple(self.version)[0] if not self.disable_update_result:
update_method = getattr(self, 'update_result_{}'.format(major_version)) major_version = versiontuple(self.version)[0]
update_method(context) update_method = getattr(self, 'update_result_{}'.format(major_version))
update_method(context)
def validate(self): def validate(self):
if (self.times > 1) and (self.version == '2'): if (self.times > 1) and (self.version == '2'):

View File

@ -35,9 +35,8 @@ import java.util.concurrent.TimeUnit;
public class UiAutomation extends UxPerfUiAutomation { public class UiAutomation extends UxPerfUiAutomation {
public static String TAG = "geekbench"; public static String TAG = "geekbench";
public static final int WAIT_TIMEOUT_1SEC = 1000; public static final long WAIT_TIMEOUT_5SEC = TimeUnit.SECONDS.toMillis(5);
public static final long WAIT_TIMEOUT_5MIN = TimeUnit.SECONDS.toMillis(5 * 60); public static final long WAIT_TIMEOUT_20MIN = TimeUnit.SECONDS.toMillis(20 * 60);
public static final long WAIT_TIMEOUT_10MIN = TimeUnit.SECONDS.toMillis(10 * 60);
public void runUiAutomation() throws Exception { public void runUiAutomation() throws Exception {
Bundle params = getParams(); Bundle params = getParams();
@ -93,7 +92,7 @@ public class UiAutomation extends UxPerfUiAutomation {
// new UiObject(new UiSelector().textContains("Accept") // new UiObject(new UiSelector().textContains("Accept")
new UiObject(new UiSelector().resourceId("android:id/button1") new UiObject(new UiSelector().resourceId("android:id/button1")
.className("android.widget.Button")); .className("android.widget.Button"));
if (!acceptButton.waitForExists(WAIT_TIMEOUT_1SEC)) { if (!acceptButton.waitForExists(WAIT_TIMEOUT_5SEC)) {
throw new UiObjectNotFoundException("Could not find Accept button"); throw new UiObjectNotFoundException("Could not find Accept button");
} }
acceptButton.click(); acceptButton.click();
@ -103,7 +102,7 @@ public class UiAutomation extends UxPerfUiAutomation {
UiObject runButton = UiObject runButton =
new UiObject(new UiSelector().textContains("Run Benchmarks") new UiObject(new UiSelector().textContains("Run Benchmarks")
.className("android.widget.Button")); .className("android.widget.Button"));
if (!runButton.waitForExists(WAIT_TIMEOUT_1SEC)) { if (!runButton.waitForExists(WAIT_TIMEOUT_5SEC)) {
throw new UiObjectNotFoundException("Could not find Run button"); throw new UiObjectNotFoundException("Could not find Run button");
} }
runButton.click(); runButton.click();
@ -116,7 +115,7 @@ public class UiAutomation extends UxPerfUiAutomation {
UiObject runButton = UiObject runButton =
new UiObject(new UiSelector().resourceId("com.primatelabs.geekbench:id/runCpuBenchmarks") new UiObject(new UiSelector().resourceId("com.primatelabs.geekbench:id/runCpuBenchmarks")
.className("android.widget.Button")); .className("android.widget.Button"));
if (!runButton.waitForExists(WAIT_TIMEOUT_1SEC)) { if (!runButton.waitForExists(WAIT_TIMEOUT_5SEC)) {
throw new UiObjectNotFoundException("Could not find Run button"); throw new UiObjectNotFoundException("Could not find Run button");
} }
runButton.click(); runButton.click();
@ -125,7 +124,7 @@ public class UiAutomation extends UxPerfUiAutomation {
public void waitForResultsv2() throws Exception { public void waitForResultsv2() throws Exception {
UiSelector selector = new UiSelector(); UiSelector selector = new UiSelector();
UiObject resultsWebview = new UiObject(selector.className("android.webkit.WebView")); 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."); 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...") UiObject runningTextView = new UiObject(selector.text("Running Benchmarks...")
.className("android.widget.TextView")); .className("android.widget.TextView"));
if (!runningTextView.waitForExists(WAIT_TIMEOUT_1SEC)) { if (!runningTextView.waitUntilGone(WAIT_TIMEOUT_20MIN)) {
throw new UiObjectNotFoundException("Did not get to Running Benchmarks... screen.");
}
if (!runningTextView.waitUntilGone(WAIT_TIMEOUT_10MIN)) {
throw new UiObjectNotFoundException("Did not get to Geekbench results screen."); throw new UiObjectNotFoundException("Did not get to Geekbench results screen.");
} }
} }
@ -160,7 +156,7 @@ public class UiAutomation extends UxPerfUiAutomation {
getUiDevice().pressMenu(); getUiDevice().pressMenu();
UiObject shareButton = new UiObject(selector.text("Share") UiObject shareButton = new UiObject(selector.text("Share")
.className("android.widget.TextView")); .className("android.widget.TextView"));
shareButton.waitForExists(WAIT_TIMEOUT_1SEC); shareButton.waitForExists(WAIT_TIMEOUT_5SEC);
shareButton.click(); shareButton.click();
} }
} }