技术标签: CTS
CTS介绍-----------------------------------------------3
什么是CTS------------------------------------------3
测试环境搭建-------------------------------------------3
测试环境--------------------------------------------3
测试前准备------------------------------------------3
测试手机配置----------------------------------------4
执行测试------------------------------------------------4
整体测试6.0以下------------------------------------4
测试相关的指令--------------------------------------5
主要针对6.0及其以下版本测试使用------------------7
针对Android7.0以及以后版本测试------------------8
测试结果输出------------------------------------------10
FAQ---------------------------------------------------10
CTS介绍
CTS简介:Compatibility Test suite系列兼容测试
google定义了一个兼容性规范(Compatible Definition),而CTS就是为了确保某个测试符合该规范。从而基于Android的应用程序能在基于同一个api版本的设备上面运行。通过CTS测试的device可以获得android的商标,并且享受android market的权限
一般CTS测试有三项:Cts,Gts,Cts verify ,CTS测试工具可以在官方网上下载(http://source.android.com/compatibility/downloads.html),选择对应Android版本的CDD文档(介绍CTS测试),CTS测试包下载(测试包会不断更新),将下载的CTS测试包解压到相应文件夹里面应包含:android-cts文件夹里面包含Docs、Repository、Tools三个文件夹,
Android6.0的测试包和Android7.0的CTS测试包已经有些不同,而Media Files最新为CTS Media 1.2.,
· linux系统(最好是64位ubuntu10.04)
· 需正确配置JavaJDK(1.7版本以上)和Android SDK 和ADB,确保系统和手机能够正常的连接
· 下载需要进行测试的软件版本
· 连接IPV6翻墙网络
· 插入可用的SD卡,容量最好大于1G
· 插入可用的Sim卡,如果为双卡版本,需确保卡一的卡槽有可用的Sim卡.
· 写入合法的IMEI号,需要写入号码
· 检查手机是否设置了CTS标志位
· 手机恢复出厂设置(Settings→Backup andreset→Factory data reset)
· 确保SD中有足够的空间(大于1G),可将SD格式化清空。
· 确保手机里没有Google账号或者其他账号存在
· 确保日期和时间的正确(开了Wifi或者数据连接以后会自动更新时间,时区选默认的),设置太平洋时间gtm:-8
· 设置屏幕为常亮(Settings→Display→Sleep→Never)
· 设置无锁屏(Settings→Security→Set up screenlock→None)
· 手机恢复出厂设置(Settings→Backup andreset→Factory data reset)
· 2.1_R2到4.2_R4之前,安装CtsDelegatingAccessibilityService.apk,
(在android-cts/repository/testcases下,可用adb install安装),并进入Settings→Accessibility开启Delegating Accessibility Service.
·
· 安装CtsDeviceAdmin.apk,(在android-cts/repository/testcases下可用adbinstall CtsDeviceAdmin.apk),并进入Settings→Security→Deviceadministrators开启里面的两个包
·
· 将媒体文件(android-cts-media-1.2.zip解压出来的文件),名称为test的文件,拷贝到手机外部SD卡上,可使用脚本拷贝(在android-cts-media-1.0目录下执行bash copy_media.shall)
·
· 确保开发者选项中的USB debugging,Stay awake,Allowmock locations三个选项已勾选。
· 设置系统语言为美式英语(Settings→Language&input→Language)
· 设置系统输入法为谷歌默认输入法
(Settings→Language&input→Default→English(US))
· 打开Wifi,打开数据连接,打开GPS
· 确保USB连接稳定
测试之前手机需要安装CtsDeviceAdmin.apk在终端中输入:
cts/android-cts/repository/testcases$adbinstall CtsDeviceAdmin.apk
在Settings-Security-Deviceadministrators下勾选
Android Devices Manage
android.deviceadmin.cts.CtsDevicesAdminReceiver
android.deviceadmin.cts.CtsDevicesAdminReceiver2
l 用adb devices查看手机是否连上
n 进入测试环境
l 进入CTS测试
xxx@CTS-ceshi:~/cts/6.0_r14/android-cts$cd tools/
xxx@CTS-ceshi:~/cts/6.0_r14/android-cts/tools$./cts-tradefed
Android CTS 6.0_r14 build:3623550
03-17 16:46:58 I/DeviceManager: Detectednew device c23392e
l cts-tf > runcts --plan CTS --disable-reboot //开始执CTS整个测试包
l cts-tf> help 使用帮助文档
Run:
runcts --plan test_plan_name: run a test plan
runcts --package/-p : run a CTS test package
runcts --class/-c [--method/-m] : run a specific test class and/ormethod
run cts --continue-session session_ID: run allnot executed tests from a previous CTS session
runcts [options] --serial/-s device_ID: run CTS on specified device
runcts [options] --shards number_of_shards: shard a CTS run into given number ofindependent chunks, to run on multiple devices inparallel
runcts --help/--help-all: get more help on running CTS
List:
l/list d/devices: list connected devices and their state
l/list packages: list CTS test packages
l/list p/plans: list CTS test plans
l/list i/invocations: list invocations aka CTStest runs currentlyin progress
l/list c/commands: list commands: aka CTS test run commands currently inthe queue waiting to be allocated devices
l/list r/results: list CTS results currently present in the repository
Add:
addderivedplan --plan plane_name --session/-s session_id -r[pass/fail/notExecuted/timeout]: derive a plan from the given session
Dump:
d/dump l/logs: dump the tradefed logs for all running invocations
Options:
--disable-reboot: Do not reboot device after running some amount of tests.
l cts-tf > l r 查看失败项目 成功项目 ,未执行项目
Session Pass Fail Not Executed Start time Plan name Device serial(s)
0 2743 130 3555 2017.01.18_16.46.14 CTS1 24ade972
l cts-tf> run cts --continue-session 0 --disable-reboot
继续执行未执行的项目
cts-tf > l r
Session Pass Fail Not Executed Start time Plan name Device serial(s)
0 2743 130 3555 2017.01.18_16.46.14 CTS1 24ade972
l cts-tf> add derivedplan --plan testname -s 0 -r fail
l cts-tf> run cts --plan testname 执行失败项目
l 多台机器同时执行
Android6.0测试需要IPV6环境,可以用命令run cts –plan CTS –skip-preconditions
Android6.0测试需要的时间比较长,google提供了多台手机一起测试的功能:
r un cts –plan CTS –shards 手机数量 –skip-preconditions
比如我需要3台机器一起测试就可以输入命令:run cts –plan CTS –shards 3–skip-preconditions
另外:在终端中输入help可以参看cts的相关命令
run cts –plan test_plan_name 测试一个plan
run cts –packages/-p packages_name 单独测试一个package
run cts –class/-c class_name–method/-m method_name 测试一个类和方法
如:run cts -candroid.hardware.camera2.cts.BurstCaptureTest -m testYuvBurst
l i 命令查看运行时间 cts-tf > l i
l r 查看测试结果 cts-tf > l r
CTS v1 console command reference
Table1. This table summarizes the CTS v1 console commands for varioususes.
Host |
Description |
help |
Display a summary of the most commonly used commands |
help all |
Display the complete list of available commands |
exit |
Gracefully exit the CTS console. Console will close when all currently running tests are finished |
Run |
Description |
run cts |
Run the specified tests and displays progress information. One of --plan, --package, --class or --continue-session needs to be specified The CTS console can accept other commands while tests are in progress If no devices are connected, the CTS desktop machine (or host) will wait for a device to be connected before starting tests If more than one device is connected, the CTS host will choose a device automatically |
--plan <test_plan_name> |
Run the specified test plan |
--package/-p <test_package_name> [--package/-p <test_package2>...] |
Run the specified test packages |
--class/-c <class_name> [--method/-m <test_method_name> |
Run the specified test class and/or method |
--continue-session |
Run all not executed tests from previous CTS session; the sessions testResult.xml will be updated with the new results |
--shards <number_of_shards> |
Shard a CTS run into given number of independent chunks, to run on multiple devices in parallel |
--serial/-s <deviceID> |
Run CTS on the specific device |
-t <class_name>#<test_method_name> |
Run a specific test method |
--force-abi 32|64 |
On 64-bit devices, run the test against only the 32-bit or 64-bit ABI |
List |
Description |
list packages |
List all available test packages in the repository |
list plans |
List all available test plans in the repository |
list invocations |
List 'run' commands currently being executed on devices |
list commands |
List all 'run' commands currently in the queue waiting to be assigned to devices |
list results |
List CTS results currently stored in repository |
list devices |
List currently connected devices and their state 'Available' devices are functioning, idle devices, available for running tests 'Unavailable' devices are devices visible via adb, but are not responding to adb commands and won't be allocated for tests 'Allocated' devices are devices currently running tests |
Add |
Description |
add derivedplan --plan <plan_name> |
Create a plan derived from given result session; use this option to rerun reports and validate test issues |
For Android 7.0 or later, you'll use CTS v2.
CTS v2 console command reference
Table1. This table summarizes the CTS V2 console commands for varioususes.
Host |
Description |
help |
Display a summary of the most commonly used commands |
help all |
Display the complete list of available commands |
version |
Show the version. |
exit |
Gracefully exit the CTS console. Console will close when all currently running tests are finished. |
Run |
Description |
run cts |
Run the default CTS plan (that is, the full CTS invocation). The CTS console can accept other commands while tests are in progress. If no devices are connected, the CTS desktop machine (or host) will wait for a device to be connected before starting tests. If more than one device is connected, the CTS host will choose a device automatically. |
--plan <test_plan_name> |
Run the specified test plan. |
--module/-m <test_module_name> [--module/-m <test_module2>...] |
Run the specified test module or modules. For example, run cts --module CtsGestureTestCases executes the gesture test module (this can be shortened to run cts -m Gesture). |
--module/-m <test_module_name> -- test <test_name> |
Run the specified module and test. For example, run cts -m Gesture --test android.gesture.cts. GestureTest#testGetStrokes runs the specific package, class, or test. |
--retry |
Retry all tests that failed or were not executed from the previous sessions. Use list results to get the session id. |
--shards <number_of_shards> |
Shard a CTS run into given number of independent chunks, to run on multiple devices in parallel. |
--serial/-s <deviceID> |
Run CTS on the specific device. |
--include-filter <module_name> [--include-filter <module2>...] |
Run only with the specified modules. |
--exclude-filter <module_name> [--exclude-filter <module2>...] |
Exclude the specified modules from the run. |
--log-level-display/-l <log_level> |
Run with the minimum specified log level displayed to STDOUT. Valid values: [VERBOSE, DEBUG, INFO, WARN, ERROR, ASSERT]. |
--abi <abi_name> |
Force the test to run on the given ABI, 32 or 64. By default CTS runs a test once for each ABI the device supports. |
--logcat, --bugreport, and --screenshoot-on-failure |
Give more visibility into failures and can help with diagnostics. |
--device-token |
Specifies a given device has the given token eg. --device-token 1a2b3c4d:sim-card.. |
--skip-device-info |
Skips collection of information about the device. Note: do not use this option when running CTS for approval. |
--skip-preconditions |
Bypasses verification and setup of the device's configuration, such as pushing media files or checking for Wi-Fi connection. |
List |
Description |
list modules |
List all available test modules in the repository. |
list plansor list configs |
List all available test plans (configs) in the repository. |
list invocations |
List 'run' commands currently being executed on devices. |
list commands |
List all 'run' commands currently in the queue waiting to be assigned to devices. |
list results |
List CTS results currently stored in repository. |
list devices |
List currently connected devices and their state. 'Available' devices are functioning, idle devices, available for running tests. 'Unavailable' devices are devices visible via adb, but are not responding to adb commands and won't be allocated for tests. 'Allocated' devices are devices currently running tests. |
Dump |
Description |
dump logs |
Dump the tradefed logs for all running invocations. |
ADD |
Description ps: |
a/add s/subplan |
Create a subplan used to create a subplan |
--session <session_id> |
The session used to create a subplan |
--result-type <status> |
Which result to include in the subplan |
--name/-n <subplan_name> |
The name of the new subplan |
Cts-tf> run cts --retry sessionId --retry-type FAILED/NOT_EXECUTED 执行未完成的任务 ,输出结果
|
l 测试结束后 /repository/results/2016.05.27_21.29.17/testResult.xml使用浏览器打开,查看测试的结果
可以进入android-cts/repository/results/2016.05.27_21.29.17输入命令: sudo gedit testResult.xml 在这里必须使用命令打开,否则不能保存,可以看到测试结果:
l 修改了如下内容 ,正常测试没有问题,可不需要修改
增加了环境变量 ,使用的是6.0的aapt ,这是要测试的相应的版本的aapt
1 。root@CTS-ceshi:~# gedit .bashrc
exportANDROID_HOME=/home/liangcheng/android-sdk-linux #/*SDK所在的路径*/
exportPATH=$PATH:/home/liangcheng/android-sdk-linux/build-tools/23.0.3
l 手机在linux上可以通过adb devices 看到 ,但是不弹出连接时间的对话框
需要查看 develop options 中 Select usb Configuration 是否是在MTP模式上
文章浏览阅读141次。简介:菜鸟高手裸奔工具沙盘Sandboxie是一款国外著名的系统安全工具,它可以让选定程序在安全的隔离环境下运行,只要在此环境中运行的软件,浏览器或注册表信息等都可以完整的进行清空,不留一点痕迹。同时可以防御些带有木马或者病毒的恶意网站,对于经常测试软件或者不放心的软件,可放心在沙盘里面运行!下载地址:http://www.bytepan.com/J7BwpqQdKzR..._sandboxie系统安全工具
文章浏览阅读230次,点赞4次,收藏5次。Mac老用户都知道之前的老版本系统是可以设置一位数登陆密码的,但是更新到10.14以后就不可以了,今天就教大家怎么在新版本下设置Mac一位数登陆密码。
文章浏览阅读3.4k次。本该到此结束,但是上述实现的时候其实是把生成的每一步的奖励都使用统一的句子级reward,但该代码其实也额外按照每个token来计算奖励值的,为了获取每个token的奖励,我们在生成模型的隐层表示上,多加一个线性层,映射到一维,作为每个状态的预测奖励值。类似的,在文本生成中我们也可以用蒙特卡洛方法来估计一个模型的状态价值。假如我们只采样到了s1和s2,没有采样到s3,由于7和3都是正向奖励,s1和s2的训练后生成的概率都会变大,且s1的概率变的更大,这看似合理,但是s3是未参与训练的,它的概率反而减小了。_chatgpt使用的强化学习
文章浏览阅读433次,点赞10次,收藏8次。尝试了3种方法,都失败了!_truf计算重心
文章浏览阅读406次。学习LIS_poj 1631 hdu 1950为啥是最长上升子序列
文章浏览阅读550次。一、节点规划主机名称IP域名解析k8s-m-01192.168.12.51m1k8s-m-02192.168.12.52m2k8s-m-03192.168.12.53m3k8s-n-01192.168.12.54n1k8s-n-02192.168.12.55n2k8s-m-vip192.168.12.56vip二、插件规划#1.master节点规划kube-apiserverkube-controller-manage_sed -ie 's#image.*#image: ${ epic_image_fullname }#g
文章浏览阅读106次。UAC绕过提权_uac白名单 提权
文章浏览阅读664次,点赞7次,收藏12次。每次架设OpenVPN Server就很痛苦,步骤太多,会出错的地方也多,基本很少一次性成功的。
文章浏览阅读397次。 今天看了继承以及派生类,并且运行了教程中的一个实例,但是仍然有好多坑。主要如下:建立了一个基类bClass以及由基类bClass派生的一个dClass,并且建立两个头文件.h分别申明这两个类,在cpp程序中进行运行来检验。具体程序如下:#ifndef ITEM_BASE//为避免类重复定义,需要在头文件的开头和结尾加上如这个所示 #define ITEM_BASEclass bClass..._多个头文件相互包含
文章浏览阅读1.3w次,点赞19次,收藏88次。PyQt5安装详细教程,安装步骤很详细
文章浏览阅读154次。官方文档:https://developers.weixin.qq.com/miniprogram/dev/component/scroll-view.html。_scroll-view去除滚动条
文章浏览阅读146次。S(k)=A^1+A^2...+A^k.保利求解就超时了,我们考虑一下当k为偶数的情况,A^1+A^2+A^3+A^4...+A^k,取其中前一半A^1+A^2...A^k/2,后一半提取公共矩阵A^k/2后可以发现也是前一半A^1+A^2...A^k/2。因此我们可以考虑只算其中一半,然后A^k/2用矩阵快速幂处理。对于k为奇数,只要转化为k-1+A^k即可。n为矩阵数量,m为矩阵..._a^1 a^2 ... a^k