1Overview: 2 3The labpretest.sh script is designed to emulate a typical automated test lab 4session. It puts a device into bootloader mode, reboots into bootloader mode, 5determines device type, erases user cache, flashes a generic userdata image, 6updates the bootloader image, updates the radio image, updates the system image 7and reboots, sets up for a monkey run and finally runs a random monkey test. 8It will repeat this based on an optional parameter(-i) or default to 100 times. 9It will detect if it is in a low battery situation and wait for it to charge 10again. 11 12The goal is to see if a device is ready for deployment to automated lab testing 13and can also be used to verify that lab infrastructure is ready for devices. 14The idea is to run this script at the same time for multiple devices, typically 15I would connect 8 devices to a host and run this script in 8 separate shell 16sessions and watch for failures. 17 18Running the script: 19 20If there is only one device attached to the host you can simply just run the 21script, it will detect the device and go through 100 cycles, running the monkey 22for 200 events each cycle. The script ignores normal monkey failures. If you 23have multiple devices attached use the -d <device_id> parameter to target a 24specific devices. Additional parameters are -i for how many cycles and -m for 25how many monkey events and finally -x to make it skip the monkey run portion 26altogether. 27 28Adding support for new devices or from scratch: 29 30The script uses included copies of adb and fastboot which are in in the tools/ 31sub directory. If you are setting this up with only the script, create a tools 32sub directory and put adb and fastboot in it and make sure they are executable. 33Currently we use userdebug builds. 34 35Here are the steps to add a new device: 36 37 1) Create a new sub directory using the result of "fastboot getvar product". 38 2) Copy a build image to the new sub directory in our format. 39 (i.e. passion-img-24827.zip) 40 3) Copy a boot image to the new sub directory in our format. 41 (i.e. hboot.0.33.2012.img) 42 4) Copy a radio image to the new sub directory in our format. 43 (i.e. radio.4.04.00.03_2.img) 44 5) Copy a userdata.img file, possibly from one of the other directories. 45 46Customizations to the flashing process are handled by adding a custom_flash.sh 47file that is read in before the main loop starts. It allows you to add any non 48generic functions or details to the flashing process. You must use it to define 49the variable "bootpart" which is not defined by default. Also, use this file to 50rewrite the flash_device function and any others, etc... 51 52The script should handle the rest, unless there are radical changes to file 53names or the process.