Android4.4 CTS测试Fail项修改总结(三)

接上:Android4.4 CTS测试Fail项修改总结(二) 

----------------------------------------------------------------------

add 2015.05.19

Android5.1上的CTS测试

1、android.net.http.cts.ApacheHttpClientTest#testExecute_withMobile  fail

testExecute_withMobile这个函数的测试需要连接Wifi和插入Sim卡打开数据连接进行测试

cts-tf > run cts --class android.net.cts.ConnectivityManagerTest
05-19 15:36:11 I/TestInvocation: Starting invocation for 'cts' on build '5.1_r1' on device QKRCWCVCKNJNGAIJ
05-19 15:36:11 I/QKRCWCVCKNJNGAIJ: Created result dir 2015.05.19_15.36.11
05-19 15:36:11 I/CtsTest: ABIs: [armeabi-v7a, arm64-v8a]
05-19 15:36:29 I/QKRCWCVCKNJNGAIJ: Collecting device info
05-19 15:36:32 I/CtsTest: Start test run of 2 packages, containing 22 tests
05-19 15:36:32 I/QKRCWCVCKNJNGAIJ: -----------------------------------------
05-19 15:36:32 I/QKRCWCVCKNJNGAIJ: Test package arm64-v8a android.net started
05-19 15:36:32 I/QKRCWCVCKNJNGAIJ: -----------------------------------------
05-19 15:36:39 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testGetActiveNetworkInfo PASS 
05-19 15:36:39 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testGetAllNetworkInfo PASS 
05-19 15:36:39 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testGetNetworkInfo PASS 
05-19 15:36:39 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testIsNetworkSupported PASS 
05-19 15:36:39 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testIsNetworkTypeValid PASS 
05-19 15:36:39 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testRequestRouteToHost PASS 
05-19 15:36:39 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testSetNetworkPreference PASS 
05-19 15:36:39 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testStartUsingNetworkFeature PASS 
05-19 15:36:40 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testStartUsingNetworkFeature_enableHipri PASS 
05-19 15:36:40 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testTest PASS 
05-19 15:36:40 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testAndroidTestCaseSetupProperly PASS 
05-19 15:36:46 I/QKRCWCVCKNJNGAIJ: arm64-v8a android.net package complete: Passed 11, Failed 0, Not Executed 0
05-19 15:36:46 I/QKRCWCVCKNJNGAIJ: -----------------------------------------
05-19 15:36:46 I/QKRCWCVCKNJNGAIJ: Test package armeabi-v7a android.net started
05-19 15:36:46 I/QKRCWCVCKNJNGAIJ: -----------------------------------------
05-19 15:36:53 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testGetActiveNetworkInfo PASS 
05-19 15:36:53 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testGetAllNetworkInfo PASS 
05-19 15:36:53 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testGetNetworkInfo PASS 
05-19 15:36:53 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testIsNetworkSupported PASS 
05-19 15:36:53 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testIsNetworkTypeValid PASS 
05-19 15:36:54 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testRequestRouteToHost PASS 
05-19 15:36:54 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testSetNetworkPreference PASS 
05-19 15:36:54 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testStartUsingNetworkFeature PASS 
05-19 15:36:55 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testStartUsingNetworkFeature_enableHipri PASS 
05-19 15:36:55 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testTest PASS 
05-19 15:36:55 I/QKRCWCVCKNJNGAIJ: android.net.cts.ConnectivityManagerTest#testAndroidTestCaseSetupProperly PASS 
05-19 15:37:00 I/QKRCWCVCKNJNGAIJ: Saved log device_logcat_7504433802013984617.zip
05-19 15:37:03 I/QKRCWCVCKNJNGAIJ: Saved log host_log_363833763968039640.zip
05-19 15:37:03 I/QKRCWCVCKNJNGAIJ: armeabi-v7a android.net package complete: Passed 11, Failed 0, Not Executed 0
05-19 15:37:03 I/QKRCWCVCKNJNGAIJ: XML test result file generated at 2015.05.19_15.36.11. Passed 22, Failed 0, Not Executed 0
05-19 15:37:03 I/QKRCWCVCKNJNGAIJ: Time: 52s


----------------------------------------------------------------------

add 2015.04.22

Android5.0上的CTS测试

1、android.security.cts.KernelSettingsTest#testSELinuxEnforcing FAIL

测试结果

cts-tf > run cts -c android.security.cts.KernelSettingsTest -m testSELinuxEnforcing
04-22 17:20:24 I/TestInvocation: Starting invocation for 'cts' on build '5.0_r2' on device U4VWQSYDEIBAOBNR
04-22 17:20:24 I/U4VWQSYDEIBAOBNR: Created result dir 2015.04.22_17.20.24
04-22 17:20:24 I/CtsTest: ABIs: [armeabi-v7a, arm64-v8a]
04-22 17:20:31 I/U4VWQSYDEIBAOBNR: Collecting device info
04-22 17:20:33 I/CtsTest: Start test run of 2 packages, containing 2 tests
04-22 17:20:33 I/U4VWQSYDEIBAOBNR: -----------------------------------------
04-22 17:20:33 I/U4VWQSYDEIBAOBNR: Test package arm64-v8a android.security started
04-22 17:20:33 I/U4VWQSYDEIBAOBNR: -----------------------------------------
04-22 17:20:42 I/U4VWQSYDEIBAOBNR: android.security.cts.KernelSettingsTest#testSELinuxEnforcing FAIL 
junit.framework.ComparisonFailure: expected:<[1]> but was:<[0]>
at junit.framework.Assert.assertEquals(Assert.java:85)
at junit.framework.Assert.assertEquals(Assert.java:91)
at android.security.cts.KernelSettingsTest.testSELinuxEnforcing(KernelSettingsTest.java:42)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:115)
at junit.framework.TestResult.runProtected(TestResult.java:133)
at android.support.test.internal.runner.junit3.DelegatingTestResult.runProtected(DelegatingTestResult.java:90)
at junit.framework.TestResult.run(TestResult.java:118)
at android.support.test.internal.runner.junit3.AndroidTestResult.run(AndroidTestResult.java:52)
at junit.framework.TestCase.run(TestCase.java:124)
at android.support.test.internal.runner.junit3.NonLeakyTestSuite$NonLeakyTest.run(NonLeakyTestSuite.java:63)
at junit.framework.TestSuite.runTest(TestSuite.java:243)
at junit.framework.TestSuite.run(TestSuite.java:238)
at android.support.test.internal.runner.junit3.DelegatingTestSuite.run(DelegatingTestSuite.java:103)
at android.support.test.internal.runner.junit3.AndroidTestSuite.run(AndroidTestSuite.java:52)
at android.support.test.internal.runner.junit3.JUnit38ClassRunner.run(JUnit38ClassRunner.java:90)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:24)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
at org.junit.runner.JUnitCore.run(JUnitCore.java:136)
at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:245)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1851)

04-22 17:20:45 I/U4VWQSYDEIBAOBNR: arm64-v8a android.security package complete: Passed 0, Failed 1, Not Executed 0
04-22 17:20:45 I/U4VWQSYDEIBAOBNR: -----------------------------------------
04-22 17:20:45 I/U4VWQSYDEIBAOBNR: Test package armeabi-v7a android.security started
04-22 17:20:45 I/U4VWQSYDEIBAOBNR: -----------------------------------------
04-22 17:20:54 I/U4VWQSYDEIBAOBNR: android.security.cts.KernelSettingsTest#testSELinuxEnforcing FAIL 
junit.framework.ComparisonFailure: expected:<[1]> but was:<[0]>
at junit.framework.Assert.assertEquals(Assert.java:85)
at junit.framework.Assert.assertEquals(Assert.java:91)
at android.security.cts.KernelSettingsTest.testSELinuxEnforcing(KernelSettingsTest.java:42)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:115)
at junit.framework.TestResult.runProtected(TestResult.java:133)
at android.support.test.internal.runner.junit3.DelegatingTestResult.runProtected(DelegatingTestResult.java:90)
at junit.framework.TestResult.run(TestResult.java:118)
at android.support.test.internal.runner.junit3.AndroidTestResult.run(AndroidTestResult.java:52)
at junit.framework.TestCase.run(TestCase.java:124)
at android.support.test.internal.runner.junit3.NonLeakyTestSuite$NonLeakyTest.run(NonLeakyTestSuite.java:63)
at junit.framework.TestSuite.runTest(TestSuite.java:243)
at junit.framework.TestSuite.run(TestSuite.java:238)
at android.support.test.internal.runner.junit3.DelegatingTestSuite.run(DelegatingTestSuite.java:103)
at android.support.test.internal.runner.junit3.AndroidTestSuite.run(AndroidTestSuite.java:52)
at android.support.test.internal.runner.junit3.JUnit38ClassRunner.run(JUnit38ClassRunner.java:90)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:24)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
at org.junit.runner.JUnitCore.run(JUnitCore.java:136)
at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:245)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1851)

04-22 17:20:56 I/U4VWQSYDEIBAOBNR: Saved log device_logcat_13978149336460647.zip
04-22 17:20:56 I/U4VWQSYDEIBAOBNR: Saved log host_log_1021717706747469289.zip
04-22 17:20:56 I/U4VWQSYDEIBAOBNR: armeabi-v7a android.security package complete: Passed 0, Failed 1, Not Executed 0
04-22 17:20:56 I/U4VWQSYDEIBAOBNR: XML test result file generated at 2015.04.22_17.20.24. Passed 0, Failed 2, Not Executed 0
04-22 17:20:56 I/U4VWQSYDEIBAOBNR: Time: 31s
原因:为了方便user版本调试,开启了MTK_BUILD_ROOT这个宏,导致编出来的user版本,adb shell具有root权限,同时,selinux的状态变成permissive。

解决办法:去掉MTK_BUILD_ROOT这个宏

关于如何设置确认selinux 模式

[Description]
linux SELinux 分成Enforce 以及 Permissive 两种模式,如何进行设置与确认当前SELinux模式?

[Keyword]
android, SELinux, Enforce, Permissive

[Solution]
在Android KK 4.4 版本后,Google 有正式有限制的启用SELinux, 来增强android 的安全保护。
在ENG 版本中, 可以使用setenforce 命令进行设置:
adb shell setenforce 0 //设置成permissive 模式
adb shell setenforce 1 //设置成enforce 模式

在ENG/USER 版本中,都可以使用getenforce 命令进行查询,如:
root@mt6589_phone_720pv2:/ # getenforce
getenforce
Enforcing

如果想开机一启动就设置模式,你可以用下面方式:
KK 版本:更新mediatek/custom/{platform}/lk/rules_platform.mk
L 版本: 更新bootable/bootloader/lk/platform/mt6xxx/rules.mk
# choose one of following value -> 1: disabled/ 2: permissive /3: enforcing
SELINUX_STATUS := 3
可直接调整这个SELINUX_STATUS这个的值为2或者1

注意的是, 在L 版本上, Google 要求强制性开启enforcing mode, 前面的设置只针对userdebug, eng 版本有效, 如果要对user 版本有效, 需要修改system/core/init/Android.mk 新增
ifeq ($(strip $(TARGET_BUILD_VARIANT)),user)
LOCAL_CFLAGS += -DALLOW_DISABLE_SELINUX=1
endif


需要注意的是, Google 要求强制性开启SELinux Enforcing Mode, 如果您关闭,将无法通过Google CTS. 


2、android.security.cts.KernelSettingsTest -- testSetuidDumpable Fail

[DESCRIPTION]
android.security.cts.KernelSettingsTest -- testSetuidDumpable Fail

[SOLUTION]
在eng build下testSetuidDumpable 会fail,
原因是AEE require this feature to do full memory dump (coredump) of NE processes。
请使用user build验证,在user build下即可pass.

----------------------------------------------------------------------

以下测试是在Android4.4上

6、android.provider.cts.ContactsContractIntentsTest#testGetContentContactDir fail

cts-tf > run cts --class android.provider.cts.ContactsContractIntentsTest
03-27 15:51:52 I/TestInvocation: Starting invocation for 'cts' on build '4.4_r3' on device KZWOLBGURWWO4PNZ
03-27 15:51:52 I/KZWOLBGURWWO4PNZ: Created result dir 2015.03.27_15.51.52
03-27 15:52:06 I/KZWOLBGURWWO4PNZ: Collecting device info
03-27 15:52:07 I/KZWOLBGURWWO4PNZ: -----------------------------------------
03-27 15:52:07 I/KZWOLBGURWWO4PNZ: Test package android.provider started
03-27 15:52:07 I/KZWOLBGURWWO4PNZ: -----------------------------------------
03-27 15:52:10 I/KZWOLBGURWWO4PNZ: android.provider.cts.ContactsContractIntentsTest#testGetContentContactDir FAIL 
junit.framework.AssertionFailedError: No ResolveInfo found for Intent { act=android.intent.action.GET_CONTENT dat=content://com.android.contacts/contacts }
at android.provider.cts.ContactsContractIntentsTest.assertCanBeHandled(ContactsContractIntentsTest.java:35)
at android.provider.cts.ContactsContractIntentsTest.testGetContentContactDir(ContactsContractIntentsTest.java:54)
at java.lang.reflect.Method.invokeNative(Native Method)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1710)

03-27 15:52:10 I/KZWOLBGURWWO4PNZ: android.provider.cts.ContactsContractIntentsTest#testPickContactDir PASS 
03-27 15:52:10 I/KZWOLBGURWWO4PNZ: android.provider.cts.ContactsContractIntentsTest#testViewContactDir PASS 
03-27 15:52:10 I/KZWOLBGURWWO4PNZ: android.provider.cts.ContactsContractIntentsTest#testAndroidTestCaseSetupProperly PASS 
03-27 15:52:13 I/KZWOLBGURWWO4PNZ: Saved log device_logcat_2628239777255878754.zip
03-27 15:52:14 I/KZWOLBGURWWO4PNZ: Saved log host_log_1858793513168321780.zip
03-27 15:52:14 I/KZWOLBGURWWO4PNZ: android.provider package complete: Passed 3, Failed 1, Not Executed 0
03-27 15:52:14 I/KZWOLBGURWWO4PNZ: XML test result file generated at 2015.03.27_15.51.52. Passed 3, Failed 1, Not Executed 0
03-27 15:52:14 I/KZWOLBGURWWO4PNZ: Time: 0s
由以上信息可以看到需要Intent:act=android.intent.action.GET_CONTENT dat=content://com.android.contacts/contacts

查看:frameworks/base/packages/DocumentsUI/AndroidManifest.xml文件



    
    

    

        
        
            
                
                
                
                
            
            
                
                
                
                
            
	    
            
                
                
                
            
        

        

        

        
            
                
                
                
            
        

        
        
            
                
                
                
            
        
    
相应的Intent已经被注释了:action android:name="android.intent.action.GET_CONTENT"

去掉注释


                
                
                
                
            

编译后重新测试

cts-tf > run cts --class android.provider.cts.ContactsContractIntentsTest
03-27 16:03:21 I/TestInvocation: Starting invocation for 'cts' on build '4.4_r3' on device KZWOLBGURWWO4PNZ
03-27 16:03:21 I/KZWOLBGURWWO4PNZ: Created result dir 2015.03.27_16.03.21
03-27 16:03:35 I/KZWOLBGURWWO4PNZ: Collecting device info
03-27 16:03:37 I/KZWOLBGURWWO4PNZ: -----------------------------------------
03-27 16:03:37 I/KZWOLBGURWWO4PNZ: Test package android.provider started
03-27 16:03:37 I/KZWOLBGURWWO4PNZ: -----------------------------------------
03-27 16:03:40 I/KZWOLBGURWWO4PNZ: android.provider.cts.ContactsContractIntentsTest#testGetContentContactDir PASS 
03-27 16:03:40 I/KZWOLBGURWWO4PNZ: android.provider.cts.ContactsContractIntentsTest#testPickContactDir PASS 
03-27 16:03:40 I/KZWOLBGURWWO4PNZ: android.provider.cts.ContactsContractIntentsTest#testViewContactDir PASS 
03-27 16:03:40 I/KZWOLBGURWWO4PNZ: android.provider.cts.ContactsContractIntentsTest#testAndroidTestCaseSetupProperly PASS 
03-27 16:03:44 I/KZWOLBGURWWO4PNZ: Saved log device_logcat_574386922107803325.zip
03-27 16:03:45 I/KZWOLBGURWWO4PNZ: Saved log host_log_9046918507764649358.zip
03-27 16:03:45 I/KZWOLBGURWWO4PNZ: android.provider package complete: Passed 4, Failed 0, Not Executed 0
03-27 16:03:45 I/KZWOLBGURWWO4PNZ: XML test result file generated at 2015.03.27_16.03.21. Passed 4, Failed 0, Not Executed 0
03-27 16:03:45 I/KZWOLBGURWWO4PNZ: Time: 0s

7、android.view.inputmethod.cts.InputMethodInfoTest#testInputMethodSubtypesOfSystemImes FAIL

cts-tf > run cts --class android.view.inputmethod.cts.InputMethodInfoTest
03-30 11:43:32 I/TestInvocation: Starting invocation for 'cts' on build '4.4_r3' on device KZWOLBGURWWO4PNZ
03-30 11:43:32 I/KZWOLBGURWWO4PNZ: Created result dir 2015.03.30_11.43.32
03-30 11:43:44 I/KZWOLBGURWWO4PNZ: Collecting device info
03-30 11:43:45 I/KZWOLBGURWWO4PNZ: -----------------------------------------
03-30 11:43:45 I/KZWOLBGURWWO4PNZ: Test package android.view started
03-30 11:43:45 I/KZWOLBGURWWO4PNZ: -----------------------------------------
03-30 11:43:48 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testDump PASS 
03-30 11:43:48 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testEquals PASS 
03-30 11:43:48 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testInputMethodInfoProperties PASS 
03-30 11:43:48 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testInputMethodInfoWriteToParcel PASS 
03-30 11:43:48 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testInputMethodSubtypeProperties PASS 
03-30 11:43:49 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testInputMethodSubtypeWriteToParcel PASS 
03-30 11:43:49 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testInputMethodSubtypesOfSystemImes FAIL 
junit.framework.AssertionFailedError
at android.view.inputmethod.cts.InputMethodInfoTest.testInputMethodSubtypesOfSystemImes(InputMethodInfoTest.java:210)
at java.lang.reflect.Method.invokeNative(Native Method)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1710)

03-30 11:43:49 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testLoadIcon PASS 
03-30 11:43:49 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testLoadLabel PASS 
03-30 11:43:49 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testAndroidTestCaseSetupProperly PASS 
03-30 11:43:52 I/KZWOLBGURWWO4PNZ: Saved log device_logcat_8618331853760797617.zip
03-30 11:43:53 I/KZWOLBGURWWO4PNZ: Saved log host_log_2921070573061312096.zip
03-30 11:43:53 I/KZWOLBGURWWO4PNZ: android.view package complete: Passed 9, Failed 1, Not Executed 0
03-30 11:43:53 I/KZWOLBGURWWO4PNZ: XML test result file generated at 2015.03.30_11.43.32. Passed 9, Failed 1, Not Executed 0
03-30 11:43:53 I/KZWOLBGURWWO4PNZ: Time: 0s
由于InputMethodInfoTest是测试输入法的,首先检查下手机是否有默认安装三方的输入法,我的系统确实安装了“讯飞输入法”,卸载后可以Pass

cts-tf > run cts --class android.view.inputmethod.cts.InputMethodInfoTest
03-30 12:51:59 I/TestInvocation: Starting invocation for 'cts' on build '4.4_r3' on device KZWOLBGURWWO4PNZ
03-30 12:51:59 I/KZWOLBGURWWO4PNZ: Created result dir 2015.03.30_12.51.59
03-30 12:52:11 I/KZWOLBGURWWO4PNZ: Collecting device info
03-30 12:52:12 I/KZWOLBGURWWO4PNZ: -----------------------------------------
03-30 12:52:12 I/KZWOLBGURWWO4PNZ: Test package android.view started
03-30 12:52:12 I/KZWOLBGURWWO4PNZ: -----------------------------------------
03-30 12:52:15 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testDump PASS 
03-30 12:52:15 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testEquals PASS 
03-30 12:52:15 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testInputMethodInfoProperties PASS 
03-30 12:52:15 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testInputMethodInfoWriteToParcel PASS 
03-30 12:52:15 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testInputMethodSubtypeProperties PASS 
03-30 12:52:15 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testInputMethodSubtypeWriteToParcel PASS 
03-30 12:52:15 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testInputMethodSubtypesOfSystemImes PASS 
03-30 12:52:15 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testLoadIcon PASS 
03-30 12:52:15 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testLoadLabel PASS 
03-30 12:52:15 I/KZWOLBGURWWO4PNZ: android.view.inputmethod.cts.InputMethodInfoTest#testAndroidTestCaseSetupProperly PASS 
03-30 12:52:19 I/KZWOLBGURWWO4PNZ: Saved log device_logcat_6078470193595290540.zip
03-30 12:52:19 I/KZWOLBGURWWO4PNZ: Saved log host_log_7433027168260089475.zip
03-30 12:52:19 I/KZWOLBGURWWO4PNZ: android.view package complete: Passed 10, Failed 0, Not Executed 0
03-30 12:52:19 I/KZWOLBGURWWO4PNZ: XML test result file generated at 2015.03.30_12.51.59. Passed 10, Failed 0, Not Executed 0
03-30 12:52:19 I/KZWOLBGURWWO4PNZ: Time: 0s

有一个小的问题

如果这个三方输入法安装到/system/app/目录下,即使不把三方输入法选为默认输入法,该项测试也是Fail

如果是安装到/data/app/目录下,即使把三方输入法选为默认输入法,该项测试Pass

由于系统预置了讯飞输入导致此问题Fail,在CTS中会检查输入法的subtypeCount > 0,有以下几种解决办法
1、去掉预置的讯飞输入法或预置的讯飞输入法不要安装到/system/app/上,安装到/data/app/
2、让三方讯飞输入法修改声明自己支持的subtype

8、android.provider.cts.Contacts_PeopleTest#testAccessPhotoData FAIL

cts-tf > run cts -c android.provider.cts.Contacts_PeopleTest -m testAccessPhotoData 
04-25 11:42:53 I/TestInvocation: Starting invocation for 'cts' on build '4.4_r3' on device KZWOLBGURWWO4PNZ
04-25 11:42:53 I/KZWOLBGURWWO4PNZ: Created result dir 2015.04.25_11.42.53
04-25 11:43:05 I/KZWOLBGURWWO4PNZ: Collecting device info
04-25 11:43:07 I/KZWOLBGURWWO4PNZ: -----------------------------------------
04-25 11:43:07 I/KZWOLBGURWWO4PNZ: Test package android.provider started
04-25 11:43:07 I/KZWOLBGURWWO4PNZ: -----------------------------------------
04-25 11:43:11 I/KZWOLBGURWWO4PNZ: android.provider.cts.Contacts_PeopleTest#testAccessPhotoData FAIL 
junit.framework.AssertionFailedError: expected:<96> but was:<150>
at android.provider.cts.Contacts_PeopleTest.testAccessPhotoData(Contacts_PeopleTest.java:265)
at java.lang.reflect.Method.invokeNative(Native Method)
at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214)
at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1710)

04-25 11:43:15 I/KZWOLBGURWWO4PNZ: Saved log device_logcat_6005936897661563832.zip
04-25 11:43:16 I/KZWOLBGURWWO4PNZ: Saved log host_log_1931063194281753243.zip
04-25 11:43:16 I/KZWOLBGURWWO4PNZ: android.provider package complete: Passed 0, Failed 1, Not Executed 0
04-25 11:43:16 I/KZWOLBGURWWO4PNZ: XML test result file generated at 2015.04.25_11.42.53. Passed 0, Failed 1, Not Executed 0
04-25 11:43:16 I/KZWOLBGURWWO4PNZ: Time: 0s
从上面打印出来的log可以看出值被修改了

找到providers/ContactsProvider/src/com/android/providers/contacts/PhotoProcessor.java文件,这个类的关键代码如下:

 /**
 75      * The default sizes of a thumbnail/display picture. This is used in {@link #initialize()}
 76      */
 77     private interface PhotoSizes {
 78         /** Size of a thumbnail */
 79         public static final int DEFAULT_THUMBNAIL = 96;
 80 
 81         /**
 82          * Size of a display photo on memory constrained devices (those are devices with less than
 83          * {@link #DEFAULT_LARGE_RAM_THRESHOLD} of reported RAM
 84          */
 85         public static final int DEFAULT_DISPLAY_PHOTO_MEMORY_CONSTRAINED = 480;
 86 
 87         /**
 88          * Size of a display photo on devices with enough ram (those are devices with at least
 89          * {@link #DEFAULT_LARGE_RAM_THRESHOLD} of reported RAM
 90          */
 91         public static final int DEFAULT_DISPLAY_PHOTO_LARGE_MEMORY = 720;
 92 
 93         /**
 94          * If the device has less than this amount of RAM, it is considered RAM constrained for
 95          * photos
 96          */
 97         public static final int LARGE_RAM_THRESHOLD = 640 * 1024 * 1024;
 98 
 99         /** If present, overrides the size given in {@link #DEFAULT_THUMBNAIL} */
100         public static final String SYS_PROPERTY_THUMBNAIL_SIZE = "contacts.thumbnail_size";
101 
102         /** If present, overrides the size determined for the display photo */
103         public static final String SYS_PROPERTY_DISPLAY_PHOTO_SIZE = "contacts.display_photo_size";
104     }
static {
 61         final boolean isExpensiveDevice =
 62                 MemoryUtils.getTotalMemorySize() >= PhotoSizes.LARGE_RAM_THRESHOLD;
 63 
 64         sMaxThumbnailDim = SystemProperties.getInt(
 65                 PhotoSizes.SYS_PROPERTY_THUMBNAIL_SIZE, PhotoSizes.DEFAULT_THUMBNAIL);
 66 
 67         sMaxDisplayPhotoDim = SystemProperties.getInt(
 68                 PhotoSizes.SYS_PROPERTY_DISPLAY_PHOTO_SIZE,
 69                 isExpensiveDevice
 70                         ? PhotoSizes.DEFAULT_DISPLAY_PHOTO_LARGE_MEMORY
 71                         : PhotoSizes.DEFAULT_DISPLAY_PHOTO_MEMORY_CONSTRAINED);
 72     }
缩略图的大小会从以下得到

sMaxThumbnailDim = SystemProperties.getInt(
                  PhotoSizes.SYS_PROPERTY_THUMBNAIL_SIZE, PhotoSizes.DEFAULT_THUMBNAIL);
如果这个值PhotoSizes.SYS_PROPERTY_THUMBNAIL_SIZE不存在,就会使用:public static final int DEFAULT_THUMBNAIL = 96,但从log看得到的值为150,说明那个属性存在并且就是150,可以用以下方法验证猜测

dzt@uu:~$ adb shell getprop | grep size
[contacts.thumbnail_size]: [150]
可以手动修改这个值

adb shell setprop contacts.thumbnail_size 96

再验证:

cts-tf > run cts -c android.provider.cts.Contacts_PeopleTest -m testAccessPhotoData
04-27 17:49:11 I/TestInvocation: Starting invocation for 'cts' on build '4.4_r3' on device KZWOLBGURWWO4PNZ
04-27 17:49:11 I/KZWOLBGURWWO4PNZ: Created result dir 2015.04.27_17.49.11
04-27 17:49:25 I/KZWOLBGURWWO4PNZ: Collecting device info
04-27 17:49:26 I/KZWOLBGURWWO4PNZ: -----------------------------------------
04-27 17:49:26 I/KZWOLBGURWWO4PNZ: Test package android.provider started
04-27 17:49:26 I/KZWOLBGURWWO4PNZ: -----------------------------------------
04-27 17:49:31 I/KZWOLBGURWWO4PNZ: android.provider.cts.Contacts_PeopleTest#testAccessPhotoData PASS 
04-27 17:49:34 I/KZWOLBGURWWO4PNZ: Saved log device_logcat_2708477654268554547.zip
04-27 17:49:35 I/KZWOLBGURWWO4PNZ: Saved log host_log_9065571898609841358.zip
04-27 17:49:35 I/KZWOLBGURWWO4PNZ: android.provider package complete: Passed 1, Failed 0, Not Executed 0
04-27 17:49:35 I/KZWOLBGURWWO4PNZ: Created xml report file at file:///home/dzt/dzt/cts/4.4/android-cts/tools/./../../android-cts/repository/results/2015.04.27_17.49.11/testResult.xml
04-27 17:49:35 I/KZWOLBGURWWO4PNZ: XML test result file generated at 2015.04.27_17.49.11. Passed 1, Failed 0, Not Executed 0
04-27 17:49:35 I/KZWOLBGURWWO4PNZ: Time: 0s
当然并不能用adb shell setprop contacts.thumbnail_size 96修改,需要找到定义的地方,一般是一些工程配置文件上,如.mk文件

你可能感兴趣的:(CTS,GTS)