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

vellamo: Added support for v3.2.4

This commit is contained in:
Sebastian Goscik 2016-05-17 16:19:04 +01:00
parent 5a1c8c7a7e
commit f02b6d5fd9
3 changed files with 69 additions and 22 deletions

View File

@ -17,6 +17,7 @@ import os
import logging import logging
from HTMLParser import HTMLParser from HTMLParser import HTMLParser
from collections import defaultdict, OrderedDict from collections import defaultdict, OrderedDict
from distutils.version import StrictVersion
from wlauto import AndroidUiAutoBenchmark, Parameter from wlauto import AndroidUiAutoBenchmark, Parameter
from wlauto.utils.types import list_of_strs, numeric from wlauto.utils.types import list_of_strs, numeric
@ -46,6 +47,7 @@ class Vellamo(AndroidUiAutoBenchmark):
benchmark_types = { benchmark_types = {
'2.0.3': ['html5', 'metal'], '2.0.3': ['html5', 'metal'],
'3.0': ['Browser', 'Metal', 'Multi'], '3.0': ['Browser', 'Metal', 'Multi'],
'3.2.4': ['Browser', 'Metal', 'Multi'],
} }
valid_versions = benchmark_types.keys() valid_versions = benchmark_types.keys()
summary_metrics = None summary_metrics = None
@ -66,11 +68,10 @@ class Vellamo(AndroidUiAutoBenchmark):
def __init__(self, device, **kwargs): def __init__(self, device, **kwargs):
super(Vellamo, self).__init__(device, **kwargs) super(Vellamo, self).__init__(device, **kwargs)
if self.version == '2.0.3': if StrictVersion(self.version) >= StrictVersion("3.0.0"):
self.activity = 'com.quicinc.vellamo.VellamoActivity'
if self.version == '3.0':
self.activity = 'com.quicinc.vellamo.main.MainActivity' self.activity = 'com.quicinc.vellamo.main.MainActivity'
self.summary_metrics = self.benchmark_types[self.version] if StrictVersion(self.version) == StrictVersion('2.0.3'):
self.activity = 'com.quicinc.vellamo.VellamoActivity'
def setup(self, context): def setup(self, context):
self.uiauto_params['version'] = self.version self.uiauto_params['version'] = self.version
@ -97,7 +98,12 @@ class Vellamo(AndroidUiAutoBenchmark):
if not self.device.is_rooted: if not self.device.is_rooted:
return return
elif self.version == '3.0.0':
self.update_result_v3(context)
elif self.version == '3.2.4':
self.update_result_v3_2(context)
def update_result_v3(self, context):
for test in self.benchmarks: # Get all scores from HTML files for test in self.benchmarks: # Get all scores from HTML files
filename = None filename = None
if test == "Browser": if test == "Browser":
@ -122,6 +128,22 @@ class Vellamo(AndroidUiAutoBenchmark):
context.result.add_metric('{}_{}'.format(benchmark.name, name), score) context.result.add_metric('{}_{}'.format(benchmark.name, name), score)
context.add_iteration_artifact('vellamo_output', kind='raw', path=filename) context.add_iteration_artifact('vellamo_output', kind='raw', path=filename)
def update_result_v3_2(self, context):
device_file = self.device.path.join(self.device.package_data_directory,
self.package,
'files',
'chapterscores.json')
host_file = os.path.join(context.output_directory, 'vellamo.json')
self.device.pull_file(device_file, host_file, as_root=True)
context.add_iteration_artifact('vellamo_output', kind='raw', path=host_file)
with open(host_file) as results_file:
data = json.load(results_file)
for chapter in data:
for result in chapter['benchmark_results']:
name = result['id']
score = result['score']
context.result.add_metric(name, score)
def non_root_update_result(self, context): def non_root_update_result(self, context):
failed = [] failed = []
with open(self.logcat_log) as logcat: with open(self.logcat_log) as logcat:

View File

@ -59,20 +59,22 @@ public class UiAutomation extends BaseUiAutomation {
getScore("html5", "com.quicinc.vellamo:id/act_ba_results_img_0"); getScore("html5", "com.quicinc.vellamo:id/act_ba_results_img_0");
getScore("metal", "com.quicinc.vellamo:id/act_ba_results_img_1"); getScore("metal", "com.quicinc.vellamo:id/act_ba_results_img_1");
} }
else { else {
dismissLetsRoll(); dismissLetsRoll();
if (version.equals("3.2.4")) {
dismissArrow();
}
if (browser) { if (browser) {
startBrowserTest(browserToUse); startBrowserTest(browserToUse, version);
proccessTest("Browser"); proccessTest("Browser");
} }
if (multicore) { if (multicore) {
startTestV3(1); startTestV3(1, version);
proccessTest("Multicore"); proccessTest("Multicore");
} }
if (metal) { if (metal) {
startTestV3(2); startTestV3(2, version);
proccessTest("Metal"); proccessTest("Metal");
} }
} }
@ -96,7 +98,7 @@ public class UiAutomation extends BaseUiAutomation {
runButton.click(); runButton.click();
} }
public void startBrowserTest(int browserToUse) throws Exception { public void startBrowserTest(int browserToUse, String version) throws Exception {
//Ensure chrome is selected as "browser" fails to run the benchmark //Ensure chrome is selected as "browser" fails to run the benchmark
UiSelector selector = new UiSelector(); UiSelector selector = new UiSelector();
UiObject browserToUseButton = new UiObject(selector.className("android.widget.ImageButton") UiObject browserToUseButton = new UiObject(selector.className("android.widget.ImageButton")
@ -136,13 +138,13 @@ public class UiAutomation extends BaseUiAutomation {
// Run watcher // Run watcher
UiDevice.getInstance().runWatchers(); UiDevice.getInstance().runWatchers();
startTestV3(0); startTestV3(0, version);
} }
public void startTestV3(int run) throws Exception { public void startTestV3(int run, String version) throws Exception {
UiSelector selector = new UiSelector(); UiSelector selector = new UiSelector();
UiObject thirdRunButton = new UiObject(selector.resourceId("com.quicinc.vellamo:id/card_launcher_run_button").instance(run)); UiObject thirdRunButton = new UiObject(selector.resourceId("com.quicinc.vellamo:id/card_launcher_run_button").instance(2));
if (!thirdRunButton.waitForExists(TimeUnit.SECONDS.toMillis(5))) { if (!thirdRunButton.waitForExists(TimeUnit.SECONDS.toMillis(5))) {
if (!thirdRunButton.exists()) { if (!thirdRunButton.exists()) {
throw new UiObjectNotFoundException("Could not find three \"Run\" buttons."); throw new UiObjectNotFoundException("Could not find three \"Run\" buttons.");
@ -158,7 +160,18 @@ public class UiAutomation extends BaseUiAutomation {
} }
runButton.click(); runButton.click();
//Skip tutorial screens //Skip tutorial screen
if (version.equals("3.2.4")) {
UiObject gotItButton = new UiObject(selector.textContains("Got it"));
if (!gotItButton.waitForExists(TimeUnit.SECONDS.toMillis(5))) {
if (!gotItButton.exists()) {
throw new UiObjectNotFoundException("Could not find correct \"GOT IT\" button.");
}
}
gotItButton.click();
}
else {
UiObject swipeScreen = new UiObject(selector.textContains("Swipe left to continue")); UiObject swipeScreen = new UiObject(selector.textContains("Swipe left to continue"));
if (!swipeScreen.waitForExists(TimeUnit.SECONDS.toMillis(5))) { if (!swipeScreen.waitForExists(TimeUnit.SECONDS.toMillis(5))) {
if (!swipeScreen.exists()) { if (!swipeScreen.exists()) {
@ -169,6 +182,7 @@ public class UiAutomation extends BaseUiAutomation {
swipeScreen.swipeLeft(2); swipeScreen.swipeLeft(2);
sleep(1); sleep(1);
swipeScreen.swipeLeft(2); swipeScreen.swipeLeft(2);
}
} }
@ -236,6 +250,17 @@ public class UiAutomation extends BaseUiAutomation {
letsRollButton.click(); letsRollButton.click();
} }
public void dismissArrow() throws Exception {
UiSelector selector = new UiSelector();
UiObject cardContainer = new UiObject(selector.resourceId("com.quicinc.vellamo:id/cards_container")) ;
if (!cardContainer.waitForExists(TimeUnit.SECONDS.toMillis(5))) {
if (!cardContainer.exists()) {
throw new UiObjectNotFoundException("Could not find vellamo main screen");
}
}
cardContainer.click();
}
public void dismissNetworkConnectionDialogIfNecessary() throws Exception { public void dismissNetworkConnectionDialogIfNecessary() throws Exception {
UiSelector selector = new UiSelector(); UiSelector selector = new UiSelector();
UiObject dialog = new UiObject(selector.className("android.widget.TextView") UiObject dialog = new UiObject(selector.className("android.widget.TextView")