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

Merge pull request #428 from bjackman/geekbench-corporate

Geekbench: Add support for Corporate version
This commit is contained in:
setrofim 2017-07-05 11:45:32 +01:00 committed by GitHub
commit 64d3ddc8e6
3 changed files with 28 additions and 5 deletions

View File

@ -97,6 +97,8 @@ class Geekbench(AndroidUiAutoBenchmark):
'manually later.')), 'manually later.')),
] ]
is_corporate = False
@property @property
def activity(self): def activity(self):
return self.versions[self.version]['activity'] return self.versions[self.version]['activity']
@ -109,6 +111,7 @@ 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.uiauto_params['is_corporate'] = self.is_corporate
self.run_timeout = self.timeout * self.times self.run_timeout = self.timeout * self.times
self.exact_apk_version = self.version self.exact_apk_version = self.version
@ -384,6 +387,22 @@ class GBScoreCalculator(object):
context.result.add_metric('Geekbench Score', int(overall_score)) 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): def namemify(basename, i):
return basename + (' {}'.format(i) if i else '') return basename + (' {}'.format(i) if i else '')

View File

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