1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2024-10-06 10:51:13 +01:00
Commit Graph

186 Commits

Author SHA1 Message Date
Marc Bonnici
3a9505d54e revent: Removed redundant android code 2016-09-30 14:25:11 +01:00
setrofim
77d724efa3 Merge pull request #258 from ep1cman/install_fix
ApkWorkload: Fixed replacing apps on a device
2016-09-26 17:00:39 +01:00
Sebastian Goscik
acb9dd61e7 ApkWorkload: Fixed replacing apps on a device
Previously if trying to downgrade an app using the `-r` option of
`adb install` the `INSTALL_FAILED_VERSION_DOWNGRADE` error would occur.
The app is now uninstalled first to prevent this.
2016-09-26 16:53:03 +01:00
Marc Bonnici
1c8e18bf36 ReventWorkload:Fixed revent workloads with multiple iterations
Since initilize only runs once per workload, we can't set variables required
for each iteration in initilize. Revent workload was setting its file paths
in initilize, now moved to setup.
2016-09-22 11:26:25 +01:00
Sebastian Goscik
486ade6499 ApkWorkload: Reworked APK Resolution.
APK Resolution is now handled a bit differently to try maximise the likelyhood
of a workload running.

Like before `force_install` will always try to install the host version, if it
is not present or is not a correct version, it will error.

`check_apk` has changed so that when it is `True` it will prefer to use the host
side APK. If it is not there, or not a suitable version and/or abi and the target
already has a correct version of the app, the target app will be used. When it is
to `False` WA will prefer the target version of the app so long as it is a valid
version, if it is not then it will fallback to the host side APK.
2016-09-20 10:47:57 +01:00
Sebastian Goscik
9afe084f2c Merge pull request #243 from setrofim/master
Miscellaneous fixes
2016-09-13 10:26:51 +01:00
Sergei Trofimov
ea1d13c37f common/android: pep8 fixes
- added missing space between global definitions and a class
- added missing space for inline comment
2016-09-13 10:22:47 +01:00
muendelezaji
f6b8fd3f4b Ignore exception for non-fatal permission grant failure 2016-09-09 23:22:38 +01:00
muendelezaji
9376c6875b ApkWorkload extension support
- Allow disabling main activity launch in setup (required for some apps)
- Parameterise clear data on reset (default behaviour unchanged)
2016-09-07 16:45:07 +01:00
Sebastian Goscik
38a7e01e83 Workloads: Fixed issues with calling super
Super works by having a iterator of parent classes to ensure each is called
once and only once. WA calls some parent methods in classes with multiple
inheritenceconditionally so calls them directly instread. This breaks super
which ends up calling some methods multiple times.

To work around this until workloads are reworked to use composition rather than
inheritance, all classes that that subclass `Workload` directly no longer use
`super`.
2016-09-06 10:11:09 +01:00
setrofim
3d610788a3 Merge pull request #238 from jimboatarm/check_app_version_uxperf
Add check_app_version method to ApkWorkload
2016-09-02 11:59:08 +01:00
John Richardson
1986511ae8 Add check_app_version method to ApkWorkload
Implement new method to enforce that a valid apk version is used to run
the workload. Based on a min and max range of apk versions tested
during development.
2016-09-02 11:56:40 +01:00
muendelezaji
392a3f1600 Add network check methods to Device and Workload classes
- Device subclasses should provide their own implementation.
    Default behaviour is to raise a `NotImplementedError`
  - Workload subclasses can set `requires_network` to `True` and
    network connectivity check will be performed during `setup()`
2016-09-02 10:33:18 +01:00
John Richardson
502b0ed4b3 Add package name to uiautomator params in AndroidUxPerfWorkload
The package name is common to all workloads that inherit from this
class and is used when locating UI elements.
2016-08-31 14:44:21 +01:00
John Richardson
cab9d918ab Move uiautomator params in AndroidUxPerfWorkload
uiautomator parameters are set per instance of a workload and not per
iteration. Move uiautomator parameter assignment from setup() to
validate().
2016-08-31 14:43:33 +01:00
John Richardson
b510b31052 Add broadcast_media_mounted method to android device
New method to force a re-index of the mediaserver cache for the
specified directory. Used in workloads that require external media files
as dependencies.
2016-08-31 10:24:06 +01:00
Sebastian Goscik
0a2afdfd84 AndroidDevice: Added -rf to delete_files
This allows it to delete folders and makes it consistend with LinuxDevice.
2016-08-26 17:13:21 +01:00
John Richardson
67f418f79f Add new AndroidUxPerfWorkload class
Create a new workload class to encapsulate functionality common to all
uxperf workloads.
2016-08-26 12:22:39 +01:00
Sebastian Goscik
f57dd83d1a pylint fixes 2016-08-25 14:20:10 +01:00
Sebastian Goscik
07d34e5615 ApkWorkload: Moved APK resolution into setup
Previously if you had multiple versions of the same workload in one
agenda only the first one would work, the others would fail to find
their APK.
2016-08-24 14:28:53 +01:00
John Richardson
86f3066f56 Add unsupported package check to AndroidUiAutoBenchmark
Add method to automatically check against a dictionary of known package
versions that don't work well with AndroidUiAutoBenchmark workloads.
Raises an exception if found.
2016-08-09 12:08:28 +01:00
John Richardson
25172fb027 Add UxPerfUiAutomation class
UxPerfUiAutomation contains methods specific to UX performance testing.
2016-08-09 09:56:04 +01:00
setrofim
1ec7961b0e Merge pull request #210 from drcef/master
Implemented visual state detection functionality for revent workloads
2016-08-05 11:57:59 +01:00
George Psimenos
01f2a5f412 Implemented visual state detection functionality for revent workloads
- Added statedetect.py in utils which is a standalone module that
    contains all the methods needed for state detection

  - Modified the setup() and run() methods of the GameWorkload class
    in common/android/workload.py to have a parameter that enables
    state checks and run the check after setup and run if requested.

State detection uses the template matching method available in
OpenCV to determine the state of the workload by detecting
predefined unique elements on a screenshot from the device.
2016-08-05 10:09:18 +01:00
John Richardson
0945dd6ba4 Dump hierarchy view on error
Dump window hierarchy view from uiautomator to a file when WA fails
during execution. Note: the xml file are pre-formatted after dump.
Implementation specific to android.device.
2016-08-02 16:47:24 +01:00
muendelezaji
efae2e8c32 Android permission grant for API 23 and above
Issue: On some devices, _grant_requested_permissions may throw an
error when trying to grant permissions that were already granted
at install time using 'adb install -g'.

Fix: Surround permission grant method for API 23+ with try/except

Issue: Currently, _grant_requested_permissions skips all lines after
the first line not starting with 'android.permission'. This causes
a problem for apps where some required permissions appear after a
non-matching line e.g. Google Slides.

Fix: Don't break on non-matching line until end of section is reached
2016-07-29 16:27:29 +01:00
Sebastian Goscik
d87e425c24 Merge pull request #214 from jimboatarm/network_check_uxperf
Add network connectivity check for devices
2016-07-27 11:59:57 +01:00
John Richardson
2872080d1a Add network connectivity check for devices
Add a general check that pings a IP address rather than checking the
status of dumpsys wifi due to the fact that not all devices are
connected via wifi. Intended for workloads that require an internet
connection to operate.
2016-07-26 16:30:06 +01:00
John Richardson
2208d45bfb Add further convenience methods to BaseUiAutomation
Convenience methods to make it easier to get UiObjects and perform
UiDevice based gestures and operations.
2016-07-26 10:34:04 +01:00
Sebastian Goscik
9707aa6237 Pylint fixes
Pylint now checks for trailing new lines, this commit fixes them.
2016-07-21 16:40:26 +01:00
Sebastian Goscik
54c409ce6f revent: Fixed magic check
A null character was not being added to the end of the string.
2016-07-21 15:42:11 +01:00
Sebastian Goscik
164f207084 revent: Timeout is now based on recording duration
The revent file is now parsed and the duration of the recording is calculated.
This duration + 30 seconds is now used for the timeout for revent.
2016-07-19 16:48:13 +01:00
Sebastian Goscik
139a0698c9 revent: Added "magic" and file version to revent files.
revent files should now start with "REVENT" followed by the file format
version.
2016-07-19 16:48:13 +01:00
John Richardson
c49c5c4121 Add per-action instrumentation for UX performance
- Implement a new Marker API in BaseUiAutomation so workload can
  generate start and end markers with string name. Outputs to logcat.

- Document the Marker output log format in the WA documentation

- Create a results processor to take existing instrument fps logs and
  parse them based on the workload markers. Produce per-action fps
  metrics.

- Add simple timing results based on the workload markers
2016-07-14 13:49:39 +01:00
muendelezaji
bb33123b17 Check APK version and ABI when installing
- Check the APK's versionName property against the workload's
  expected version if specified
- If workload specifies check_abi param, try to get APK from
  ABI-specific path on the host
- Add variant_name param to APK resource-getter for backwards
  compatibility of dex2oat and peacekeeper
2016-07-12 17:02:17 +01:00
muendelezaji
fab6a977aa Properly replace APK during adb install
Issue: For certain installation errors, it is possible for WA to
 incorrectly report that an APK was reinstalled while it actually
 wasn't, leading to bugs later on in the run.

Fix:
 - Add the '-r' flag to adb install when reinstalling, to make sure
   APK is replaced.
 - Add '-g' flag for API 23 and higher, to grant all permissions that
   would otherwise be requested at runtime (similar to pre-API 23)
2016-07-12 13:08:28 +01:00
Sergei Trofimov
5a780e8211 file_poller: fixed validation with Linux devices
- device.is_rooted check was being perfromed inside validate() which
  gets invoked before the device is connected. This worked for most
  Android devices, because connections is a no-op for them, however
  failed for Linux targets. The check is now performed inside
  initialize().
- Added _is_ready() check inside is_rooted to catch similar problems
  quicker in the future.
2016-07-11 13:23:15 +01:00
Sebastian Goscik
77a44f11c6 AndroidDevice & BaseLinuxDevice: minor parameter changes
Moved ``working_directory`` parameter to BaseLinuxDevice.

Changed the default ``binaries_directory`` for AndroidDevice to allow
WA binaries to be easily separated.
2016-06-21 14:55:02 +01:00
Sebastian Goscik
18d1f9f649 ReventWorkload: Now kills all revent instances on teardown
Previously revent would be left running if a run was aborted.
2016-06-01 16:47:01 +01:00
Sebastian Goscik
17ce8d0fe9 Revent: Device model name is now used when searching for revent files
Previously the WA device name was used when searching for revent files.
Since most were `generic_android` this made it difficult to keep revent
files for multiple android devices. Now it the device model is used instead.

If a file with the device model is not found it will fall back to the WA
device name.
2016-06-01 16:47:01 +01:00
Sebastian Goscik
8bdffe6f9c LinuxDevice: Removed has_root method
Was not used anywhere and is_rooted should be used instead
2016-06-01 14:13:37 +01:00
Sebastian Goscik
2ff13089fd LinuxDevice: kick_off & killall will now run as root on rooted devices by default
kick_off has been changed to behave the same as AndroidDevice.

Said changes caused kill all to fail on rooted devices. Killall will now
behave in the same way as kick_off, if specifically told to (or not to)
run as root it will. Otherwise it will run as root if the device is rooted
2016-06-01 13:50:59 +01:00
Sebastian Goscik
0d50fe9b77 AndroidDevice: kick-off no longer requires root
kick off will now use root if the device is rooted or if manually
specified otherwise its run without root.
2016-05-26 10:29:21 +01:00
Sebastian Goscik
17fe6c9a5b AndroidDevice: Improved gathering of build props
These are now gathered via `getprop` rather than trying to parse the
build.prop file directly.

This fixes issues with build.prop files that have imports.
2016-05-24 12:55:33 +01:00
Sebastian Goscik
46cd26e774 BaseUiAutomation: Added functions for checking version strings
Added splitVersion and compareVersions functions allow versions strings
like "3.2.045" to be compared.

Also fixed the build script to now copy to the correct folder
2016-05-16 17:22:09 +01:00
Sebastian Goscik
544c498eb6 UiAutomatorWorkload: Added quotes around uiautomator parameters
Some characters would be interpreted by the shell thus breaking the
command. Adding quotes around the parameters solved this.

N.B Space still needs to be replaced.
2016-05-16 16:19:57 +01:00
Sebastian Goscik
ef61f16896 AndroidDevice: Fixed screen lock disable
Due to the previous commits, this command no longer works properly.

It turns out there is an issue with using multiple levels of escaping.
It seems that bash handles the backslashes and single quotes separately
incorrectly processing our escaping. To get around this we are writing the
sqlite command to a shell script file and running that.

This seems to be the only case in WA at the moment that requires this,
if more show up/when WA moves to devlib it should use the devlib shutil
mechanism.
2016-05-10 09:27:42 +01:00
Sebastian Goscik
59cfd7c757 AndroidDevice: WA now pushes its own sqlite3 binary
Some device have the sqlite3 binary removed. WA will now check for
this and push its own binary if necessary.
2016-05-09 17:31:09 +01:00
Sebastian Goscik
d3c7f11f2d AndroidDevice: Changed kick_off signature to match BaseLinuxExamples 2016-05-09 17:06:08 +01:00
Sergei Trofimov
697aefc7bb ApkWorkload: clear app data on failed uninstall.
If uninstall fails, "pm clear" should be called to make sure that the
next time the app is launched it starts from a known state (which would
normally be ensured by the uninstall).
2016-04-19 16:43:42 +01:00
Sergei Trofimov
8bc71bb810 ApkWorkload: report correct apk verison on failed install
It's possible that there is already a version of an app on target that
differs form the version of the apk on the host. In such cases, WA will
usually try to uninstall the target version and install the host
version.

It's possible that the uninstall may fail. If that happens, it will be
reported as a warning but workload exectuion will proceed with the
target version. In this case, apk_version would have already been set to
that of the host apk. This change ensures that the APK version is
correctly set to the target version (the one that actually ran).
2016-04-19 16:33:37 +01:00
Sergei Trofimov
48259d872b ApkWorkload: add package verison to the result as a classifer. 2016-04-14 11:23:39 +01:00
setrofim
9ee1666a76 Merge pull request #131 from ep1cman/master
SysfsExtractor & Busybox fixes
2016-04-07 10:31:31 +01:00
Sebastian Goscik
8dcdc9afe1 busybox: Rebuilt busybox binaries to prefer applets over system binaries
Busybox will now prefer to use its own built in applets before it tries
using the system binaries so that we are always running commands as expected.
2016-04-07 10:29:13 +01:00
Sebastian Goscik
507090515b Merge pull request #134 from jimboatarm/master
Fix to install APKs with whitespace in their path name
2016-04-06 10:56:58 +01:00
James Hartley
1dfbe9e44c Fix to install APKs with whitespace in their path name 2016-04-06 10:53:08 +01:00
Sergei Trofimov
391b0b01fc pylint/pep8 fixes
- android/workload: emoved an extra bank line between methods
- trace_cmd: define member attribute inside __init__
- adb_shell: ignore pylint warning about too many branches in this case
2016-04-05 11:36:39 +01:00
James Hartley
ff5f48b7e7 Fix for packages without launch activities
If the package has no defined launch activity you must call the
activity manager in a different way.
2016-04-05 10:24:42 +01:00
Sebastian Goscik
a2257fe1e2 BaseLinuxDevice: gzipped property files are now zcat'ed
Before they were cat'ed this gave garbage output for compressed files.
Cat-ing is necessary since not all properties are normal files (sysfs).
2016-03-24 16:28:19 +00:00
Sergei Trofimov
203a3f7d07 LinuxDevice: fixed reboot.
- Deal with the dropped connection on issuing "reboot"
- Introduced a fixed initial delay before polling for connection to
  avoid re-connecting to adevice that is still in the process of
  shutting down.
2016-02-22 09:45:42 +00:00
Sebastian Goscik
de021da300 ApkWorkload: Fixed runtime permission granting
"Normal" android permissions are automatically granted and cannot
be changed. Trying to "pm grant" these caused an error, this should
no longer occur.
2016-02-15 11:38:28 +00:00
Sebastian Goscik
5203188d9e LinuxDevice: Added as_root to kick_off 2016-02-12 09:54:14 +00:00
Sebastian Goscik
dec574e59e AndroidDevice: Removed duplicate parameter 2016-02-03 15:06:00 +00:00
Sergei Trofimov
eaabe01fa5 BaseLinuxDevice: added insmod() method.
Allows insting a kernel module on the target from a .ko located on the
host.
2016-01-27 17:15:41 +00:00
Sergei Trofimov
dc07c8d87e BaseLinuxDevice: added lsmod() method
Execute lsmod on the target device and parses the output into named
tuples.
2016-01-27 16:50:29 +00:00
Sebastian Goscik
1e6eaff702 revent: Added record and replay commands
Added two commands to WA to record and replay input events using revent.

As part of this also added the ability to get a device model from
android and linux device. This may need to be improved in the future.
2016-01-22 10:40:03 +00:00
Sebastian Goscik
7c35c604f4 BaseLinuxDevice: Tidied up the way binaries are handled
Added:
get_binary_path: Checks binary_directory for the wanted binary, if
                 if its not there, it will use which to find a
                 system one. returns the full path

install_if_needed: will install a binary only if it is not present.

Changes:
 - Busybox is now deployed to non-rooted devices
 - is_installed has now been removed as the new functions supersede it
 - binaries will now always be installed to `binaries_directory` and
   not system folders.
 - updated workloads to use these new functions
   - rt-app and sysbench might still need work
2016-01-19 10:45:09 +00:00
Sebastian Goscik
d9c4063307 AndroidDevice: fixed get_pids_of
As of Android M ps can no longer filter by process name. This is
now handled using grep from busybox
2016-01-13 17:07:30 +00:00
Sebastian Goscik
f1bb44b3e7 ApkWorkload: Added automatic granting of runtime permissions
As of Android 6.0, apps can request permissions at runtime. If the
target device is running Android 6.0+ these permissions are now automatically
granted.
2016-01-11 13:58:38 +00:00
Sergei Trofimov
438e18328d AndroidDevice: remove unnecessary escapes from update locksettings command
The single quotes will be escaped further down the command processing
chain.
2015-12-15 09:52:46 +00:00
setrofim
9222257d79 Merge pull request #67 from ep1cman/recentfling
Recentfling
2015-12-11 11:06:45 +00:00
Sebastian Goscik
d3470dca73 AndroidDevice: Fixed swipe_to_unlock
Previously swipe_to_unlock was not used and conflicted with a method
of the same name.

 - swipe_to_unlock() renamed perform_unlock_swipe()
 - swipe_to_unlock parameter now takes a direction, this allows swipe unlocking on Android M devices
 - ensure_screen_is_on() will now also unlock the screen if swipe_to_unlock is set
2015-12-11 10:58:32 +00:00
Sascha Bischoff
72a617c16d Gem5Device: Remove the rename in pull_file to align with gem5 2015-12-10 11:09:42 +00:00
Sascha Bischoff
d6355966bf Gem5Device: Removed unused methods 2015-12-10 11:09:42 +00:00
Sascha Bischoff
9ccf256ee8 AndroidDevice: Use content instead of settings to get ANDROID_ID
We move from using settings to using content to get the ANDROID_ID as
this works across a wider range of Android versions.
2015-12-10 11:09:42 +00:00
Sascha Bischoff
e7c75b2d3b Gem5: Add support for deploying the m5 binary 2015-12-10 11:09:41 +00:00
Sascha Bischoff
480155fd8c Gem5Device: Try to connect to the shell up to 10 times 2015-12-10 11:09:41 +00:00
Sascha Bischoff
d98bdac0be Gem5Device: Move resize shell commands to own method
Moved the commands to resize the shell to their own method. They are
now executed twice. Once as soon as the shell is connected, and a
second time as part of initialize. This latter call takes place after
the isntallation of busybox.
2015-12-10 11:09:41 +00:00
Sascha Bischoff
32cf5c0939 Gem5Device: Removed busybox dependency. 2015-12-10 11:09:41 +00:00
Sebastian Goscik
bef8fb40ef Updated pylint for v1.5.1
Fixed WA for the latest version of pylint (1.5.1)
2015-12-09 16:52:39 +00:00
Sergei Trofimov
344bc519c4 AndroidDevice: fixing get_properites to refer to self.device
This is a fix to the previous fix
(2510329cdf) that updated get_properties
to store "dumpsys window" output relative to the working_directory. That
commit constructed the path using self.device, which is wrong, as in
this case self itself is the device.
2015-12-08 11:26:56 +00:00
Sascha Bischoff
c6e712d44c Gem5Device: simplfy if statement based on pylint recommendation 2015-12-01 18:23:26 +00:00
Sascha Bischoff
00c9bdc2a6 Gem5Device: Fix runtime error caused by lack of kwargs 2015-12-01 18:23:26 +00:00
Sergei Trofimov
c02a1118d7 BaseLinuxDevice: list_file_systems() now handles blank lines
mount() may return an empty line at the end of the output; this update
handles that.
2015-11-24 15:50:38 +00:00
Sascha Bischoff
c533da3f38 Gem5Device: Fix issue with init arguments
- This patch addresses an issue with the arguments passed the
  BaseGem5Device __init__. With this patch these are no longer passed
  in as they are not required in the base device implementation.
2015-11-20 13:10:35 +00:00
Sergei Trofimov
2510329cdf AndroidDevice fix: create dympsys file relative to working directory on target.
Commit 95f17702d7 redirected output of
"dumpsys window" to a file (needed for Gem5 support). However, the file
was created in $PWD, which breaks on production devices, as that
location is not writable. This moves the file under the working
directory on the device.
2015-11-16 13:09:28 +00:00
Sergei Trofimov
2e5b3671e9 LinuxDevice fix: do not invoke super's hard_reset()
as it does not have one...
2015-11-16 12:43:52 +00:00
Sascha Bischoff
a447689a86 Gem5Device: Refactor into BaseGem5Device, Gem5LinuxDevice and Gem5AndroidDevice
- Refactored the Gem5Device to avoid duplicated code. There is now a
  BaseGem5Device which includes all of the shared functionality. The
  Gem5LinuxDevice and the Gem5AndroidDevice both inherit from
  BaseGem5Device, and LinuxDevice or AndroidDevice, respectively.
2015-11-13 14:19:24 +00:00
Sascha Bischoff
95f17702d7 AndroidDevice: Move the processing of Android properties to an internal method
- Move the processing of Android properties to an internal
  method. This allows the Android properties to be extracted without
  extracting those of the Linux device.

- Redirect the output from 'dumpsys window' to a file and pull the
  file as opposed to extracting the output from the terminal. This is
  more reliable in the event that another process writes to the shell.
2015-11-11 16:45:01 +00:00
Sergei Trofimov
20a5660ea1 android device: always deploy busybox on rooted devices. 2015-10-19 13:40:50 +01:00
Sergei Trofimov
552ea2a1bb fix: moving is_file and is_directory into BaseLinuxDevice, as relied on by get_properties. 2015-10-05 16:30:33 +01:00
Sergei Trofimov
fe4d49e334 android device: added swipe-to-unlock option 2015-10-01 12:06:02 +01:00
Sergei Trofimov
b6442acf80 device: more reliable get_properites
Pulling entries from procfs does not work on some platforms. This commit
updates get_properites() to cat the contents of a property_file and
write it to output file on the host, rather than pulling it (directories
are still pulled).
2015-09-30 12:39:49 +01:00
Sergei Trofimov
5abb42eab9 Do not attempt to get_sysfile_value() as root on unrooted devices. 2015-09-18 09:33:17 +01:00
Sergei Trofimov
205934d55b juno: use bootargs on hard_reset with u-boot 2015-08-17 14:36:28 +01:00
Sergei Trofimov
b5d879a90b APK workloads: added an option to skip host-side APK check entirely. 2015-07-27 09:55:23 +01:00
Sergei Trofimov
d2dbc9d6dd Added the ability to override the timeout of deploying the assets tarball in GameWorkload 2015-07-16 16:53:35 +01:00
Sergei Trofimov
b8e25efdd4 ssh: attempt to deal with dropped connections 2015-07-10 11:44:01 +01:00
Sergei Trofimov
30bb453747 gaming workloads: added an option to prevent clearing of package data before execution 2015-07-01 16:17:39 +01:00
Sergei Trofimov
4904c6cf71 listdir on Linux: return empty list for an empty directory
Previously, was returning a list with a single empty string element
2015-06-29 11:28:47 +01:00