This is a general CTS(Compatibility) user guide, with this document, you could know how to build and run CTS
for android CDK.
Build CTS:
Firstly, you need download android source code to your linux host PC.Then enter android root directory, and
follow below instructions:
1. source build/envsetup.sh
2. mm cts
then $CTS_ROOT folder named android-cts would be generated at ./out/host/linux-x86/cts/, you can move this
android-cts folder to any other place easy to visit.
Run CTS:
Before CTS running normally, you should ensure below steps be done.
1: Have Android 2.1 SDK intalled on your machine. And configure android-cts/tools/startcts script,modify the
varable SDK_ROOT to match your environment. Example :SDK_ROOT=/home/myuser/android-sdk-linux_x86-2.1_r1
2. Use a OTG cable to connect host PC and android CDK.
3. Make sure no lock pattern is set on the device (Settings > Security & location > Require Pattern should
be unchecked.
4. Make sure the "Screen Timeout" is set to "Never Timeout" (Settings > Sound & Display > Screen Timeout
should be set to "Never Timeout".(may not exist this option)
5. Make sure the "Stay Awake" development option is checked (Settings > Applications > Development > Stay
awake).
6. Make sure the device is at the home screen at the start of CTS (Press the home button).
7. While a device is running tests, it must not be used for any other tasks.
8. Do not press any keys on the device while CTS is running. Pressing keys or touching the screen of a test
device will interfere with the running tests and may lead to test failures.
To run a test plan:
1: Start CTS console: #bash android-cts/tools/startcts
2: Make sure at least one device connected: #ls -d
3: you can type"ls -p" to see a list of test packages
4: you can type"ls --plan" to see a list of test plans in repository. Originally this plans available:
CTS,Signature,Android,Java,VM,RefApp,Performance.
5: To start a test plan, use: #start --plan "PlanName" [-d $device_name], eg.#start --plan CTS, CTS plan is
a overall plan which include other plans.
6: If just to run package A, first workout a new testplan xml in plans/ folder named A.xml, then issue
"start --plan A [-d $device_name]" . If just to run test mothod B in test case A, issue "start --plan
CTS -t A#B [-d $device_name]"
Interpreting the Test Results:
The test results exist under: $CTS_ROOT/repository/results/<start time>/,inside it, you can use a browser to
open testResult.xml to view test results.
FAQ: below are some referenced Solutions.
1. When CTS try to connect to devices, display insufficient permission.
Solution: CTS use adb to connect, you should connect with root privilege, at this time, you should do(ensure
you have adb environment):
#adb kill-server
#adb start-server
#adb devices
then you should see the devices connected.
2. After connected host and CDK, any devices can not be recognised
Solution: Ensure you have enabled usb debugging in android system at setting->Application->Development->USB
debugging. Then reconnect host PC and
CDK, login host's terminal with root privilege, run: #adb devices. It should be OK, additionally, adb works
well is the precondition of cts runs well.
3. When run "#adb devices", echo status of device "offline".
Solution: ensure you have done the operation in section "RUN CTS" above, especially points of 4,5,and 6.Then
reconnect host PC and CDK.
4. When run "#bash startcts", echo"CTS is being used at the moment..."
Solution: To kill the active adb process, use "#adb kill-server", then start cts again.
5. Inside cts console, type"ls -d", echo "No device connected".
Solution: Try to reconnect host PC and CDK with OTG.
6. When running a test plan, may encounter error "adb rejected shell command"
Solution: as known so far, need to stop this session and rerun that test case.
7. After android system boot complete, popup a window says:"the process com.android.* has stopped" or
"Application * is not responding"
Solution: Sometimes it may affect cts' running, maybe need us to remove it manually.
8. When running cts, prompt "installing met timeout due to unknown reason",after restart echos "device
request rejected:device offline"
Solution: refer to Question3 above.
9. When running a test case, echo "install met failure [install_failed_older_sdk]"
Solution: Please use the corresponding cts/sdk version for system