【转】CTS tests 4.2_r4
原文网址:http://www.xuebuyuan.com/1722006.html
Precondition:
1.Get android sdk
2.Set adb to environment variable.
3.Download cts tool from google source
4.Download android-cts-media-1.0 to pc
Phone settings:
1. Open "USB debugging", "Stay awake" and "Allow mock locations"
2.Be sure adb devices connect successfully
3.Terminal execute
"adb install -r <cts_path>/android-cts/repository/testcases/CtsDelegatingAccessibilityService.apk" and
"adb install -r <cts_path>/android-cts/repository/testcases/CtsDeviceAdmin.apk"
4.Open Wi-Fi and connect to a network, make sure you can access us network
5.Open Bluetooth
6.Open NFC(If your device not support NFC, skip this step)
7.Open “Google's location service”, “GPS satellites” and “Location & Google search”
8.Settings → Security → Device administrators → Activate all options
9.Set language to English(United States), if your phone is not boot with english, please reboot phone after set language.
10.Set date and time correctly
11.OpenDelegating Accessibility Service in Accessibility
12.Terminal execute "cd <cts_media_path>/android-cts-media-1.0" -> execute ". copy_media.sh all"
Start to run:
1.Terminal execute "cd <cts_path>/android-cts/tools" -> execute "./cts-tradefed"
2.execute "run cts --plan CTS -s <serial_number>", finished
Fail的一些修改:
1、直接设置问题
estUnknownSourcesOffByDefault |
fail |
junit.framework.AssertionFailedError: Device should not ship with 'Unknown Sources' enabled by default. expected:<0> but |
这种fail最好解决,直接按照字面理解就OK,UnKnownSource没有点掉。
2、permission
-- testSensorFeatures |
fail |
junit.framework.AssertionFailedError: PackageManager#hasSystemFeature(android.hardware.sensor.accelerometer) returns true |
一般情况修改 - > frameworks/base/data/etc/*.xml 文件,例如
android.hardware.camera.xml,platform.xml等文件,这边的文件定义了设备具有的一些权限。
3、由测试而引起的非测试项出错
-- testRecordingHint |
fail |
java.lang.RuntimeException: start failed. at android.media.MediaRecorder.start(Native Method) |
这种情况要根据Logcat去查看RuntimeException的具体错误。通常可以先不改,因为很难查错。
4、网络问题
-- test_isReachable |
fail |
java.net.UnknownHostException: Unable to resolve host "www.google.com": No address associated with hostname at java.net.InetAddress.lookupHostByName(InetAddress.java:426) |
这类问题是由于国内的网络无法访问国外网站导致的,最好的办法就在公司搭建一个VPN,链接出去。
5、系统文件权限
-- testAllFilesInSysAreNotWritable |
fail |
junit.framework.AssertionFailedError: Found writable: [/sys/devices/platform/malata_ts.0/tsclass/tsclass0/ts_power, /sys/devices/platform/malata_ts.0/tsclass/tsclass0/ts_en_file, testAllFilesInSysAreNotWritable(FileSystemPermissionTest.java:364) |
-- testNoSetuidTcpdump |
fail |
junit.framework.AssertionFailedError at android.security.cts.BannedFilesTest. assertNotSetugid(BannedFilesTest.java:59) |
Rootcause: "OTHERS" users does not have "WRITE" permissions on any files under "/dev/" folder
这些问题是系统文件权限的问题,解决方法比较土,就是全局搜索该文件,查看那些对该文件操作的脚本,然后修改即可。
上面两个fail的解决方法是:
a. 修改kernel/drivers/input/touchscreen/malata_ts.c
__ATTR(ts_power, 0777, NULL, ts_set_point),
__ATTR(ts_en_file, 0777, NULL, ts_set_point),
__ATTR(ts_ Calibrate, 0777, NULL, ts_set_point),
b. 修改system/core/include/private/android-filesystem-config.h
{ 06755, ADD_ROOT, ADD_ROOT, “system/xbin/tcpdump”}
6、这种情况最多的。
-- testFocusDistances |
fail |
junit.framework.ComparisonFailure: expected:<infinity> but was:<auto> at android.hardware.cts.CameraTest.testFocusDistancesByCamera (CameraTest.java:1386) |
对于这个fail的原因是CTS对摄像头测试时,对摄像头进行参数设置,然后在读取参数后,参数出错。
这种情况要找到CameraTest源码,通常在source/cts/...下面,我们编译时没有编译到这里,仅查看代码,例如找到CameraTest.java,打开后找到1386行,行数一般情况下不会有出入,除非source下面的cts版本和下载的cts版本不一致才会找不到,找到testFocusDistancesByCamera,然后根据代码查看具体的测试,然后在找camera的源代码,使用Log跟踪,当然这个测试一定要结合做该模块的人一起改才行,不然很容易引起其他问题。
其中camera CTS测试代码在:
source/cts/tests/tests/hardware/src/android/hardware/cts/CameraTest.java
摄像头设置的相关代码在:Source/device/Samsung/exynos4/libcamera/下面,有SecCameraHWInterface_zoom.cpp、SecCameraHWInterface_zoom.h、SecCamera_zoom.cpp、SecCamera_zoom.h
找到之后通过修改后测试再修改后再测试直到CTS PASS。
(对于摄像头,应注意是几个摄像头,不然测试可能会对两个一起测试,这样就算一个摄像头调好了,能PASS了,另外一个过不了也是FAIL的。)
7. [CTS]
2 cases failed by android.theme.cts.DeviceDefaultTest
这个cts测试的是Theme_DeviceDefault_dialogWhenLarge这个theme. 这个theme在large/xlarge screen时,显示为dialog; 在normal, small screen时,显示为full screen. 那个它是如何做到的呢?秘诀就是在values-large/xlarge中,把Theme_DeviceDefault_dialogWhenLarge定义为有固定尺寸的dialog
style. 而在values中,它确实普通的theme.holo style.
屏幕的大小是由screen的分辨率决定的:
longsize < 470dp small screen
longsize >=960 && shortsize >=720 xlarge screen
longsize >=640
&& shortsize >=480 large screen
else normal screen.
那么又如何确定xlarge/large, 或者说指定类型的资源被编译到资源包中呢?
在*.mk中的PRODUCT_AAPT_CONFIG := mdpi【ldpi, hdpi, xhdpi, nodpi, tvdpi】 xlarge【large, normal, small】
ldpi= 120dpi
mdpi=160dpi
hdpi=240dpi
xhdpi=320
tvdpi=213
nodpi=all&noScale
Theme_DeviceDefault_DialogWhenLarge |
8. 1 case failed by android.security.cts.ListeningPortsTest#testNoRemotelyAccessibleListeningTcpPorts
这个cts测试的是在user-release时的/proc/net/tcp/监听的端口。在user-release版本下,/proc/net/tcp/下的端口不应该被监听。
cat /proc/net/tcp/显示 监听的端口(16进制) 和inode 数
通过adb shell, ls -l /proc/*/fd/ | grep -inr inode_number 来找到那个进程的fd在监听这个端口就可以解决了。
CPDD is gps issue.
cts_host > start --plan CTS -t android.net.cts.ListeningPortsTest#testNoListeningUdpPorts
start test android.net.cts.ListeningPortsTest#testNoListeningUdpPorts
==============================================================
Test package: android.net
android.net.cts.ListeningPortsTest#testNoListeningUdpPorts.............(fail)
android.net.cts.ListeningPortsTest$ListeningPortsAssertionError: Found port listening on 00000000:1C6B in /proc/net/udp at android.net.cts.ListeningPortsTest.assertNoListeningPorts(ListeningPortsTest.java:126)
at android.net.cts.ListeningPortsTest.assertNoListeningPorts(ListeningPortsTest.java:126)
at android.net.cts.ListeningPortsTest.assertNoListeningUdpPorts(ListeningPortsTest.java:78)
at android.net.cts.ListeningPortsTest.testNoListeningUdpPorts(ListeningPortsTest.java:63)
at java.lang.reflect.Method.invokeNative(Native Method)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:529)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1448)
at android.net.cts.ListeningPortsTest.assertNoListeningPorts(ListeningPortsTest.java:126)
at android.net.cts.ListeningPortsTest.assertNoListeningUdpPorts(ListeningPortsTest.java:78)
at android.net.cts.ListeningPortsTest.testNoListeningUdpPorts(ListeningPortsTest.java:63)
at java.lang.reflect.Method.invokeNative(Native Method)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:529)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1448) ==============================================================
and /proc/net/udp, adb shell output is :
* daemon started successfully *
/# cat /proc/net/udp
sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode ref pointer drops
107: 00000000:1C6B 00000000:0000 07 00000000:00000000 00:00000000 00000000 1000 0 4102 2 e0078000 0
#
and
# cat /proc/net/tcp
sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode
0: 0100007F:13AD 00000000:0000 0A 00000000:00000000 00:00000000 00000000 0 0 2981 1 dfa58000 300 0 0 2 -1
Converting the hex values to decimal, you get: 0x1C6B = 7275
0x13AD = 5037 The first CTS failure is because there is a remotely accessible UDP port listening on port 7275. This is a security risk. Remotely accessible ports are often used by attackers to gain unauthorized access to computers systems without user knowledge or awareness. Minimizing the number of open ports is considered a security best practice and required by CTS. Per the /proc/net/udp output above, this port is owned by UID=1000 (the "system" user). What do you have running under the system server that opens port 7275? The second /proc/net/tcp output is also problematic. In: # cat /proc/net/tcp
sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode
0: 0100007F:13AD 00000000:0000 0A 00000000:00000000 00:00000000 00000000 0 0 2981 1 dfa58000 300 0 0 2 -1 There's a process, RUNNING AS ROOT, which is listening on the loopback (127.0.0.1) interface on port 5037. This process is thankfully NOT remotely accessible, but it is accessible to any program installed on the phone. In ICS, this listening port will be considered a CTS failure. Locally accessible ports are often targeted by malicious locally installed programs to gain unauthorized access to program data or cause system corruption. In all cases, a local listening IP port can be replaced by a UNIX domain socket. Unix domain sockets can be protected with unix filesystem permission. Alternatively, you can use getsockopt(SO_PEERCRED) to determine if a program is authorized to connect to your socket. While this isn't a failure today, I'd recommend switching to a UNIX domain socket as soon as practical.
7 [cts version]
android-cts_4.2_r4_x86.zip
[cts command]
1. run cts -c android.app.cts.SystemFeaturesTest -m testLocationFeatures
[Failure Details]
junit.framework.AssertionFailedError: PackageManager#hasSystemFeature should NOT return true for android.hardware.location.network at android.app.cts.SystemFeaturesTest.assertNotAvailable(SystemFeaturesTest.java:375)
8 cts
version]
android-cts_4.2_r4_x86.zip
[cts command]
1. run cts -c android.provider.cts.ContactsContract_ContactsTest -m testContentUri
【转】CTS tests 4.2_r4的更多相关文章
- Android—— ubuntu下【CTS】測试TV真机
近期接触到CTS,据传不懂CTS就不算一个合格的android开发者,我之前一直没见周边谁用过.作为一个产品开发的android人员,我还是太年轻- 撰写不易,转载请注明出处:http://blog. ...
- android 兼容性测试 CTS 测试过程(实践测试验证通过)
source: http://blog.csdn.net/jianguo_liao19840726/article/details/7222814 写这个博客的时候是为了记忆,建议大家还是看官方的说明 ...
- 【转】android cts failed items
原文网址:http://blog.csdn.net/linsa0517/article/details/19031479 Fail的一些修改 1.直接设置问题 estUnknownSourcesO ...
- 【转】android 兼容性测试 CTS 测试过程(实践测试验证通过)
原文网址:http://blog.csdn.net/jianguo_liao19840726/article/details/7222814 写这个博客的时候是为了记忆,建议大家还是看官方的说明,官方 ...
- 安卓CTS官方文档之兼容性测试套件简介-attach
官方英文文档原文:https://source.android.com/compatibility/cts-intro.html Compatibility Test Suite 兼容性测试套件 H ...
- 安卓CTS官方文档之兼容性测试套件简介
官方英文文档原文:https://source.android.com/compatibility/cts-intro.html Compatibility Test Suite 兼容性测试套件 Ho ...
- Android CTS(frome google)
Compatibility Test Suite How does the CTS work? The Compatibility Test Suite (CTS) is a free, commer ...
- Android CTS
1.什么是CTS CTS是google制定的兼容性测试包(Compatibility Test Suite),只有通过CTS测试的设备才有可能获得Android的商标和享受Android Market ...
- CTS添加新测试用例步骤
一.CTS添加新测试用例: 前言: google源代码中的cts测试用例集目录为:source_android4.2/cts/tests/tests/ (source_android4.2表示andr ...
随机推荐
- 一个资深java面试官的“面试心得”
在公司当技术面试官几年间,从应届生到工作十几年的应聘者都遇到过.先表达一下我自己对面试的观点: 1.笔试.面试去评价一个人肯定是不够准确的,了解一个人最准确的方式就是“路遥知马力,日久见人心”.通过一 ...
- NOI2011 兔兔与蛋蛋游戏
http://www.lydsy.com/JudgeOnline/problem.php?id=2437 这道题真是极好的. 75分做法: 搜索. 出题人真的挺良心的,前15个数据点的范围都很小,可以 ...
- WPF 实现控件间拖拽内容
想实现这样一个常用功能:在ListBox的一个Item上点住左键,然后拖拽到另外一个控件(如ListView中),松开左键,数据已经拖拽过来. 步骤如下: 1. 设置ListBox 的AllowDro ...
- hdu 4869 Turn the pokers(组合数+费马小定理)
Problem Description During summer vacation,Alice stay at home for a long time, with nothing to do. S ...
- StoryBoard 加入一个自定义View
1. 建一个 UIView的子类(MyView.h/MyView.m) 2. 建一个 View类型的XIB 3. 把xib的file‘s owner设为MyView 4. 在.h文件里加上 @prop ...
- JMeter 参数化、检查点、集合点
参数化:简单的来理解一下,我们录制了一个脚本,这个脚本中有登录操作,需要输入用户名和密码,假如系统不允许相同的用户名和密码同时登录,或者想更好的模拟多个用户来登录系统. 这个时候就需要对用户名和密 ...
- extern C的作用详解
extern "C"的主要作用就是为了能够正确实现C++代码调用其他C语言代码.加上extern "C"后,会指示编译器这部分代码按C语言的进行编译,而不是C+ ...
- TableView数据源方法的执行顺序
UITableView显示数据的过程 1.调用一次tableView:numberOfRowsInSection:方法确定行数 2.调用多次tableView:heightForRowAtIndexP ...
- exec与xargs区别
区别描述: 两者都是对符合条件的文件执行所给的Linux 命令,而不询问用户是否需要执行该命令. -exec:{}表示命令的参数即为所找到的文件,以:表示comman命令的结束.\是转义符,因为分号在 ...
- Sass函数--颜色函数--Opacity函数
Opacity函数简介 在 CSS 中除了可以使用 rgba.hsla 和 transform 来控制颜色透明度之外,还可以使用 opacity 来控制,只不过前两者只是针对颜色上的透明通道做处理,而 ...