mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-03-25 03:59:11 +00:00
[workloads] Add JetNews jank tests workload
This patch adds the JetNews jank-testing workload. This is accomplished through the uiauto helper library and the jank test classes. This workload requires a JetNews app APK to be available. We plan to make it available through the workload-automation-assets repo. At the end of the run, users should end up with a json file containing all the frame/jank metrics. There are 3 parameters for this workload: - tests: Specifies which of the 3 available tests to run (default is to run all of them) - flingspeed: The speed of the fling interactions. - repeat: How many times each of the selected tests is to be executed in a single measuring session.
This commit is contained in:
parent
18d9f942da
commit
b38e64a2a8
93
wa/workloads/jetnews/__init__.py
Executable file
93
wa/workloads/jetnews/__init__.py
Executable file
@ -0,0 +1,93 @@
|
||||
# Copyright 2024 ARM Limited
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
from wa import ApkUiautoWorkload, Parameter, TestPackageHandler
|
||||
from wa.utils.types import list_of_strs
|
||||
import re
|
||||
|
||||
class Jetnews(ApkUiautoWorkload):
|
||||
|
||||
name = 'jetnews'
|
||||
package_names = ['com.example.jetnews']
|
||||
description = '''
|
||||
JetNews
|
||||
'''
|
||||
|
||||
default_test_strings = [
|
||||
'PortraitVerticalTest',
|
||||
'PortraitHorizontalTest',
|
||||
'LandscapeVerticalTest',
|
||||
]
|
||||
|
||||
parameters = [
|
||||
Parameter('tests', kind=list_of_strs,
|
||||
description="""
|
||||
List of tests to be executed. The available
|
||||
tests are PortraitVerticalTest, LandscapeVerticalTest and
|
||||
PortraitHorizontalTest. If none are specified, the default
|
||||
is to run all of them.
|
||||
""", default=default_test_strings),
|
||||
Parameter('flingspeed', kind=int,
|
||||
description="""
|
||||
Default fling speed for the tests. The default is 5000 and
|
||||
the minimum value is 1000.
|
||||
""", default=5000),
|
||||
Parameter('repeat', kind=int,
|
||||
description="""
|
||||
The number of times the tests should be repeated. The default
|
||||
is 1.
|
||||
""", default=1)
|
||||
]
|
||||
|
||||
_OUTPUT_SECTION_REGEX = re.compile(
|
||||
r'(\s*INSTRUMENTATION_STATUS: gfx-[\w-]+=[-+\d.]+\n)+'
|
||||
r'\s*INSTRUMENTATION_STATUS_CODE: (?P<code>[-+\d]+)\n?', re.M)
|
||||
_OUTPUT_GFXINFO_REGEX = re.compile(
|
||||
r'INSTRUMENTATION_STATUS: (?P<name>[\w-]+)=(?P<value>[-+\d.]+)')
|
||||
|
||||
def __init__(self, target, **kwargs):
|
||||
super(Jetnews, self).__init__(target, **kwargs)
|
||||
# This test uses the androidx library.
|
||||
self.gui.uiauto_runner = 'androidx.test.runner.AndroidJUnitRunner'
|
||||
# Class for the regular instrumented tests.
|
||||
self.gui.uiauto_class = 'UiAutomation'
|
||||
# Class containing the jank tests.
|
||||
self.gui.uiauto_jank_class = 'UiAutomationJankTests'
|
||||
# A list of all the individual jank tests contained in the jetnews
|
||||
# uiauto apk.
|
||||
self.gui.jank_stages = ['test1']
|
||||
self.gui.uiauto_params['tests'] = self.tests
|
||||
self.gui.uiauto_params['flingspeed'] = self.flingspeed
|
||||
self.gui.uiauto_params['repeat'] = self.repeat
|
||||
# Declared here so we can hold the test output for later processing.
|
||||
self.output = {}
|
||||
|
||||
def run(self, context):
|
||||
# Run the jank tests and capture the output so we can parse it
|
||||
# into the output result file.
|
||||
self.output['test1'] = self.gui._execute('test1', self.gui.timeout)
|
||||
|
||||
def update_output(self, context):
|
||||
super(Jetnews, self).update_output(context)
|
||||
# Parse the test result and filter out the results so we can output
|
||||
# a meaningful result file.
|
||||
for test, test_output in self.output.items():
|
||||
for section in self._OUTPUT_SECTION_REGEX.finditer(test_output):
|
||||
if int(section.group('code')) != -1:
|
||||
msg = 'Run failed (INSTRUMENTATION_STATUS_CODE: {}). See log.'
|
||||
raise RuntimeError(msg.format(section.group('code')))
|
||||
for metric in self._OUTPUT_GFXINFO_REGEX.finditer(section.group()):
|
||||
context.add_metric(metric.group('name'), metric.group('value'),
|
||||
classifiers={'test_name': test})
|
BIN
wa/workloads/jetnews/com.arm.wa.uiauto.jetnews.apk
Normal file
BIN
wa/workloads/jetnews/com.arm.wa.uiauto.jetnews.apk
Normal file
Binary file not shown.
51
wa/workloads/jetnews/uiauto/app/build.gradle
Normal file
51
wa/workloads/jetnews/uiauto/app/build.gradle
Normal file
@ -0,0 +1,51 @@
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
id "org.jetbrains.kotlin.android" version "2.0.20-Beta1"
|
||||
}
|
||||
|
||||
kotlin {
|
||||
// Standardize on the same jvm version for compatibility reasons.
|
||||
jvmToolchain(17)
|
||||
}
|
||||
|
||||
//apply plugin: 'com.android.application'
|
||||
def packageName = "com.arm.wa.uiauto.jetnews"
|
||||
|
||||
android {
|
||||
namespace = "com.arm.wa.uiauto.jetnews"
|
||||
|
||||
compileSdkVersion 34
|
||||
defaultConfig {
|
||||
applicationId "${packageName}"
|
||||
minSdkVersion 23
|
||||
targetSdkVersion 28
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
buildTypes {
|
||||
applicationVariants.all { variant ->
|
||||
variant.outputs.each { output ->
|
||||
output.outputFileName = "${packageName}.apk"
|
||||
}
|
||||
}
|
||||
}
|
||||
useLibrary 'android.test.base'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
implementation 'androidx.test.uiautomator:uiautomator:2.4.0-alpha01'
|
||||
implementation 'androidx.test.janktesthelper:janktesthelper:1.0.1'
|
||||
implementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||||
|
||||
implementation(name: 'uiauto', ext: 'aar')
|
||||
}
|
||||
|
||||
repositories {
|
||||
flatDir {
|
||||
dirs 'libs'
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
options.compilerArgs += ['-Xlint:deprecation']
|
||||
}
|
11
wa/workloads/jetnews/uiauto/app/src/main/AndroidManifest.xml
Normal file
11
wa/workloads/jetnews/uiauto/app/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
|
||||
|
||||
<instrumentation
|
||||
android:name="androidx.test.runner.AndroidJUnitRunner"
|
||||
android:targetPackage="${applicationId}"/>
|
||||
|
||||
</manifest>
|
@ -0,0 +1,81 @@
|
||||
/* Copyright 2014-2024 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.arm.wa.uiauto.jetnews;
|
||||
|
||||
import androidx.test.uiautomator.UiObject;
|
||||
import androidx.test.uiautomator.UiSelector;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.arm.wa.uiauto.ApplaunchInterface;
|
||||
import com.arm.wa.uiauto.BaseUiAutomation;
|
||||
import com.arm.wa.uiauto.UiAutoUtils;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
// Dummy workload for jetnews. We need to use JankTestBasem but we
|
||||
// can't inherit from that class as we already inherit BaseUiAutomation.
|
||||
// Therefore we have another class (UiAutomationJankTests) that uses
|
||||
// this class instead.
|
||||
|
||||
public class UiAutomation extends BaseUiAutomation implements ApplaunchInterface {
|
||||
|
||||
protected Bundle parameters;
|
||||
protected String packageID;
|
||||
|
||||
public void initialize() {
|
||||
parameters = getParams();
|
||||
packageID = getPackageID(parameters);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setup() throws Exception {
|
||||
setScreenOrientation(ScreenOrientation.NATURAL);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void runWorkload() {
|
||||
// Intentionally empty, not used.
|
||||
}
|
||||
|
||||
@Test
|
||||
public void teardown() throws Exception {
|
||||
unsetScreenOrientation();
|
||||
}
|
||||
|
||||
public void runApplicationSetup() throws Exception {
|
||||
// Intentionally empty, not used.
|
||||
}
|
||||
|
||||
// Sets the UiObject that marks the end of the application launch.
|
||||
public UiObject getLaunchEndObject() {
|
||||
// Intentionally empty, not used.
|
||||
return null;
|
||||
}
|
||||
|
||||
// Returns the launch command for the application.
|
||||
public String getLaunchCommand() {
|
||||
// Intentionally empty, not used.
|
||||
return "";
|
||||
}
|
||||
|
||||
// Pass the workload parameters, used for applaunch
|
||||
public void setWorkloadParameters(Bundle workload_parameters) {
|
||||
// Intentionally empty, not used.
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,298 @@
|
||||
/* Copyright 2014-2024 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.arm.wa.uiauto.jetnews;
|
||||
|
||||
import androidx.test.jank.GfxMonitor;
|
||||
import androidx.test.jank.JankTest;
|
||||
import androidx.test.jank.JankTestBase;
|
||||
import android.os.Bundle;
|
||||
|
||||
// UiAutomator 1 imports.
|
||||
import androidx.test.uiautomator.UiScrollable;
|
||||
import androidx.test.uiautomator.UiSelector;
|
||||
import androidx.test.uiautomator.UiObject;
|
||||
|
||||
// UiAutomator 2 imports.
|
||||
import androidx.test.uiautomator.By;
|
||||
import androidx.test.uiautomator.Direction;
|
||||
import androidx.test.uiautomator.UiDevice;
|
||||
import androidx.test.uiautomator.UiObject2;
|
||||
import androidx.test.uiautomator.Until;
|
||||
|
||||
import androidx.test.espresso.matcher.ViewMatchers;
|
||||
import org.hamcrest.CoreMatchers;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.arm.wa.uiauto.ActionLogger;
|
||||
|
||||
// This class is responsible for actually running the UiAutomation
|
||||
// tests and measuring the frame metrics. It will be invoked directly
|
||||
// by workload-automation. We use an instance of UiAutomation so
|
||||
// things get setup properly (parameters, screen orientation etc).
|
||||
|
||||
public class UiAutomationJankTests extends JankTestBase {
|
||||
private static final int DEFAULT_BENCHMARK_REPEAT_COUNT = 1;
|
||||
private static final int DEFAULT_TIMEOUT = 1000;
|
||||
private static final int DEFAULT_BENCHMARK_FLING_SPEED = 5000;
|
||||
private static final String[] DEFAULT_BENCHMARK_TESTS
|
||||
= {"PortraitVerticalTest",
|
||||
"PortraitHorizontalTest",
|
||||
"LandscapeVerticalTest"};
|
||||
private static final String PACKAGE_NAME = "com.example.jetnews";
|
||||
private static final String LOG_TAG = "JetNewsJankTests: ";
|
||||
|
||||
private static final String MAIN_VIEW = "ArticlesMainScrollView";
|
||||
private static final String TOP_ARTICLE = "TopStoriesForYou";
|
||||
private static final String BOTTOM_ARTICLE = "PostCardHistory19";
|
||||
private static final String POPULAR_LIST = "PopularOnJetnewsRow";
|
||||
private static final String ARTICLE_VIEW = "ArticleHomeScreenPreview0";
|
||||
|
||||
private UiAutomation mUiAutomation;
|
||||
private int repeat;
|
||||
private int fling_speed;
|
||||
private String[] tests;
|
||||
private UiDevice mDevice;
|
||||
private boolean testPortraitVertical;
|
||||
private boolean testPortraitHorizontal;
|
||||
private boolean testLandscapeVertical;
|
||||
|
||||
@JankTest(
|
||||
expectedFrames = 100,
|
||||
defaultIterationCount = 1
|
||||
)
|
||||
|
||||
@GfxMonitor(processName = PACKAGE_NAME)
|
||||
public void test1() throws Exception {
|
||||
for (int i = 0; i < repeat; i++) {
|
||||
if (testPortraitVertical) {
|
||||
ActionLogger logger
|
||||
= new ActionLogger("PortraitVerticalTest",
|
||||
mUiAutomation.getParams());
|
||||
logger.start();
|
||||
runPortraitVerticalTests();
|
||||
logger.stop();
|
||||
}
|
||||
|
||||
if (testPortraitHorizontal) {
|
||||
ActionLogger logger
|
||||
= new ActionLogger("PortraitHorizontalTest",
|
||||
mUiAutomation.getParams());
|
||||
logger.start();
|
||||
runPortraitHorizontalTests();
|
||||
logger.stop();
|
||||
}
|
||||
|
||||
if (testLandscapeVertical) {
|
||||
ActionLogger logger
|
||||
= new ActionLogger("LandscapeVerticalTest",
|
||||
mUiAutomation.getParams());
|
||||
logger.start();
|
||||
runLandscapeVerticalTests();
|
||||
logger.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void runPortraitVerticalTests() throws Exception {
|
||||
// Scroll to the first postcard in the list.
|
||||
mDevice.wait(Until.findObject(By.res(MAIN_VIEW)), DEFAULT_TIMEOUT);
|
||||
UiObject2 articles = mDevice.findObject(By.res(MAIN_VIEW));
|
||||
ViewMatchers.assertThat(articles, CoreMatchers.notNullValue());
|
||||
|
||||
scrollTo(articles, BOTTOM_ARTICLE, true, TOP_ARTICLE,
|
||||
BOTTOM_ARTICLE, false, true, fling_speed);
|
||||
scrollTo(articles, TOP_ARTICLE, false, TOP_ARTICLE,
|
||||
BOTTOM_ARTICLE, false, true, fling_speed);
|
||||
|
||||
mDevice.click(articles.getVisibleCenter().x,
|
||||
articles.getVisibleCenter().y);
|
||||
|
||||
// Fling the article back and forth.
|
||||
UiObject2 article = mDevice.findObject(By.scrollable(true));
|
||||
|
||||
article.fling(Direction.DOWN, fling_speed);
|
||||
article.fling(Direction.UP, fling_speed);
|
||||
|
||||
// Go back to the main screen.
|
||||
mDevice.pressBack();
|
||||
}
|
||||
|
||||
private void runPortraitHorizontalTests() throws Exception {
|
||||
mDevice.wait(Until.findObject(By.res(MAIN_VIEW)), DEFAULT_TIMEOUT);
|
||||
UiObject2 articles = mDevice.findObject(By.res(MAIN_VIEW));
|
||||
ViewMatchers.assertThat(articles, CoreMatchers.notNullValue());
|
||||
|
||||
scrollTo(articles, TOP_ARTICLE, false, TOP_ARTICLE,
|
||||
BOTTOM_ARTICLE, false, true, fling_speed);
|
||||
scrollTo(articles, POPULAR_LIST, true, TOP_ARTICLE,
|
||||
BOTTOM_ARTICLE, false, true, 5000);
|
||||
|
||||
UiObject2 article = mDevice.findObject(By.res(POPULAR_LIST));
|
||||
article.fling(Direction.RIGHT,
|
||||
fling_speed > 10000? 10000 : fling_speed);
|
||||
article.fling(Direction.LEFT, fling_speed);
|
||||
scrollTo(articles, BOTTOM_ARTICLE, true, TOP_ARTICLE,
|
||||
BOTTOM_ARTICLE, false, true, fling_speed);
|
||||
}
|
||||
|
||||
private void runLandscapeVerticalTests() throws Exception {
|
||||
// Flip the screen sideways to exercise the other layout
|
||||
// of the Jetnews app.
|
||||
mDevice.setOrientationLandscape();
|
||||
mDevice.wait(Until.findObject(By.res(MAIN_VIEW)), DEFAULT_TIMEOUT);
|
||||
|
||||
UiObject2 articles = mDevice.findObject(By.res(MAIN_VIEW));
|
||||
ViewMatchers.assertThat(articles, CoreMatchers.notNullValue());
|
||||
|
||||
scrollTo(articles, BOTTOM_ARTICLE, true, TOP_ARTICLE,
|
||||
BOTTOM_ARTICLE, false, true,
|
||||
fling_speed);
|
||||
scrollTo(articles, TOP_ARTICLE, false, TOP_ARTICLE,
|
||||
BOTTOM_ARTICLE, false, true,
|
||||
fling_speed);
|
||||
|
||||
// Wait for the clicked article to appear.
|
||||
UiObject2 article = mDevice.wait(
|
||||
Until.findObject(By.res(ARTICLE_VIEW)),
|
||||
DEFAULT_TIMEOUT
|
||||
);
|
||||
|
||||
article.fling(Direction.DOWN, fling_speed);
|
||||
article.fling(Direction.UP, fling_speed);
|
||||
|
||||
mDevice.setOrientationPortrait();
|
||||
mDevice.pressBack();
|
||||
}
|
||||
|
||||
private void scrollTo(UiObject2 element,
|
||||
String resourceId, boolean downFirst,
|
||||
String beginningId, String endId, boolean sideways,
|
||||
boolean fling, int swipeSpeed) {
|
||||
// First check if the resource is in view. If it is, then just return.
|
||||
if (element.hasObject(By.res(resourceId))) {
|
||||
Log.d(LOG_TAG, "Object " + resourceId + " was already in view.");
|
||||
return;
|
||||
}
|
||||
|
||||
Direction direction;
|
||||
String markerId = downFirst? endId:beginningId;
|
||||
|
||||
if (sideways) {
|
||||
direction = downFirst? Direction.RIGHT:Direction.LEFT;
|
||||
}
|
||||
else {
|
||||
direction = downFirst? Direction.DOWN:Direction.UP;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
// Scroll to find the object.
|
||||
Log.d(LOG_TAG,
|
||||
"Object " + resourceId + " is not in view. Scrolling.");
|
||||
do {
|
||||
if (fling)
|
||||
element.fling(direction, swipeSpeed);
|
||||
else
|
||||
element.scroll(direction, 0.3f);
|
||||
|
||||
// If we found it, just return. Otherwise keep going.
|
||||
if (element.findObject(By.res(resourceId)) != null) {
|
||||
Log.d(LOG_TAG,
|
||||
"Object " + resourceId + " found while scrolling.");
|
||||
return;
|
||||
}
|
||||
|
||||
} while (!mDevice.hasObject(By.res(markerId)));
|
||||
|
||||
if (direction == Direction.DOWN)
|
||||
direction = Direction.UP;
|
||||
else if (direction == Direction.UP)
|
||||
direction = Direction.DOWN;
|
||||
else if (direction == Direction.RIGHT)
|
||||
direction = Direction.LEFT;
|
||||
else
|
||||
direction = Direction.RIGHT;
|
||||
|
||||
Log.d(LOG_TAG, "Reached the limit at " + markerId + ".");
|
||||
|
||||
if (markerId == beginningId)
|
||||
markerId = endId;
|
||||
else
|
||||
markerId = beginningId;
|
||||
}
|
||||
// We should've found it. If it is not here, it doesn't exist.
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
Log.d(LOG_TAG, "Initializing UiAutomation object.");
|
||||
mUiAutomation = new UiAutomation ();
|
||||
mUiAutomation.initialize_instrumentation();
|
||||
mUiAutomation.initialize();
|
||||
mUiAutomation.setup();
|
||||
|
||||
// Check the parameters and set sane defaults.
|
||||
mDevice = mUiAutomation.mDevice;
|
||||
Bundle parameters = mUiAutomation.getParams();
|
||||
|
||||
repeat = parameters.getInt("repeat");
|
||||
Log.d(LOG_TAG,"Argument \"repeat\": " + String.valueOf (repeat));
|
||||
if (repeat <= 0) {
|
||||
repeat = DEFAULT_BENCHMARK_REPEAT_COUNT;
|
||||
Log.d(LOG_TAG, "Argument \"repeat\" initialized to default: " +
|
||||
String.valueOf (DEFAULT_BENCHMARK_REPEAT_COUNT));
|
||||
}
|
||||
|
||||
fling_speed = parameters.getInt("flingspeed");
|
||||
Log.d(LOG_TAG,
|
||||
"Argument \"flingspeed\": " + String.valueOf (fling_speed));
|
||||
if (fling_speed <= 1000 || fling_speed >= 30000) {
|
||||
fling_speed = DEFAULT_BENCHMARK_FLING_SPEED;
|
||||
Log.d(LOG_TAG, "Argument \"flingspeed\" initialized to default: " +
|
||||
String.valueOf (DEFAULT_BENCHMARK_FLING_SPEED));
|
||||
}
|
||||
|
||||
String[] tests = parameters.getStringArray("tests");
|
||||
if (tests == null) {
|
||||
tests = DEFAULT_BENCHMARK_TESTS;
|
||||
Log.d(LOG_TAG, "Argument \"tests\" initialized to default: " +
|
||||
String.valueOf (DEFAULT_BENCHMARK_TESTS));
|
||||
}
|
||||
|
||||
Arrays.sort (tests);
|
||||
testPortraitVertical
|
||||
= Arrays.binarySearch(tests,
|
||||
"PortraitVerticalTest") >= 0? true : false;
|
||||
testPortraitHorizontal
|
||||
= Arrays.binarySearch(tests,
|
||||
"PortraitHorizontalTest") >= 0? true : false;
|
||||
testLandscapeVertical
|
||||
= Arrays.binarySearch(tests,
|
||||
"LandscapeVerticalTest") >= 0? true : false;
|
||||
|
||||
if (testPortraitVertical)
|
||||
Log.d(LOG_TAG, "Found PortraitVerticalTest");
|
||||
if (testPortraitHorizontal)
|
||||
Log.d(LOG_TAG, "Found PortraitHorizontalTest");
|
||||
if (testLandscapeVertical)
|
||||
Log.d(LOG_TAG, "Found LandscapeVerticalTest");
|
||||
}
|
||||
}
|
26
wa/workloads/jetnews/uiauto/build.gradle
Normal file
26
wa/workloads/jetnews/uiauto/build.gradle
Normal file
@ -0,0 +1,26 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:8.5.0'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register('clean', Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
55
wa/workloads/jetnews/uiauto/build.sh
Executable file
55
wa/workloads/jetnews/uiauto/build.sh
Executable file
@ -0,0 +1,55 @@
|
||||
#!/bin/bash
|
||||
# Copyright 2013-2024 ARM Limited
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
set -e
|
||||
|
||||
# CD into build dir if possible - allows building from any directory
|
||||
script_path='.'
|
||||
if `readlink -f $0 &>/dev/null`; then
|
||||
script_path=`readlink -f $0 2>/dev/null`
|
||||
fi
|
||||
script_dir=`dirname $script_path`
|
||||
cd $script_dir
|
||||
|
||||
# Ensure gradelw exists before starting
|
||||
if [[ ! -f gradlew ]]; then
|
||||
echo 'gradlew file not found! Check that you are in the right directory.'
|
||||
exit 9
|
||||
fi
|
||||
|
||||
# Copy base class library from wa dist
|
||||
libs_dir=app/libs
|
||||
base_class=`python3 -c "import os, wa; print(os.path.join(os.path.dirname(wa.__file__), 'framework', 'uiauto-androidx', 'uiauto.aar'))"`
|
||||
mkdir -p $libs_dir
|
||||
cp $base_class $libs_dir
|
||||
|
||||
# Build and return appropriate exit code if failed
|
||||
# gradle build
|
||||
./gradlew clean :app:assembleDebug
|
||||
exit_code=$?
|
||||
if [[ $exit_code -ne 0 ]]; then
|
||||
echo "ERROR: 'gradle build' exited with code $exit_code"
|
||||
exit $exit_code
|
||||
fi
|
||||
|
||||
# If successful move APK file to workload folder (overwrite previous)
|
||||
package=com.arm.wa.uiauto.jetnews
|
||||
rm -f ../$package
|
||||
if [[ -f app/build/outputs/apk/debug/$package.apk ]]; then
|
||||
cp app/build/outputs/apk/debug/$package.apk ../$package.apk
|
||||
else
|
||||
echo 'ERROR: UiAutomator apk could not be found!'
|
||||
exit 9
|
||||
fi
|
BIN
wa/workloads/jetnews/uiauto/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
wa/workloads/jetnews/uiauto/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
6
wa/workloads/jetnews/uiauto/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
6
wa/workloads/jetnews/uiauto/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
#Wed May 03 15:42:44 BST 2017
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip
|
160
wa/workloads/jetnews/uiauto/gradlew
vendored
Executable file
160
wa/workloads/jetnews/uiauto/gradlew
vendored
Executable file
@ -0,0 +1,160 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
esac
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||
function splitJvmOpts() {
|
||||
JVM_OPTS=("$@")
|
||||
}
|
||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
|
||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
90
wa/workloads/jetnews/uiauto/gradlew.bat
vendored
Normal file
90
wa/workloads/jetnews/uiauto/gradlew.bat
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windowz variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
goto execute
|
||||
|
||||
:4NT_args
|
||||
@rem Get arguments from the 4NT Shell from JP Software
|
||||
set CMD_LINE_ARGS=%$
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
5
wa/workloads/jetnews/uiauto/settings.gradle
Normal file
5
wa/workloads/jetnews/uiauto/settings.gradle
Normal file
@ -0,0 +1,5 @@
|
||||
plugins {
|
||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0'
|
||||
}
|
||||
|
||||
include ':app'
|
Loading…
x
Reference in New Issue
Block a user