Android CTS 测试常见问题

来源:互联网 发布:淘宝网儿童卡通抱枕 编辑:程序博客网 时间:2024/05/17 04:35

http://blog.163.com/yi_yixinyiyi/blog/static/136286889201122323446862/

http://my.oschina.net/chen106106/blog/40553

a)        问题描述:在执行plan时,执行一段时间后会抛异常,异常如下:

CTS_INFO >>> Restarting device ...

Device(HC09MPL00037) disconnected

Exception in thread "Thread-17" com.android.ddmlib.AdbCommandRejectedException: insufficient permissions for device

   at com.android.ddmlib.AdbHelper.setDevice(AdbHelper.java:736)

   at com.android.ddmlib.SyncService.openSync(SyncService.java:164)

   at com.android.ddmlib.Device.getSyncService(Device.java:253)

   at com.android.cts.DeviceManager$DeviceServiceMonitor.run(DeviceManager.java:217)

解决方案:是因为权限不够,提升至root权限可解决,命令如下$sudo ./startcts   


b)        问题描述:输入./adb shell出现如下异常:

error: insufficient permissions for device

解决方案:输入:

$sudo -s

./adb kill-server

./adb devices


c)     问题描述:出现如下异常:Unable to locate  android-sdk-linux_86/tools/adb.

解决方案:是因为android-sdk-linux_86tools目录下没有adb文件,可以从将platfrorm-tools目录下的adb文件拷贝到tools目录下,或者去SVN上取下

 d) 问题描述:error: device not found

解决方法:1)请确认你的手机是否连接电脑,(2)以连接PC,重新拔下来,在连一次(3)如果2操作后还不行,看下USB连接方式是否为默认(仅充电),选htcUSB连接。



e)        写入测试结果时报Too many open files的错误,这是因为网络请求过多,也就导致了系统打开的文件过多。每一个连接都会当成“文件”看待的。

      解决方案:ulimit –a命令查看每个用户允许打开的


    f).................................
    android.accessibilityservice.cts.AccessibilitySettingsTest#testAccessibilitySettingsIntentHandled...(pass)
    android.accessibilityservice.cts.AccessibilitySettingsTest#testAndroidTestCaseSetupProperly...(pass)
    ==============================================================
   CTS_INFO >>> Max ADB operations reached. Restarting ADB...
   CTS_INFO >>> Restarting device ...
   Device(1234567890ABCDEF) disconnected
   Test stopped.
  解决方案:#gedit host_config.xml 

  把<IntValue name="maxTestCount" value="200"/>中的200改为负数或0,如“-1”就不会Restarting device。


 ❀ testcase timeout
         测 试某个testcase的时候一直出现 “........”,迟迟没有pass或者fail,等良久出现一个血淋淋的timeout,很让人伤心。有不少人笑嘻嘻的以为timeout 挺好,至少它不是fail。在我看来timeout 比 fail 还恐怖,因为它连进行测试到底是pass还是fail的权利都没有。想不被硬件设备厂商笑话,必须0 timeout ,然后再争取0 fail 。

        timeout多数都是由于这个错误造成的:

        Exception in thread "Thread-XX" com.android.ddmlib.ShellCommandUnresponsiveException


                           at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:408)


                           at com.android.ddmlib.Device.executeShellCommand(Device.java:276)


                           at com.android.cts.TestDevice$1.run(TestDevice.java:1718)

        解决方案:
            这个错误是由于CTS和SDK版本不匹配造成的。倘若用android2.2 SDK 和 android2.2 cts -r6 还是出现了这个问题,那么编译自己工程的sdk (在整体m后,再make sdk),配套官方的cts一起,就可以百分百解决这个问题了。

           必须要注意的是,不要用自己的工程代码编译出来的cts(make cts),因为可能编译出来的不是最新的(通常是r1版本)。而google提供的才是最新的,而硬件设备厂商都会信赖最新版本的cts的测试结果。


 

 ❀java.io.IOException: sad result from adb: closed

          倘若中途出现:

          java.io.IOException: sad result from adb: closed
         00:47 E/ddms: ADB rejected shell command (am instrument -w -e bundle true android.tests.devicesetup/android.tests.getinfo.DeviceInfoInstrument): closed

         CTS_ERROR >>> Failed to execute shell command am instrument -w -e bundle true android.tests.devicesetup/android.tests.getinfo.DeviceInfoInstrument on device 0xxxxxxxxxxxx         

         java.io.IOException: sad result from adb: closed

 

 

       解决方案:

          别担心,重启一下板子就好了。

 

 

✿其他fail

         因为各个项目差异,所以fail项不同,抛开硬件差异所决定的fail,还有系统工程师为了掩饰别的bug而新增的cts fail bug,我们还需要注意的是:

         1.Net相关的testcase ,记得开wifi \ 3G,保持网络联通

         2.SMS相关的testcase,记得插SIM卡

         3.当I2C上某个设备的testcase没有过,试试禁掉I2C上其他的sensor服务,单一测试,也许会有意外收获


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 





原创粉丝点击