1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2024-10-06 10:51:13 +01:00

Geekbench: Add support for Corporate version

The Corporate version is a specialised version of Geekbench. It has
different package names and does not require dismissing a EULA. The
new corporate version is added as a distinct
benchmark ("geekbench-corporate" vs "geekbench").

Note that this changes the wait-for-results UiAutomator snippet from
looking for "Running Benchmarks..." to "*Running*". This is because
the version I've tested updates the text widget with the name of each
benchmark phase as it is run. However I don't know if this is a
feature of the Corporate version or simply of Geekbench 4.1.0.
This commit is contained in:
Brendan Jackman 2017-07-04 11:58:42 +01:00
parent 4d7ef408c9
commit 0656e61bc2
3 changed files with 28 additions and 5 deletions

View File

@ -97,6 +97,8 @@ class Geekbench(AndroidUiAutoBenchmark):
'manually later.')),
]
is_corporate = False
@property
def activity(self):
return self.versions[self.version]['activity']
@ -109,6 +111,7 @@ class Geekbench(AndroidUiAutoBenchmark):
super(Geekbench, self).__init__(device, **kwargs)
self.uiauto_params['version'] = self.version
self.uiauto_params['times'] = self.times
self.uiauto_params['is_corporate'] = self.is_corporate
self.run_timeout = self.timeout * self.times
self.exact_apk_version = self.version
@ -384,6 +387,22 @@ class GBScoreCalculator(object):
context.result.add_metric('Geekbench Score', int(overall_score))
class GeekbenchCorproate(Geekbench):
name = "geekbench-corporate"
is_corporate = True
versions = ['4.1.0']
# The activity name for this version doesn't match the package name
activity = 'com.primatelabs.geekbench.HomeActivity'
package = 'com.primatelabs.geekbench4.corporate'
parameters = [
Parameter('version',
default=sorted(versions)[-1], allowed_values=versions,
override=True)
]
def namemify(basename, i):
return basename + (' {}'.format(i) if i else '')

View File

@ -47,9 +47,11 @@ public void runUiAutomation() throws Exception {
String[] version = params.getString("version").split("\\.");
int majorVersion = Integer.parseInt(version[0]);
int minorVersion = Integer.parseInt(version[1]);
boolean isCorporate = params.getBoolean("is_corporate");
int times = params.getInt("times");
dismissEula();
if (!isCorporate)
dismissEula();
for (int i = 0; i < times; i++) {
switch (majorVersion) {
@ -74,7 +76,7 @@ public void runUiAutomation() throws Exception {
}
break;
case 4:
runCpuBenchmarks();
runCpuBenchmarks(isCorporate);
waitForResultsv3onwards();
break;
default :
@ -112,12 +114,14 @@ public void runUiAutomation() throws Exception {
runButton.click();
}
public void runCpuBenchmarks() throws Exception {
public void runCpuBenchmarks(boolean isCorporate) throws Exception {
// The run button is at the bottom of the view and may be off the screen so swipe to be sure
uiDeviceSwipe(Direction.DOWN, 50);
String packageName = isCorporate ? "com.primatelabs.geekbench4.corporate"
: "com.primatelabs.geekbench";
UiObject runButton =
mDevice.findObject(new UiSelector().resourceId("com.primatelabs.geekbench:id/runCpuBenchmarks")
mDevice.findObject(new UiSelector().resourceId(packageName + ":id/runCpuBenchmarks")
.className("android.widget.Button"));
if (!runButton.waitForExists(WAIT_TIMEOUT_5SEC)) {
throw new UiObjectNotFoundException("Could not find Run button");
@ -135,7 +139,7 @@ public void runUiAutomation() throws Exception {
public void waitForResultsv3onwards() throws Exception {
UiSelector selector = new UiSelector();
UiObject runningTextView = mDevice.findObject(selector.text("Running Benchmarks...")
UiObject runningTextView = mDevice.findObject(selector.textContains("Running")
.className("android.widget.TextView"));
if (!runningTextView.waitUntilGone(WAIT_TIMEOUT_20MIN)) {