Closed Bug 1062365 Opened 10 years ago Closed 10 years ago

Investigate Android 4.3/4.4 emulator test setup

Categories

(Testing :: General, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: gbrown, Assigned: gbrown)

References

Details

Attachments

(5 files)

I recently tried running tests against an Android 4.4 (arm) emulator. I'm not sure I'll pursue this, but here are some notes on my experience...
1. Create one master AVD. This step need not be run on a test slave. It can be run on any computer that has the Android SDK installed. - Install the Android SDK if not already available. See http://developer.android.com/sdk/index.html - Run "android" from <android sdk>/tools/android -- this brings up a UI for the "Android SDK Manager". - In the Android SDK Manager, verify that an option for "Android 4.4.2 (API 19)" is available and has installed components: -- "SDK Platform" -- "ARM EABI v7a System Image" - In the Android SDK Manager, select "Tools" > "Manage AVDs" to launch the "Android Virtual Device Manager" - In the Android Virtual Device Manager, on the "Device Definitions" tab, select "New Device..." and on the "Create New Device" dialog enter: -- Name: mozilla-device -- Input: Keyboard -- checked -- RAM: 1024 MiB -- Resolution: 1024 x 816 -- Screen size (in): 7 -- Density: mdpi - Save this device definition. - In the Android Virtual Device Manager, on the "Android Virtual Devices" tab, select "New..." and enter: -- AVD Name: test-arm442 -- Device: mozilla-device -- Target: Android 4.4.2 - API Level 19 -- CPU: ARM (armeabi-v7a) -- RAM: 1024 -- VMHeap: 64 -- Internal Storage: 500 -- SDCard: 500 -- Use Host GPU: checked - Select OK twice to accept the settings and create the AVD. (This may take a minute.) - Exit the Android Virtual Device Manager. - Exit the Android SDK Manager. 2. Customize the master AVD. Execute this procedure on the same computer as step 1. Here we pre-install SUTagent and Watcher and customized su. - obtain an appropriate arm build of su, either from orangutan (https://github.com/wlach/orangutan), or an existing build - download an appropriate tests zip - extract the bin directory from the tests zip to obtain the necessary apks - launch the emulator with the new AVD, created in step 1 (either ensure that the android sdk emulator is in your PATH, or specify the path): -- emulator -avd test-arm442 -partition-size 1024 - wait for the emulator to start (it may take a few minutes) - when the Android welcome screen is displayed, click OK - over-write /system/xbin/su: -- adb -e shell mount -o remount,rw /system -- adb -e push su /system/xbin -- adb -e shell chmod 6755 /system/xbin/su -- adb -e shell ls -l /system/xbin/su --- expect: -rwsr-sr-x root root 17748 2013-09-19 17:48 su -- adb -e shell mount -o remount,ro /system - install the apks: -- adb -e install Watcher.apk -- adb -e install sutAgentAndroid.apk - verify correct installation by starting Watcher and SUTAgent manually (click on the application icons) - with the emulator still running, find the system image on the computer, typically /tmp/android-{user}/emulator-{xxxxxx} and make a temporary copy of it -- cp /tmp/android-mozdev/emulator* /tmp/system.img - close the emulator - move the temporary copy of the system image to the avd: -- mv /tmp/system.img ~/.android/avd/test-arm442.avd - launch the emulator again to update the path and size of the system.img in the avd ini files: -- emulator -avd test-arm442 - wait for the emulator to start, then close the emulator
A significant concern is the operation of sutagent in the presence of new-ish Android security measures. Instead of "adb install sutAgentAndroid.apk" I also tried copying sutAgentAndroid.apk to /system/priv-app (remount /system rw, copy, remount ro, copy system.img as above). sutagent started fine and seemed to work better, but still failed to kill fennec: $>kill org.mozilla.fennec_gbrown ##AGENT-WARNING## Unable to kill org.mozilla.fennec_gbrown (couldn't kill org.mozilla.fennec_gbrown) $>execsu kill 919 sh: kill: 919: Operation not permitted return code [1] $>execsu pwd / return code [0] $>execsu id uid=10053(u0_a53) gid=10053(u0_a53) groups=1015(sdcard_rw),1028(sdcard_r),3001(net_bt_admin),3002(net_bt),3003(inet),50053(all_a53) context=u:r:untrusted_app:s0 return code [0] $>
Assignee: nobody → gbrown
Possibly relevant info: http://su.chainfire.eu/#selinux-what http://stackoverflow.com/questions/19868138/aosp-privileged-vs-system-app I tried running emulator -selinux permissive -- that did not help, and seemed to make the emulator unstable. I tried "-selinux disabled" too, but that crashed the emulator on startup.
More background on security enhancements http://seandroid.bitbucket.org/index.html
Depends on: 1084473
Consider some trivial configuration changes here in support of bug 824748: Use a different resolution, orientation, hardware keys than currently used for Panda or Android 2.3.
I intend to renew my efforts here in January. :wlach and others suggested today that we should abandon sutagent on 4.4 and rely on adb instead -- that may be the best way forward.
Lessons from bug 989343 (2.3 avds): - enable dpad and keyboard input, so that the emulator is more usable when the avds are used for local debugging - ensure /data/anr exists - check camera settings - disable background data - https://bugzilla.mozilla.org/show_bug.cgi?id=1004682#c4
Depends on: 1122317
Depends on: 1123443
(In reply to Geoff Brown [:gbrown] from comment #8) > We can telnet to the emulator on 5554, but adb replies with "device offline". The emulator was not starting up, because the emulator on aws under /tools/android-sdk18 is too old (22.0.5; we need 22.3 or newer for Android 4.4). I am trying to work around that. The try run in Comment 8 also highlighted the need for our mozharness script to know about sut vs adb -- bug 1123443.
I would like to decide on screen characteristics for the Android 4.4 emulator. From bug 824748: > We have Android 4.0 Panda tests at 1280x672/tablet/landscape and > Android 2.3 emulator tests at 1024x816/phone/landscape. To avoid trouble with reftests, we need a minimum of 600x600. Maybe 720x1280 normal, xhdpi (like Galaxy Nexus), to give us a portrait option? :mfinkle -- Can you suggest a particular screen specification?
Flags: needinfo?(mark.finkle)
(In reply to Geoff Brown [:gbrown] from comment #10) > I would like to decide on screen characteristics for the Android 4.4 > emulator. > Maybe 720x1280 normal, xhdpi (like Galaxy Nexus), to give us a portrait > option? I do like the idea of modeling the screen characteristics on a real world use case. The Galaxy Nexus is a bit old, but might be fine. I think the Nexus 4 has similar (normal / xhdpi) characteristics. The "Screen Sizes and Densities" dashboard shows (normal / hdpi) as the most common, but (normal / xhdpi) and (normal / xxhdpi) are gaining. Nexus 5 is xxhdpi while the Nexus 6 is somewere between xxhdpi and xxxhdpi. Geoff - Let's go with your suggestion (720x1280 normal, xhdpi) and see how things work out. It's possible we might want more than one screen configuration (portrait and landscape?) once we get the basics working. I don't know what advantages we'd have with using xxhdpi or xxxhdpi-ish sizes for testing. Those sizes are large enough to potential show other problems, like performance and memory issues, but for normal unit testing, we probably want to avoid stressing out the system.
Flags: needinfo?(mark.finkle)
Depends on: 1124913
https://treeherder.mozilla.org/#/jobs?repo=try&revision=b6d8cbb854d3 has some good things: - new emulator installed and used - adb device manager in use - Android 4.4 AVD in use - fennec is launched with correct environment - complete logcat uploaded to blobber ...and some bad things: - some ANRs during Android boot - remnants of SUTagent and Watcher apparent - fennec crashes on startup, missing resources related to R.layout.new_tablet_browser_toolbar...because api-9 apk is installed?
Depends on: 1126035
https://treeherder.mozilla.org/#/jobs?repo=try&revision=812c76716cc4 is an improvement: by hacking use of the api-11 apk, the startup crash / missing resource problem is avoided. Now there are egl / opengl failures.
Depends on: 1127082
btw, I have been in a pickle recently wrt running the emulator locally -- it suddenly started hanging in local runs, with no sign of the trouble in debug logs. I thought I must have messed up my avd, but restoring an old avd from backup did not help. I googled, found various reports of similar troubles, followed various home remedies, all to no avail. Then I remembered -- I had removed "zip" from my search path; I restored zip and now all is well!!
Depends on: 1128548
I still haven't found a solution to the egl failures - bug 1128548 - when starting Firefox for Android on 4.4 on aws. However, the egl failures do not occur on Android 4.2 or 4.3 on aws -- we can run all test types with only a few test failures on Android 4.2 and Android 4.3 (on aws, via adb, with sdk-r24 emulator): https://treeherder.mozilla.org/#/jobs?repo=try&revision=470ee066d8a4 https://treeherder.mozilla.org/#/jobs?repo=try&revision=50a773b0ad4a The situation on Android 5.0 is more complicated: https://treeherder.mozilla.org/#/jobs?repo=try&revision=f127f385a154. There are other (likely fixable) problems preventing mochitest startup on 5.0. However, I think the reftest run confirms that the egl failure affects 5.0 as well.
I have often meant to investigate the emulator "snapshot" feature, to speed up emulator startup. It turns out that you cannot use snapshot and "Use host GPU" in the same avd: http://stackoverflow.com/questions/11617131/android-why-snapshots-and-gpu-are-mutually-exclusive. Since we need the GPU, we will not be using snapshots.
Blocks: 1133833
(In reply to Geoff Brown [:gbrown] from comment #15) > However, the egl failures do not occur on Android 4.2 or 4.3 on aws -- we > can run all test types with only a few test failures on Android 4.2 and > Android 4.3 (on aws, via adb, with sdk-r24 emulator): > https://treeherder.mozilla.org/#/jobs?repo=try&revision=470ee066d8a4 > https://treeherder.mozilla.org/#/jobs?repo=try&revision=50a773b0ad4a Android 4.1 is also well-behaved and runs all test suites well, on aws, via adb, with sdk-r24 emulator: https://treeherder.mozilla.org/#/jobs?repo=try&revision=6cc896e964eb The 4.1, 4.2, and 4.3 emulator images include a goldfish 2.6 kernel. The 2.6 kernel does not appear to support CONFIG_HIGHMEM (there's no build error, but there is no change in behavior). I also tried using a 3.4 kernel with the 4.1, 4.2, and 4.3 images, but those configurations would not boot. 4.1, 4.2, and 4.3 all seem to give us a maximum of about 850 MB of memory (more than 4.4 without CONFIG_HIGHMEM) -- I think that's good enough.
The egl failures - bug 1128548 - when starting Firefox for Android on 4.4 on aws can be avoided by replacing the kernel with one supporting CONFIG_HIGHMEM, and starting the emulator with sufficient memory to avoid the Firefox "low memory device" threshold. I am happy with that solution. However, other problems persist on Android 4.4, on aws: - xpcshell tests frequently fail during setup reporting that files cannot be written, despite the apparent availability of sufficient space: http://ftp.mozilla.org/pub/mozilla.org/mobile/try-builds/gbrown@mozilla.com-6679ca696c2d/try-android-api-9/try_ubuntu64_vm_mobile_test-xpcshell-1-bm118-tests1-linux64-build13.txt.gz - reftests generally run to completion, but frequently crash on shutdown: http://ftp.mozilla.org/pub/mozilla.org/mobile/try-builds/gbrown@mozilla.com-6679ca696c2d/try-android-api-9/try_ubuntu64_vm_large_test-plain-reftest-1-bm67-tests1-linux64-build32.txt.gz - mochitests fail to start - tests time out: http://ftp.mozilla.org/pub/mozilla.org/mobile/try-builds/gbrown@mozilla.com-6679ca696c2d/try-android-api-9/try_ubuntu64_vm_mobile_test-mochitest-1-bm118-tests1-linux64-build35.txt.gz - most robocop tests fail, often reporting that the screen is off or that some other application is in the foreground None of these problems are seen on 4.1, 4.2, or 4.3. None of these problems are seen when I run tests locally against a 4.4 emulator with the same AVD. In some local tests, I have seen prefs.js missing, or 0 length, which might account for some of the aws behavior -- if files cannot be written to device reliably, all sorts of things might fail. But this is speculative; I don't know what is causing all this odd test behavior.
(In reply to Geoff Brown [:gbrown] from comment #18) > However, other problems persist on Android 4.4, on aws: > - xpcshell tests frequently fail during setup reporting that files cannot > be written We appear to run out of space on /data. The difference between 4.1/2/3 and 4.4 is that 4.4 has a smaller /data partition. The difference between local and aws runs is that when running locally, I did not have firefox pre-installed (mozharness installs the app, even for xpcshell, where it is not strictly necessary).
/data resist attempts to make it a reasonable size, as reported here: http://stackoverflow.com/questions/20579606/android-4-4-virtual-device-internal-storage-will-not-resize. The solution shown there works for me: rm userdata-qemu.img resize2fs userdata.img 512M tune2fs -e continue userdata.img Then start emulator and customize settings, etc.
Depends on: 1137289
Depends on: 1137320
I can run 4.4 xpcshell tests fine now, but all the other problems in Comment 18 persist. 4.3 is reliable, so we're just going to concentrate on that instead, at least for now.
I'm just renaming this file for 4.3. Thankfully, it is not referenced by anything yet.
Attachment #8570029 - Flags: review?(kmoir)
Attachment #8570029 - Flags: review?(kmoir) → review+
Oops - I forgot to rename the in-tree config from 4.4 to 4.3.
Attachment #8572091 - Flags: review?(kmoir)
Attachment #8572092 - Flags: review?(kmoir)
Attachment #8572091 - Flags: review?(kmoir) → review+
Attachment #8572092 - Flags: review?(kmoir) → review+
Summary: Investigate an Android 4.4 emulator test setup → Investigate Android 4.3/4.4 emulator test setup
Keywords: leave-open
This patch changes all of the android emulator jobs (2.3, x86, and 4.3) to retrieve and use android sdk packages from tooltool. For 4.3, we need 2 packages: an r24 sdk for the emulator, and the old r18 sdk for adb (because of a bug in the r24 adb; we may be able to work around this more efficiently in future). For 2.3 and x86, we need just the r18 sdk, for both the emulator and adb. The r24 sdk was put on tooltool in bug 1137513. The r18 sdk was put on tooltool in bug 1137940. We want to use tooltool for the sdk in preference to the existing /tools/android-sdk18 in support of bug 1137743. Here's a try run against http://hg.mozilla.org/users/gbrown_mozilla.com/gbmozharnessclean/rev/b5d0ee4b2fb2 (this patch + some logging): https://treeherder.mozilla.org/#/jobs?repo=try&revision=60702f85d35a. Note that the Android 2.3 and x86 jobs download the sdk: 20:22:05 INFO - INFO - Attempting to fetch from 'http://tooltool.pvt.build.mozilla.org/build/'... 20:22:05 INFO - DEBUG - opened http://tooltool.pvt.build.mozilla.org/build//sha512/6609e8b95db59c6a3ad60fc3dcfc358b2c8ec8b4dda4c2780eb439e1c5dcc5d550f2e47ce56ba14309363070078d09b5287e372f6e95686110ff8a2ef1838221 for reading 20:22:12 INFO - INFO - File android-sdk18_0.r18moz1.orig.tar.gz fetched from http://tooltool.pvt.build.mozilla.org/build/ as /builds/slave/test/build/tmpymWd_T 20:22:12 INFO - DEBUG - creating FileRecord 0x1ae1a90 20:22:13 INFO - DEBUG - hashed tmpymWd_T with sha512 to be 6609e8b95db59c6a3ad60fc3dcfc358b2c8ec8b4dda4c2780eb439e1c5dcc5d550f2e47ce56ba14309363070078d09b5287e372f6e95686110ff8a2ef1838221 20:22:13 INFO - INFO - File integrity verified, renaming tmpymWd_T to android-sdk18_0.r18moz1.orig.tar.gz 20:22:13 INFO - INFO - untarring "android-sdk18_0.r18moz1.orig.tar.gz" 20:22:20 INFO - Return code: 0 and pick up the emulator from <working dir>/android-sdk18 instead of /tools/android-sdk18: 21:04:08 INFO - emulator: found SDK root at /builds/slave/test/build/android-sdk18 and similarly use the downloaded adb: 20:24:45 INFO - ['/builds/slave/test/build/android-sdk18/platform-tools/adb', '-s', 'emulator-5554', 'shell', 'ps']:
Attachment #8572655 - Flags: review?(kmoir)
Attachment #8572655 - Flags: review?(kmoir) → review+
I noticed README.txt was out of date; is there anything else we should say here?
Attachment #8573308 - Flags: review?(armenzg)
Comment on attachment 8573308 [details] [diff] [review] bump mozharness rev to https://hg.mozilla.org/build/mozharness/file/e170cecfdee2 Review of attachment 8573308 [details] [diff] [review]: ----------------------------------------------------------------- Perhaps: "If you need to change jobs on other repositories you will need to uplift your change". Maybe? Not sure. Thanks for fixing it!
Attachment #8573308 - Flags: review?(armenzg) → review+
That felt redundant/obvious and I couldn't think of anything better, so left it the way it was. mozharness bump: https://hg.mozilla.org/integration/mozilla-inbound/rev/ffc53dc185b9
Blocks: 1140148
:ryanvm -- Can you help us out with some uplifts? We want the mozharness bump - https://hg.mozilla.org/mozilla-central/rev/ffc53dc185b9 - to go everywhere that runs Android 2.3 or Android x86 tests, to expedite bug 1131611. I would expect any problems with mozharness changes to be readily apparent, and see no sign of trouble from yesterday's landing; and prior to mozharness pinning, this would have happened as part of the reconfig anyway.
Flags: needinfo?(ryanvm)
Blocks: 1140454
To prepare an Android 4.3 AVD, there are several choices for components: - system images from the SDK vs. building our own from AOSP - if building from AOSP, which version/tag: https://source.android.com/source/build-numbers.html#source-code-tags-and-builds - kernel from SDK vs. prebuilt kernel from AOSP vs building our own - 4.3 AOSP comes with 2 prebuilt kernels, the default is 2.6.29 but a 3.4 kernel is also included Using system images and kernel from the SDK gives us an apparently stable system that can produce green test runs (with appropriate manifest exclusions) but has these limitations: - old 2.6.29 kernel - memory limited to 840868 kB - errors and ANRs on boot / increased boot time - less flexibility / unable to patch components if problems encountered in future If I build system images from AOSP, such as JLS36I / android-4.3.1_r1 and run with the default prebuilt 2.6.29 kernel, that also produces a stable system that can produce green test runs which is nearly indistinguishable from the SDK images: - old 2.6.29 kernel - memory limited to 840868 kB - errors and ANRs on boot / increased boot time This runs fine with a 2.6.29 kernel built from source also. (Without CONFIG_HIGHMEM; CONFIG_HIGHMEM seems to have no effect in 2.6.29.) If I use the AOSP prebuilt 3.4 kernel or build my own 3.4 kernel, we run into the EGL problems previously discovered in Android 4.4 (bug 1128548): - memory limited to 765760 kB - Fennec considers this a low memory device and alters egl configuration; egl errors on startup If I build my own 3.4 kernel and define CONFIG_HIGHMEM, memory is no longer limited and we avoid the egl startup errors, but tests exhibit a variety of infrequent, intermittent crashes, time-outs, and failures. This suggests that the real problem with Android 4.4 is not 4.4, but the 3.4 kernel. For now, I will concentrate on the 2.6.29 kernel.
Building AOSP is straight-forward for 4.3. I followed the instructions starting at https://source.android.com/source/downloading.html. mkdir aosp431r1 cd aosp431r1 repo init -u https://android.googlesource.com/platform/manifest -b android-4.3.1_r1 repo sync . build/envsetup.sh lunch sdk-eng make System images ca be found in out/target/product/generic. Note the choice of "lunch sdk-eng" instead of "lunch aosp_arm-eng"; aosp_arm produced images, but they would not boot while sdk-eng images worked fine. Lunch output was: ============================================ PLATFORM_VERSION_CODENAME=REL PLATFORM_VERSION=4.3.1 TARGET_PRODUCT=sdk TARGET_BUILD_VARIANT=eng TARGET_BUILD_TYPE=release TARGET_BUILD_APPS= TARGET_ARCH=arm TARGET_ARCH_VARIANT=armv7-a TARGET_CPU_VARIANT=generic HOST_ARCH=x86 HOST_OS=linux HOST_OS_EXTRA=Linux-3.11.0-26-generic-x86_64-with-Ubuntu-13.10-saucy HOST_BUILD_TYPE=release BUILD_ID=JLS36I OUT_DIR=out ============================================
Building the kernel is also straight-forward. See instructions at https://bugzilla.mozilla.org/show_bug.cgi?id=1128548#c11, but be sure to use the 2.6.29 branch.
To build a custom AVD with all the desired bits in the right places, there are a few steps to go through. I prefer a manual approach to a script because all things considered, I think the manual description is more portable and more easily reproducible in future. 1. Open the Android AVD Manager - Ensure an Android SDK is installed on the local computer. - Run "android" to start the Android SDK Manager. - Select the "Tools" menu > "Manage AVDs..." to start the AVD Manager. 2. Create a device in the AVD Manager - Select the Device Definitions tab - Select New Device... - Create a new device with these parameters: Resolution: 720x1280 Screen size: 5 All sensors Both cameras Keyboard and Dpad RAM: 1024 Size: large Screen ratio: long Density: xhdpi Buttons: Software Device states: all 3. Create an AVD in the AVD Manager - Select the Android Virtual Device tab - Select New... - Create an AVD with these parameters: Name "test-1" Device: select the device created in step 2 Target: Android 4.3.1 CPU: armeabi-v7a Hardware keyboard present Skin: Skin with dynamic hardware controls Front camera: emulated Back camera: emulated RAM: 1024 VM Heap: 128 Internal Storage: 600 SD card: 600 Use Host GPU 4. Edit ~/.android/avd/test-1.avd/config.ini and set hw.mainKeys=yes 5. Copy your AOSP images (Comment 40) to the AVD: - cp ~/aosp431r1/out/target/product/generic/*.img ~/.android/avd/test-1.avd 6. Copy your armv7 kernel (Comment 41) to the AVD. Be sure to rename kernel-qemu-armv7 to kernel-qemu. - cp ~/rebuild43/kernel-qemu-armv7 ~/.android/avd/test-1.avd/kernel-qemu 7. Start the emulator with the new AVD: - emulator -avd test-1 8. Customize settings in the emulator - clear the "Make yourself at home" first-run greeting - select applications icon: clear "Choose some apps" first-run greeting - open Settings and change: -- Display > Sleep - 30 minutes -- Display > Daydream - OFF -- Security > Screen lock - OFF -- Developer Options > Window animation scale - off -- Developer Options > Transition animation scale - off -- Developer Options > Animation duration scale - off -- Date & time > Automatic time-zone - off -- Date & time > Select time-zone - Pacific time 9. Customize data via adb: - adb shell mkdir /data/anr - adb shell chown system:system /data/anr - adb shell mkdir /data/tombstones - adb shell chown system:system /data/tombstones - adb install install_flash_player_ics.apk 10. Close the emulator 11. Create the AVD archive for export to tooltool, taking care to remove hardware-qemu.ini and updating the path in test-1.ini to /home/cltbld/... gbrown@mozpad:~/.android/avd$ mkdir repack431final gbrown@mozpad:~/.android/avd$ mkdir repack431final/avd gbrown@mozpad:~/.android/avd$ cp -r test-1.ini test-1.avd repack431final/avd gbrown@mozpad:~/.android/avd$ ls -lR repack431final repack431final: total 4 drwxr-xr-x 3 gbrown gbrown 4096 Mar 10 16:15 avd repack431final/avd: total 8 drwxr-xr-x 2 gbrown gbrown 4096 Mar 10 16:15 test-1.avd -rw-r--r-- 1 gbrown gbrown 107 Mar 10 16:15 test-1.ini repack431final/avd/test-1.avd: total 898804 -rw------- 1 gbrown gbrown 46428 Mar 10 16:15 cache.img -rw-r--r-- 1 gbrown gbrown 721 Mar 10 16:15 config.ini -rw-r--r-- 1 gbrown gbrown 49 Mar 10 16:15 emulator-user.ini -rw-r--r-- 1 gbrown gbrown 1355 Mar 10 16:15 hardware-qemu.ini -rwxr-xr-x 1 gbrown gbrown 1644308 Mar 10 16:15 kernel-qemu -rw-r--r-- 1 gbrown gbrown 234189 Mar 10 16:15 ramdisk.img -rw-r--r-- 1 gbrown gbrown 629145600 Mar 10 16:15 sdcard.img -rw------- 1 gbrown gbrown 230719068 Mar 10 16:15 system.img -rw-r--r-- 1 gbrown gbrown 5453184 Mar 10 16:15 userdata.img -rw------- 1 gbrown gbrown 53275164 Mar 10 16:15 userdata-qemu.img gbrown@mozpad:~/.android/avd$ cd repack431final/avd gbrown@mozpad:~/.android/avd/repack431final/avd$ vi test-1.ini gbrown@mozpad:~/.android/avd/repack431final/avd$ cd test-1.avd gbrown@mozpad:~/.android/avd/repack431final/avd/test-1.avd$ rm hard* gbrown@mozpad:~/.android/avd/repack431final/avd/test-1.avd$ ls -l total 898800 -rw------- 1 gbrown gbrown 46428 Mar 10 16:15 cache.img -rw-r--r-- 1 gbrown gbrown 721 Mar 10 16:15 config.ini -rw-r--r-- 1 gbrown gbrown 49 Mar 10 16:15 emulator-user.ini -rwxr-xr-x 1 gbrown gbrown 1644308 Mar 10 16:15 kernel-qemu -rw-r--r-- 1 gbrown gbrown 234189 Mar 10 16:15 ramdisk.img -rw-r--r-- 1 gbrown gbrown 629145600 Mar 10 16:15 sdcard.img -rw------- 1 gbrown gbrown 230719068 Mar 10 16:15 system.img -rw-r--r-- 1 gbrown gbrown 5453184 Mar 10 16:15 userdata.img -rw------- 1 gbrown gbrown 53275164 Mar 10 16:15 userdata-qemu.img gbrown@mozpad:~/.android/avd/repack431final/avd/test-1.avd$ cd ../.. gbrown@mozpad:~/.android/avd/repack431final$ tar cvf ~/.android/AVDs-armv7a-android-4.3.1_r1-build-2015-03-10-ubuntu.tar * avd/ avd/test-1.avd/ avd/test-1.avd/emulator-user.ini avd/test-1.avd/system.img avd/test-1.avd/ramdisk.img avd/test-1.avd/cache.img avd/test-1.avd/kernel-qemu avd/test-1.avd/userdata-qemu.img avd/test-1.avd/config.ini avd/test-1.avd/sdcard.img avd/test-1.avd/userdata.img avd/test-1.ini gbrown@mozpad:~/.android/avd/repack431final$ gzip ~/.android/AVDs-armv7a-android-4.3.1_r1-build-2015-03-10-ubuntu.tar gbrown@mozpad:~/.android/avd/repack431final$ ls -l ~/.android/AVDs-armv7a-android-4.3.1_r1-build-2015-03-10-ubuntu.tar.gz -rw-r--r-- 1 gbrown gbrown 141992264 Mar 10 16:18 /home/gbrown/.android/AVDs-armv7a-android-4.3.1_r1-build-2015-03-10-ubuntu.tar.gz gbrown@mozpad:~/.android/avd/repack431final$ sha512sum /home/gbrown/.android/AVDs-armv7a-android-4.3.1_r1-build-2015-03-10-ubuntu.tar.gz a3562cfe136b324ce4e40aea967de85c3ff6728a7b186e1c18de948dc7d90967e2d61b443905a717218101c65533e4d2d7eb9e5bf422022145637b1ad5ddc3ab /home/gbrown/.android/AVDs-armv7a-android-4.3.1_r1-build-2015-03-10-ubuntu.tar.gz gbrown@mozpad:~/.android/avd/repack431final$ tar tvf /home/gbrown/.android/AVDs-armv7a-android-4.3.1_r1-build-2015-03-10-ubuntu.tar.gz drwxr-xr-x gbrown/gbrown 0 2015-03-10 16:16 avd/ drwxr-xr-x gbrown/gbrown 0 2015-03-10 16:16 avd/test-1.avd/ -rw-r--r-- gbrown/gbrown 49 2015-03-10 16:15 avd/test-1.avd/emulator-user.ini -rw------- gbrown/gbrown 230719068 2015-03-10 16:15 avd/test-1.avd/system.img -rw-r--r-- gbrown/gbrown 234189 2015-03-10 16:15 avd/test-1.avd/ramdisk.img -rw------- gbrown/gbrown 46428 2015-03-10 16:15 avd/test-1.avd/cache.img -rwxr-xr-x gbrown/gbrown 1644308 2015-03-10 16:15 avd/test-1.avd/kernel-qemu -rw------- gbrown/gbrown 53275164 2015-03-10 16:15 avd/test-1.avd/userdata-qemu.img -rw-r--r-- gbrown/gbrown 721 2015-03-10 16:15 avd/test-1.avd/config.ini -rw-r--r-- gbrown/gbrown 629145600 2015-03-10 16:15 avd/test-1.avd/sdcard.img -rw-r--r-- gbrown/gbrown 5453184 2015-03-10 16:15 avd/test-1.avd/userdata.img -rw-r--r-- gbrown/gbrown 107 2015-03-10 16:16 avd/test-1.ini
Check your work! gbrown@mozpad:~$ adb shell cat /proc/meminfo | grep MemTotal MemTotal: 840804 kB gbrown@mozpad:~$ adb shell df Filesystem Size Used Free Blksize /dev 410.5M 48.0K 410.5M 4096 /mnt/secure 410.5M 0.0K 410.5M 4096 /mnt/asec 410.5M 0.0K 410.5M 4096 /mnt/obb 410.5M 0.0K 410.5M 4096 /system 214.4M 214.4M 0.0K 4096 /data 581.9M 22.9M 559.0M 4096 /cache 64.0M 1.1M 62.9M 4096 /storage/sdcard 597.6M 24.0K 597.6M 2048 /mnt/secure/asec 597.6M 24.0K 597.6M 2048 gbrown@mozpad:~$ adb shell ls -l /data drwxrwxrwx system system 2015-03-10 15:04 anr drwxrwx--x system system 2015-03-10 15:04 app drwx------ root root 2015-03-10 14:45 app-asec drwxrwx--x system system 2015-03-10 15:04 app-lib drwxrwx--x system system 2015-03-10 14:45 app-private drwx------ system system 2015-03-10 14:45 backup lrwxrwxrwx root root 2015-03-10 14:45 bugreports -> /data/data/com.android.shell/files/bugreports drwxrwx--x system system 2015-03-10 15:04 dalvik-cache drwxrwx--x system system 2015-03-10 15:04 data drwxr-x--- root log 2015-03-10 14:45 dontpanic drwxrwx--- drm drm 2015-03-10 14:45 drm drwxr-x--x root root 2015-03-10 14:45 local drwxrwx--- root root 2015-03-10 14:45 lost+found drwxrwx--- media_rw media_rw 2015-03-10 14:45 media drwxrwx--- mediadrm mediadrm 2015-03-10 14:45 mediadrm drwxrwx--t system misc 2015-03-10 14:45 misc drwxrwx--x system system 2015-03-08 18:03 nativebenchmark drwxrwx--x system system 2015-03-08 18:03 nativetest drwx------ root root 2015-03-10 15:12 property drwxrwx--x system system 2015-03-10 14:45 resource-cache drwx------ system system 2015-03-10 14:45 security drwxr-x--- root shell 2015-03-10 14:45 ssh drwxrwxr-x system system 2015-03-10 15:11 system drwxrwxrwx system system 2015-03-10 15:04 tombstones drwx--x--x system system 2015-03-10 14:45 user gbrown@mozpad:~/.android/avd/repack431final/avd$ cat test-1.ini avd.ini.encoding=UTF-8 path=/home/cltbld/.android/avd/test-1.avd path.rel=avd/test-1.avd target=android-18 gbrown@mozpad:~/.android/avd/repack431final/avd$ cat test-1.avd/config.ini avd.ini.encoding=UTF-8 abi.type=armeabi-v7a disk.dataPartition.size=600M hw.accelerometer=yes hw.audioInput=yes hw.battery=yes hw.camera.back=emulated hw.camera.front=emulated hw.cpu.arch=arm hw.cpu.model=cortex-a8 hw.dPad=yes hw.device.hash2=MD5:cb16ddb36f0092e8ab3125e954cd726d hw.device.manufacturer=User hw.device.name=mozilla-device hw.gps=yes hw.gpu.enabled=yes hw.keyboard=yes hw.keyboard.lid=yes hw.lcd.density=320 hw.mainKeys=yes hw.ramSize=1024 hw.sdCard=yes hw.sensors.orientation=yes hw.sensors.proximity=yes hw.trackBall=no image.sysdir.1=system-images/android-18/default/armeabi-v7a/ sdcard.size=600M skin.dynamic=yes skin.name=720x1280 skin.path=720x1280 tag.display=Default tag.id=default vm.heapSize=128
I noticed some intermittent startup crashes in mochitests when using my own 2.6.29 kernel which seemed to go away with the prebuilt kernel, so I skipped step 6 in Comment 42 to use the prebuilt kernel from the sdk.
Android 4.3 has a lot of extra components installed which can be disabled or uninstalled, simplifying boot-time logcat and reducing memory use. Here's the new procedure for making the AVD; this comment replaces Comment 42, 43, and 44. 1. Open the Android AVD Manager - Ensure an Android SDK is installed on the local computer. - Run "android" to start the Android SDK Manager. - Select the "Tools" menu > "Manage AVDs..." to start the AVD Manager. 2. Create a device in the AVD Manager - Select the Device Definitions tab - Select New Device... - Create a new device with these parameters: Resolution: 720x1280 Screen size: 5 All sensors Both cameras Keyboard and Dpad RAM: 1024 Size: large Screen ratio: long Density: xhdpi Buttons: Software Device states: all 3. Create an AVD in the AVD Manager - Select the Android Virtual Device tab - Select New... - Create an AVD with these parameters: Name "test-1" Device: select the device created in step 2 Target: Android 4.3.1 CPU: armeabi-v7a Hardware keyboard present Skin: Skin with dynamic hardware controls Front camera: emulated Back camera: emulated RAM: 1024 VM Heap: 128 Internal Storage: 600 SD card: 600 Use Host GPU 4. Edit ~/.android/avd/test-1.avd/config.ini and set hw.mainKeys=yes 5. Copy your AOSP images (Comment 40) to the AVD: - cp ~/aosp431r1/out/target/product/generic/*.img ~/.android/avd/test-1.avd 6. Start the emulator with the new AVD: - emulator -avd test-1 7. Customize settings in the emulator - clear the "Make yourself at home" first-run greeting - select applications icon: clear "Choose some apps" first-run greeting - open Settings and change: -- Display > Sleep - 30 minutes -- Display > Daydream - OFF -- Security > Screen lock - OFF -- Developer Options > Window animation scale - off -- Developer Options > Transition animation scale - off -- Developer Options > Animation duration scale - off -- Date & time > Automatic time-zone - off -- Date & time > Select time-zone - Pacific time -- Apps: disable these components: -- Daydream, Calculator, Calendar, Calendar Storage, Clock, Connectivity Test, Email, Example Wallpapers, Exchange Service, Homescreen Tips, Music, Widget Preview, 8. Customize data via adb: - adb shell mkdir /data/anr - adb shell chown system:system /data/anr - adb shell mkdir /data/tombstones - adb shell chown system:system /data/tombstones - adb install install_flash_player_ics.apk 9. Close the emulator 10. Create the AVD archive for export to tooltool, taking care to remove hardware-qemu.ini and updating the path in test-1.ini to /home/cltbld/... gbrown@mozpad:~/.android/avd$ mkdir repack431final gbrown@mozpad:~/.android/avd$ mkdir repack431final/avd gbrown@mozpad:~/.android/avd$ cp -r test-1.ini test-1.avd repack431final/avd gbrown@mozpad:~/.android/avd$ ls -lR repack431final repack431final: total 4 drwxr-xr-x 3 gbrown gbrown 4096 Mar 10 16:15 avd repack431final/avd: total 8 drwxr-xr-x 2 gbrown gbrown 4096 Mar 10 16:15 test-1.avd -rw-r--r-- 1 gbrown gbrown 107 Mar 10 16:15 test-1.ini repack431final/avd/test-1.avd: total 898804 -rw------- 1 gbrown gbrown 114012 Mar 16 15:51 cache.img -rw-r--r-- 1 gbrown gbrown 721 Mar 10 16:15 config.ini -rw-r--r-- 1 gbrown gbrown 49 Mar 10 16:15 emulator-user.ini -rw-r--r-- 1 gbrown gbrown 1355 Mar 10 16:15 hardware-qemu.ini -rwxr-xr-x 1 gbrown gbrown 1608696 Mar 10 21:33 kernel-qemu -rw-r--r-- 1 gbrown gbrown 234189 Mar 10 16:15 ramdisk.img -rw-r--r-- 1 gbrown gbrown 629145600 Mar 16 15:51 sdcard.img -rw------- 1 gbrown gbrown 230816220 Mar 16 15:51 system.img -rw-r--r-- 1 gbrown gbrown 5453184 Mar 10 16:15 userdata.img -rw------- 1 gbrown gbrown 70088796 Mar 16 15:52 userdata-qemu.img gbrown@mozpad:~/.android/avd$ cd repack431final/avd gbrown@mozpad:~/.android/avd/repack431final/avd$ vi test-1.ini gbrown@mozpad:~/.android/avd/repack431final/avd$ cd test-1.avd gbrown@mozpad:~/.android/avd/repack431final/avd/test-1.avd$ rm hard* gbrown@mozpad:~/.android/avd/repack431final/avd/test-1.avd$ ls -l total 915348 -rw------- 1 gbrown gbrown 114012 Mar 16 15:51 cache.img -rw-r--r-- 1 gbrown gbrown 721 Mar 10 16:15 config.ini -rw-r--r-- 1 gbrown gbrown 49 Mar 10 16:15 emulator-user.ini -rwxr-xr-x 1 gbrown gbrown 1608696 Mar 10 21:33 kernel-qemu -rw-r--r-- 1 gbrown gbrown 234189 Mar 10 16:15 ramdisk.img -rw-r--r-- 1 gbrown gbrown 629145600 Mar 16 15:51 sdcard.img -rw------- 1 gbrown gbrown 230816220 Mar 16 15:51 system.img -rw-r--r-- 1 gbrown gbrown 5453184 Mar 10 16:15 userdata.img -rw------- 1 gbrown gbrown 70088796 Mar 16 15:52 userdata-qemu.img gbrown@mozpad:~/.android/avd/repack431final/avd/test-1.avd$ cd ../.. gbrown@mozpad:~/.android/avd/repack431final$ tar cvf ~/.android/AVDs-armv7a-android-4.3.1_r1-build-2015-03-16-ubuntu.tar * avd/ avd/test-1.avd/ avd/test-1.avd/emulator-user.ini avd/test-1.avd/system.img avd/test-1.avd/ramdisk.img avd/test-1.avd/cache.img avd/test-1.avd/kernel-qemu avd/test-1.avd/userdata-qemu.img avd/test-1.avd/config.ini avd/test-1.avd/sdcard.img avd/test-1.avd/userdata.img avd/test-1.ini gbrown@mozpad:~/.android/avd/repack431final$ gzip ~/.android/AVDs-armv7a-android-4.3.1_r1-build-2015-03-16-ubuntu.tar gbrown@mozpad:~/.android/avd/repack431final$ ls -l ~/.android/AVDs-armv7a-android-4.3.1_r1-build-2015-03-16-ubuntu.tar.gz -rw-r--r-- 1 gbrown gbrown 130067232 Mar 16 15:53 /home/gbrown/.android/AVDs-armv7a-android-4.3.1_r1-build-2015-03-16-ubuntu.tar.gz gbrown@mozpad:~/.android/avd/repack431final$ sha512sum /home/gbrown/.android/AVDs-armv7a-android-4.3.1_r1-build-2015-03-16-ubuntu.tar.gz 78648d2e769ef667377ea64d45e422f161e947303e25bec6933bca078ba57ea9118cfafa244ee844c6168bc396fa82e636455e48d57756c7c6ccce0b67efcb91 /home/gbrown/.android/AVDs-armv7a-android-4.3.1_r1-build-2015-03-16-ubuntu.tar.gz gbrown@mozpad:~/.android/avd/repack431final$ tar tvf /home/gbrown/.android/AVDs-armv7a-android-4.3.1_r1-build-2015-03-16-ubuntu.tar.gz drwxr-xr-x gbrown/gbrown 0 2015-03-10 16:16 avd/ drwxr-xr-x gbrown/gbrown 0 2015-03-10 16:16 avd/test-1.avd/ -rw-r--r-- gbrown/gbrown 49 2015-03-10 16:15 avd/test-1.avd/emulator-user.ini -rw------- gbrown/gbrown 230816220 2015-03-16 15:51 avd/test-1.avd/system.img -rw-r--r-- gbrown/gbrown 234189 2015-03-10 16:15 avd/test-1.avd/ramdisk.img -rw------- gbrown/gbrown 114012 2015-03-16 15:51 avd/test-1.avd/cache.img -rwxr-xr-x gbrown/gbrown 1608696 2015-03-10 21:33 avd/test-1.avd/kernel-qemu -rw------- gbrown/gbrown 70088796 2015-03-16 15:52 avd/test-1.avd/userdata-qemu.img -rw-r--r-- gbrown/gbrown 721 2015-03-10 16:15 avd/test-1.avd/config.ini -rw-r--r-- gbrown/gbrown 629145600 2015-03-16 15:51 avd/test-1.avd/sdcard.img -rw-r--r-- gbrown/gbrown 5453184 2015-03-10 16:15 avd/test-1.avd/userdata.img -rw-r--r-- gbrown/gbrown 107 2015-03-10 16:16 avd/test-1.ini 11. Check your work! gbrown@mozpad:~$ adb shell cat /proc/meminfo | grep MemTotal MemTotal: 840804 kB gbrown@mozpad:~$ adb shell df Filesystem Size Used Free Blksize /dev 410.5M 48.0K 410.5M 4096 /mnt/secure 410.5M 0.0K 410.5M 4096 /mnt/asec 410.5M 0.0K 410.5M 4096 /mnt/obb 410.5M 0.0K 410.5M 4096 /system 214.4M 214.4M 0.0K 4096 /data 581.9M 22.9M 559.0M 4096 /cache 64.0M 1.1M 62.9M 4096 /storage/sdcard 597.6M 24.0K 597.6M 2048 /mnt/secure/asec 597.6M 24.0K 597.6M 2048 gbrown@mozpad:~$ adb shell ls -l /data drwxrwxrwx system system 2015-03-10 15:04 anr drwxrwx--x system system 2015-03-10 15:04 app drwx------ root root 2015-03-10 14:45 app-asec drwxrwx--x system system 2015-03-10 15:04 app-lib drwxrwx--x system system 2015-03-10 14:45 app-private drwx------ system system 2015-03-10 14:45 backup lrwxrwxrwx root root 2015-03-10 14:45 bugreports -> /data/data/com.android.shell/files/bugreports drwxrwx--x system system 2015-03-10 15:04 dalvik-cache drwxrwx--x system system 2015-03-10 15:04 data drwxr-x--- root log 2015-03-10 14:45 dontpanic drwxrwx--- drm drm 2015-03-10 14:45 drm drwxr-x--x root root 2015-03-10 14:45 local drwxrwx--- root root 2015-03-10 14:45 lost+found drwxrwx--- media_rw media_rw 2015-03-10 14:45 media drwxrwx--- mediadrm mediadrm 2015-03-10 14:45 mediadrm drwxrwx--t system misc 2015-03-10 14:45 misc drwxrwx--x system system 2015-03-08 18:03 nativebenchmark drwxrwx--x system system 2015-03-08 18:03 nativetest drwx------ root root 2015-03-10 15:12 property drwxrwx--x system system 2015-03-10 14:45 resource-cache drwx------ system system 2015-03-10 14:45 security drwxr-x--- root shell 2015-03-10 14:45 ssh drwxrwxr-x system system 2015-03-10 15:11 system drwxrwxrwx system system 2015-03-10 15:04 tombstones drwx--x--x system system 2015-03-10 14:45 user gbrown@mozpad:~/.android/avd/repack431final/avd$ cat test-1.ini avd.ini.encoding=UTF-8 path=/home/cltbld/.android/avd/test-1.avd path.rel=avd/test-1.avd target=android-18 gbrown@mozpad:~/.android/avd/repack431final/avd$ cat test-1.avd/config.ini avd.ini.encoding=UTF-8 abi.type=armeabi-v7a disk.dataPartition.size=600M hw.accelerometer=yes hw.audioInput=yes hw.battery=yes hw.camera.back=emulated hw.camera.front=emulated hw.cpu.arch=arm hw.cpu.model=cortex-a8 hw.dPad=yes hw.device.hash2=MD5:cb16ddb36f0092e8ab3125e954cd726d hw.device.manufacturer=User hw.device.name=mozilla-device hw.gps=yes hw.gpu.enabled=yes hw.keyboard=yes hw.keyboard.lid=yes hw.lcd.density=320 hw.mainKeys=yes hw.ramSize=1024 hw.sdCard=yes hw.sensors.orientation=yes hw.sensors.proximity=yes hw.trackBall=no image.sysdir.1=system-images/android-18/default/armeabi-v7a/ sdcard.size=600M skin.dynamic=yes skin.name=720x1280 skin.path=720x1280 tag.display=Default tag.id=default vm.heapSize=128
All done here. Custom try pushes show that this configuration is stable enough to run all test suites. Most tests behave very similarly to the existing Android 2.3 emulator tests. Efforts continue in bug 1133833 to get tests running in CI.
Status: NEW → RESOLVED
Closed: 10 years ago
Keywords: leave-open
Resolution: --- → FIXED
Blocks: 1287493
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: