ReleaseEngineering/Platforms/Android: Difference between revisions

Line 92: Line 92:


== AVD definition ==
== AVD definition ==
AVDs ("Android Virtual Devices") are directories full of disk images and config files stored in a user's AVD directory, typically <code>~/.android/avd/<i>avdname</i>.avd</code>
Each running emulator process during testing will have a separate AVD associated with it. When the emulator is invoked, you must pass the AVD name on the command line, such as <code>emulator -avd test-1</code>. Typically we make 4 AVDs called test-1, test-2, test-3, and test-4; then execute 4 emulator processes on the test host, each running a quarter of the testsuite.
Android SDKs do not ship with AVDs, but do ship with sufficient pieces to instantiate them easily. Unfortunately the AVDs that the SDK creates are based on disk images that contain either an ARMv5TE userspace or an x86 userspace. The SDK does not ship with disk images for an ARMv7a userspace, which is what we need to run ARMv6 and ARMv7a Firefox binaries. So we construct our own from AOSP source.
<b>NOTE:</b> AVDs do not fully self-identify their (sub-)architecture. In particular, when running an ARM AVD, one must guess at the correct CPU model to pass to the emulator command, as a startup argument to qemu. For ARMv7, typically <code>cortex-a8</code> or <code>cortex-a9</code> works. So the emulator should be invoked as <code>emulator -avd test-1 -qemu -cpu cortex-a8</code>
<b>NOTE:</b> OpenGL is emulated by serializing the GL command stream out of the emulator and applying it to host-side GL libraries, either software rendering or hardware. So it tends to run quite quickly, compared to the (emulated) CPU instructions. Unfortunately this host-GL-emulation technology was only developed in the Android 4.x SDK series timeframe. It was backported to the gingerbread branch, but it only exists on the symbolic branch name 'gingerbread', a development branch, not any of the specific releases in the android-2.3.x series. If you check out a 2.3.x series branch, you <b>will not be able to run firefox</b>. For this reason, the script below (for AVD-building) is somewhat forceful about trying to make you use the 'gingerbread' branch, unless you are absolutely certain you want a 2.3.x branch.
=== How to generate the AVD definitions ===
=== How to generate the AVD definitions ===
TODO: add info
 
* Start a new VM (AWS is easiest) running Ubuntu 12.04LTS x86_64
* Log in
* Ensure you have 30+GB of free space to work in
* Check out https://hg.mozilla.org/build/mozharness
* run <code>scripts/android_emulator_build.py</code> and wait several hours
* AVDs should (eventually) be built and left in <code>android_emulator_build/AVDs-*.tar.gz</code>
 
If anything goes wrong in the process (it's quite involved), the easiest solution is probably just to read the source of the script; it contains our best current understanding of how to build AVDs from AOSP sources. It also has quite a lot of options and can restart at particular steps, if part of the build fails.
 
== Deployment of artifacts ==
== Deployment of artifacts ==
* TODO: Link to how to deploy a new version of the Android SDK
* TODO: Link to how to deploy a new version of the Android SDK
37

edits