Android 5.0 CTS 代码修改日记

 1.android.os.cts.BuildVersionTest#testReleaseVersion
 CTS Log
 04-24 19:08:43.460 11050 11065 I TestRunner: failed: testReleaseVersion(android.os.cts.BuildVersionTest)
04-24 19:08:43.460 11050 11065 I TestRunner: ----- begin exception -----
04-24 19:08:43.461 11050 11065 I TestRunner: junit.framework.AssertionFailedError: For: BUILD.VERSION.RELEASE, the value: 5.1.1, should be one of: [5.1]
04-24 19:08:43.461 11050 11065 I TestRunner:     at junit.framework.Assert.fail(Assert.java:50)
04-24 19:08:43.461 11050 11065 I TestRunner:     at android.os.cts.BuildVersionTest.assertAnyOf(BuildVersionTest.java:90)
04-24 19:08:43.461 11050 11065 I TestRunner:     at android.os.cts.BuildVersionTest.testReleaseVersion(BuildVersionTest.java:40)

CTS路径执行的代码
./cts/tests/tests/os/src/android/os/cts/BuildVersionTest.java

      private static final Set EXPECTED_RELEASES =
              new HashSet(Arrays.asList("5.0.1", "5.0.2"));
      @SuppressWarnings("deprecation")
      public void testReleaseVersion() {                                                                                                                                                                   
          // Applications may rely on the exact release version
          assertAnyOf("BUILD.VERSION.RELEASE", Build.VERSION.RELEASE, EXPECTED_RELEASES);
          assertEquals("Build.VERSION.SDK", "" + EXPECTED_SDK, Build.VERSION.SDK);
          assertEquals("Build.VERSION.SDK_INT", EXPECTED_SDK, Build.VERSION.SDK_INT);
      }
      
      错误的原因是CTS的版本路径不一样
     
 
 2.com.android.cts.browser.BrowserBenchTest --- testOctane
设置一个默认的浏览器即可
设置方法:
a.可以设置android 原生的浏览器: Browser
方法: 用短信的方式,发一个link到手机上,点击link 就可以设置一下默认浏览器
b. 需要设置google 的搜索引擎,
方法: 进入原生Browser -> setting -> Advanced -> Set search engine ->选择google

烦请按上述方法设置后再测试


 3.android.app.cts.SystemFeaturesTest#testSensorFeatures
 一般碰到这类问题比较好解决
 根据CTS的log分析
 junit.framework.AssertionFailedError: PackageManager#hasSystemFeature(android.hardware.sensor.compass) returns true but SensorManager#getSensorList(2) shows sensors [] expected: but was:
at junit.framework.Assert.fail(Assert.java:50)
是由于默认指南针(compass) Sensor功能是打开的,但是在system/etc/permissions/路径下面缺少android.hardware.sensor.compass.xml

解决方法:
如果指南针功能不支持,我们关闭对于的宏即可
如果指南针功能支持,在脚本中添加拷贝android.hardware.sensor.compass.xml 到system/etc/permissions/的代码


5.android.bionic.sys_resource#smoke
修改方法:usr版本即可pass

出现错误的原因是测试用的不是usr版本测试的



6.android.security.cts.ServicePermissionsTest        
-- testDumpProtected    ------- 可申请Waiver,不需要修改


7.android.security.cts.ListeningPortsTest        
-- testNoListeningLoopbackTcp6Ports    fail    
android.security.cts.ListeningPortsTest$ListeningPortsAssertionError:
Found port listening on addr=127.0.0.1, port=47269, UID=10085 [com.google.android.youtube] in /proc/net/tcp6 

------------------可以申请Waiver

你可能感兴趣的:(CTS)