mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-01-31 02:01:16 +00:00
workloads/gfxbench: Allow configuration of tests to be ran.
Allow the user to customise which tests are to be ran on the device.
This commit is contained in:
parent
0f47002e4e
commit
7a085e586a
@ -15,6 +15,7 @@
|
||||
import re
|
||||
|
||||
from wa import ApkUiautoWorkload, WorkloadError, Parameter
|
||||
from wa.utils.types import list_or_string
|
||||
|
||||
|
||||
class Gfxbench(ApkUiautoWorkload):
|
||||
@ -22,13 +23,6 @@ class Gfxbench(ApkUiautoWorkload):
|
||||
name = 'gfxbench-corporate'
|
||||
package_names = ['net.kishonti.gfxbench.gl.v50000.corporate']
|
||||
clear_data_on_reset = False
|
||||
regex_matches = [re.compile(r'Car Chase score (.+)'),
|
||||
re.compile(r'Car Chase Offscreen score (.+)'),
|
||||
re.compile(r'Manhattan 3.1 score (.+)'),
|
||||
re.compile(r'1080p Manhattan 3.1 Offscreen score (.+)'),
|
||||
re.compile(r'1440p Manhattan 3.1.1 Offscreen score (.+)'),
|
||||
re.compile(r'Tessellation score (.+)'),
|
||||
re.compile(r'Tessellation Offscreen score (.+)')]
|
||||
score_regex = re.compile(r'.*?([\d.]+).*')
|
||||
description = '''
|
||||
Execute a subset of graphical performance benchmarks
|
||||
@ -37,23 +31,41 @@ class Gfxbench(ApkUiautoWorkload):
|
||||
1. Open the gfxbench application
|
||||
2. Execute Car Chase, Manhattan and Tessellation benchmarks
|
||||
|
||||
Note: Some of the default tests are unavailable on devices running
|
||||
with a smaller resolution than 1080p.
|
||||
|
||||
'''
|
||||
|
||||
default_test_list = [
|
||||
"Car Chase",
|
||||
"1080p Car Chase Offscreen",
|
||||
"Manhattan 3.1",
|
||||
"1080p Manhattan 3.1 Offscreen",
|
||||
"1440p Manhattan 3.1.1 Offscreen",
|
||||
"Tessellation",
|
||||
"1080p Tessellation Offscreen",
|
||||
]
|
||||
|
||||
parameters = [
|
||||
Parameter('timeout', kind=int, default=3600,
|
||||
description=('Timeout for an iteration of the benchmark.')),
|
||||
Parameter('tests', kind=list_or_string, default=default_test_list,
|
||||
description=('List of tests to be executed.')),
|
||||
]
|
||||
|
||||
def __init__(self, target, **kwargs):
|
||||
super(Gfxbench, self).__init__(target, **kwargs)
|
||||
self.gui.timeout = self.timeout
|
||||
self.gui.uiauto_params['tests'] = self.test_list
|
||||
|
||||
def update_output(self, context):
|
||||
super(Gfxbench, self).update_output(context)
|
||||
expected_results = len(self.regex_matches)
|
||||
expected_results = len(self.test_list)
|
||||
regex_matches = [re.compile('{} score (.+)'.format(t)) for t in self.test_list]
|
||||
logcat_file = context.get_artifact_path('logcat')
|
||||
with open(logcat_file, errors='replace') as fh:
|
||||
for line in fh:
|
||||
for regex in self.regex_matches:
|
||||
for regex in regex_matches:
|
||||
match = regex.search(line)
|
||||
# Check if we have matched the score string in logcat
|
||||
if match:
|
||||
|
Binary file not shown.
@ -40,10 +40,13 @@ public class UiAutomation extends BaseUiAutomation {
|
||||
private int networkTimeoutSecs = 30;
|
||||
private long networkTimeout = TimeUnit.SECONDS.toMillis(networkTimeoutSecs);
|
||||
public static String TAG = "UXPERF";
|
||||
protected Bundle parameters;
|
||||
protected String[] testList;
|
||||
|
||||
@Before
|
||||
public void initialize(){
|
||||
initialize_instrumentation();
|
||||
parameters = getParams();
|
||||
testList = parameters.getStringArray("tests");
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -66,21 +69,18 @@ public class UiAutomation extends BaseUiAutomation {
|
||||
|
||||
mDevice.click(selectx,selecty);
|
||||
|
||||
// Enable High level tests
|
||||
// Disable test categories
|
||||
toggleTest("High-Level Tests");
|
||||
toggleTest("Car Chase");
|
||||
toggleTest("1080p Car Chase Offscreen");
|
||||
toggleTest("Manhattan 3.1");
|
||||
toggleTest("1080p Manhattan 3.1 Offscreen");
|
||||
toggleTest("1440p Manhattan 3.1.1 Offscreen");
|
||||
|
||||
// Enable low level tests
|
||||
toggleTest("Low-Level Tests");
|
||||
toggleTest("Tessellation");
|
||||
toggleTest("1080p Tessellation Offscreen");
|
||||
toggleTest("Special Tests");
|
||||
toggleTest("Fixed Time Test");
|
||||
|
||||
// Enable selected tests
|
||||
for (String test : testList) {
|
||||
toggleTest(test);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void runWorkload() throws Exception {
|
||||
@ -129,7 +129,7 @@ public class UiAutomation extends BaseUiAutomation {
|
||||
|
||||
//Wait for results
|
||||
UiObject complete =
|
||||
mDevice.findObject(new UiSelector().text("High-Level Tests")
|
||||
mDevice.findObject(new UiSelector().textContains("Test")
|
||||
.className("android.widget.TextView"));
|
||||
complete.waitForExists(1200000);
|
||||
|
||||
@ -144,16 +144,8 @@ public class UiAutomation extends BaseUiAutomation {
|
||||
|
||||
UiObject results =
|
||||
mDevice.findObject(new UiSelector().resourceId("net.kishonti.gfxbench.gl.v50000.corporate:id/results_testList"));
|
||||
ArrayList<String> tests = new ArrayList<String>();
|
||||
tests.add("Car Chase");
|
||||
tests.add("1080p Car Chase Offscreen");
|
||||
tests.add("Manhattan 3.1");
|
||||
tests.add("1080p Manhattan 3.1 Offscreen");
|
||||
tests.add("1440p Manhattan 3.1.1 Offscreen");
|
||||
tests.add("Tessellation");
|
||||
tests.add("1080p Tessellation Offscreen");
|
||||
|
||||
for (String test : tests) {
|
||||
for (String test : testList) {
|
||||
getTestScore(list, results, test);
|
||||
}
|
||||
|
||||
@ -164,6 +156,7 @@ public class UiAutomation extends BaseUiAutomation {
|
||||
UiObject test =
|
||||
mDevice.findObject(new UiSelector().text(testname));
|
||||
if (!test.exists() && list.waitForExists(60)) {
|
||||
list.flingToBeginning(10);
|
||||
list.scrollIntoView(test);
|
||||
}
|
||||
test.click();
|
||||
|
Loading…
x
Reference in New Issue
Block a user