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: 300The
nameof the target consists of the platform which can be eitherLinuxorLinux_Android. It is better to pickLinux_Androidsince it will provide you more of the needed dependencies.The
recipeis alwaysdevicelab/devicelab_drone. This is the recipe that will launch the emulator and drive the test.presubmitcan betrueorfalse. 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.timeoutis an integer value.dimensionsis 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_typemust be set tononeso that we use a machine without an attached android phone. This will cause problems if not set.b.
task_nameis the name to apply to the task.c.
use_emulatoris the flag to tell the test recipe that we need to create an Emulator for this test.d.
dependenciescan be used to override theandroid_virtual_deviceapi version.e.
tagsshould be set todevicelabandlinuxf.
timeoutthe 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
dimensionsfield 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.