From ad1c5237bb106bec3e46437420e60ed9afadfaeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-Cl=C3=A9ment=20Tosi?= Date: Mon, 20 May 2019 17:59:01 +0100 Subject: [PATCH 1/2] ApkWorkload: Support implicit activity path If the activity field of an instance of ApkWorkload does not the '.' character, it is assumed that it is in the Java namespace of the application. This is similar to how activities can be referred to with relative paths: com.domain.app/.activity instead of com.domain.app/com.domain.app.activity --- wa/framework/workload.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wa/framework/workload.py b/wa/framework/workload.py index a56091590..e2a32fe0e 100644 --- a/wa/framework/workload.py +++ b/wa/framework/workload.py @@ -257,6 +257,12 @@ def __init__(self, target, **kwargs): raise ConfigError('Target does not appear to support Android') super(ApkWorkload, self).__init__(target, **kwargs) + + if self.activity is not None and '.' not in self.activity: + # If we're receiving just the activity name, it's taken relative to + # the package namespace: + self.activity = '.' + self.activity + self.apk = PackageHandler(self, package_name=self.package_name, variant=self.variant, From e0d3a49645b7aa1c11e914c79ba245965919fa13 Mon Sep 17 00:00:00 2001 From: Pierre-Clement Tosi Date: Wed, 12 Dec 2018 16:19:46 +0000 Subject: [PATCH 2/2] workloads/uibench: Initial commit Add support for Android's UIBench suite of tests as a WA workload. --- wa/workloads/uibench/__init__.py | 52 ++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 wa/workloads/uibench/__init__.py diff --git a/wa/workloads/uibench/__init__.py b/wa/workloads/uibench/__init__.py new file mode 100644 index 000000000..b32e010da --- /dev/null +++ b/wa/workloads/uibench/__init__.py @@ -0,0 +1,52 @@ +# Copyright 2013-2019 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 Parameter, ApkWorkload + + +class Uibench(ApkWorkload): + + name = 'uibench' + description =""" + Runs a particular activity of the UIBench_ workload suite. The suite + is provided by Google as a testbench for the Android UI. + + .. _UIBench: https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/tests/UiBench/ + """ + package_names = ['com.android.test.uibench'] + loading_time = 1 + + parameters = [ + Parameter('activity', kind=str, + description=""" + The UIBench activity to be run. Each activity corresponds to + a test. If this parameter is ignored, the application is + launched in its main menu. Please note that the available + activities vary between versions of UIBench (which follow + AOSP versioning) and the availability of the services under + test may depend on the version of the target Android. We + recommend using the APK of UIBench corresponding to the + Android version, enforced through the ``version`` parameter to + this workload. + """), + Parameter('duration', kind=int, default=10, + description=""" + As activities do not finish, this workload will terminate + UIBench after the given duration. + """), + ] + + def run(self, context): + super(Uibench, self).run(context) + self.target.sleep(self.duration)