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