1. 下载cts工具
https://source.android.com/compatibility/cts/downloads
或者make cts,
out/host/linux-x86/cts, cts-verifier
2. Setting up
https://source.android.com/compatibility/cts/setup
Wi-Fi and IPv6
CTS tests require a Wi-Fi network that supports IPv6, can treat the DUT as an isolated client, and has an internet connection.
ADB and AAPT
export PATH=$PATH:$HOME/android-sdk-linux/build-tools/version
put in .bashrc, run "source .bashrc"
or put in /etc/profile run "source /etc/profile"
Java Development Kit
Install the proper version of the Java Development Kit (JDK). For Android 7.0 and higher:
- On Ubuntu, use OpenJDK 8
CTS files
Download and open the latest version of the CTS media files.
User builds
First API level for Android 9 and higher
For devices launched with Android 9 or higher, set the ro.product.first_api_level
property to a valid value found on Codenames, Tags, and Build Numbers.
Android device configuration
- Factory data reset the device: Settings > Backup & reset > Factory data reset
- Set your device's language to English (United States): Settings > Language & input > Language
- Turn on the location setting if there's a GPS or Wi-Fi/cellular network feature on the device: Settings > Location > On
- Connect to a Wi-Fi network that supports IPv6, can treat the DUT as an isolated client (see Physical Environment above), and has an internet connection: Settings > Wi-Fi
- Make sure that no lock pattern or password is set on the device: Settings > Security > Screen lock > None
- Enable USB debugging on your device: Settings > Developer options > USB debugging
Note: On Android 4.2 and higher, Developer options is hidden by default. To make it available, go to Settings > About phone and tap Build number seven times. Return to the previous screen to find Developer options. See Enabling On-device Developer Options for additional details.
- Set the time to 12-hour format: Settings > Date & time > Use 24-hour format > Off
- Set the device to stay awake: Settings > Developer options > Stay Awake > On
- In Android 5.x and 4.4.x only, set the device to allow mock locations: Settings > Developer options > Allow mock locations > On
- In Android 4.2 and higher, turn off USB app verification: Settings > Developer options > Verify apps over USB > Off
- Launch the browser and dismiss any startup/setup screen.
Running CTS tests
https://source.android.com/compatibility/cts/run
./android-cts/tools/cts-tradefed
.verison
.help
.help run
.run cts --module/-m <module name>
.run cts --module/-m <module name> --test/-t <test name>
test name can package/class/class#function or native binary name
logs and results are under android-cts
https://ressrc.com/2018/03/27/android-gms%E8%AE%A4%E8%AF%81-cts-gts-ctsv/
3)CTS Verifier测试相关
1、测试准备
1、根目录下安装CtsVerifier.apk、NotificationBot.apk
adb install -r CtsVerifier.apk
adb install -r NotificationBot.apk
2、设置里security-Device administrators开启cts verifier
3、打开手机上的CTS Verifier应用,根据提示测试每一项
2、保存查看结果
所有测试完成后,点击CTS Verifier测试工具右上角的保存按钮,会提示结果保存位置,连接电脑,将结果拷贝到电脑即可查看。