Appearance
Testing on Emulators in the Devicelab
While the Devicelab is typically for testing on Devices we have added support so that developers can now test Android changes via the LUCI recipes on an Android Emulator.
You can specify a new test via the .ci.yaml file in the repository. This allows the infra framework to run the test automatically with minimal work from the developer.
Adding a Brand New Target
Adding a new Devicelab Android Emulator test for Android feature changes requires the following steps:
Starting with the finished target yaml definition:
- name: Linux_android android_defines_test
recipe: devicelab/devicelab_drone
presubmit: true
timeout: 60
dimensions: {
kvm: “1”,
cores: “8”,
Machine_name: “n1-standard-8”
}
properties:
device_type: “none”
task_name: android_defines_test
use_emulator: “true”
dependencies: >-
[
{"dependency": "android_virtual_device", "version": "31"}
]
tags: >
["devicelab", “linux”]
timeout: 300
The
name
of the target consists of the platform which can be eitherLinux
orLinux_Android
. It is better to pickLinux_Android
since it will provide you more of the needed dependencies.The
recipe
is alwaysdevicelab/devicelab_drone
. This is the recipe that will launch the emulator and drive the test.presubmit
can betrue
orfalse
. To run the test in any PR that is opened you should set this totrue
. This is the best approach to catch bugs before they are mirrored to google3.timeout
is an integer value.dimensions
is needed to tell the LUCI framework that we need to run this test on a machine that supports nested virtualization and should be set as shown.properties
:a.
device_type
must be set tonone
so that we use a machine without an attached android phone. This will cause problems if not set.b.
task_name
is the name to apply to the task.c.
use_emulator
is the flag to tell the test recipe that we need to create an Emulator for this test.d.
dependencies
can be used to override theandroid_virtual_device
api version.e.
tags
should be set todevicelab
andlinux
f.
timeout
the timeout here is for the time to give the test to run before killing it.
Updating an Existing Target
If you want to update an existing target you will only need to add the following changes:
- add a
dimensions
field as described above. - Set the
device_type: "none"
. - Add
use_emulator: "true"
flag in properties. Note this is not a boolean but must be a string. - Add a dependency for the android emulator version to the properties. If there are no dependencies add it as shown above.
- Remove any tags that specify android. These are for benchmark tests and having them in will cause some of the device checks to fail.