当前位置:   article > 正文

Android CTS测试Fail项修改总结(四)_cts fail项修改

cts fail项修改

Android5.1上的测试

1、android.security.cts.SELinuxDomainTest# testInitDomain fail

打印的log

  1. junit.framework.AssertionFailedError: Expected 1 process in SELinux domain "u:r:init:s0" Found
  2. "[
  3. pid: "1" proctitle: "/init" label: "u:r:init:s0" vsize: 1327104,
  4. pid: "298" proctitle: "/system/bin/immvibed" label: "u:r:init:s0" vsize: 1765376
  5. ]"
  6. expected:<1> but was:<2> at junit.framework.Assert.fail(Assert.java:50)
这个是典型的L 版本SELinux Test 问题.
android.security.cts.SELinuxDomainTest 有1项fail,
-- testInitDomain
junit.framework.AssertionFailedError: Expected 1 process in SELinux domain "u:r:init:s0" Found "[pid: "1" proctitle: "/init" label: "u:r:init:s0" vsize: 1327104, pid: "298" proctitle: "/system/bin/immvibed" label: "u:r:init:s0" vsize: 1765376]" expected:<1> but was:<2> at junit.framework.Assert.fail(Assert.java:50)

其关键原因是因为 Google 强调系统关键进程的SELinux Context 必须唯一, 系统关键进程包括如 init, vold, surfaceflinger, netd, servicemanager, drmserver 等等. 一旦发现有多个process 同时使用这些关键的domain 则SELinux Test fail.

为此要求,系统关键进程启动长时间运行的process, 必须进行domain 切换. 否则将无法通过Google CTS test.

典型情况就是通过init 启动某个 service, 而没有对这个service 进行domain 切换. 比如贵司这个问题中 suntrold_32 这个 service 没有进行domain 切换, 成而无法通过测试.

下面是一个简单的demo.
情景: 定义一个init 启动的service, demo_service, 对应的执行档是/system/bin/demo.
(1). 创建一个demo.te 在/device/mediatke/common/sepolicy 目录下, 然后在/device/mediatke/common/BoardConfig.mk 的BOARD_SEPOLICY_UNION 宏中新增 demo.te
(2). 定义demo 类型,init 启动service 时类型转换, demo.te 中
type demo, domain;
type demo_exec, exec_type, file_type;
init_daemon_domain(demo)
(3). 绑定执行档 file_context 类型
/system/bin/demo u:object_r:demo_exec:s0
(4). 根据demo 需要访问的文件以及设备, 定义其它的权限在demo.te 中.

典型情况就是通过init 启动某个 service, 而没有对这个service 进行domain 切换. 比如这个问题中immvibed 这个 service 没有进行domain 切换, 从而无法通过测试.只需按照demo修改即可.

2、android.webgl.cts.WebGLTest#test_conformance_extensions_oes_texture_float_with_canvas_html  fail

去掉GMS中的WebViewGoogle.apk使用WebView.apk可以Pass,如果国内版本一定要集成WebViewGoogle.apk只能申请豁免,可参考以下链接
https://code.google.com/p/chromium/issues/detail?id=482278
集成WebViewGoogle.apk后,由于这是 Chromium 42 版 common 的问题, 无法修改, 可拿 chromium bug report 的资料与 Google 讨论, waive 此问题

3、com.android.cts.appsecurity.AppSecurityTests#2项  fail

【步骤】Compatibility Test Package: android.tests.appsecurity ABI
com.android.cts.appsecurity.AppSecurityTests
-- testExternalStorageNone
-- testExternalStorageWrite
【现象】
com.android.cts.tradefed.testtype.TestTimeoutException at com.android.cts.tradefed.testtype.JarHostTest.runTest(JarHostTest.java:223)

分析思路:

1、首先确认测试时是否有插入SD卡,因在此项测试需要插入SD卡才能通过

2、如果插入SD卡还是Fail,

请确认下在sdcard.c(system/core/sdcard/)中是否把mtklogger中的support write permission部分代码加上导致的.
如果没有请把/frameworks/base/data/etc/platform.xml中WRITE_EXTERNAL_STORAGE去除group id="media_rw"再进行测试

3、如果init.rc中有export SECONDARY_STORAGE /storage/sdcard1,去掉再测试

4、以上步骤验证完后还是Fail,经过版本对比,发现是YuloreFrameWork.apk引起的,删除后测试pass

  1. cts-tf > run cts --class com.android.cts.appsecurity.AppSecurityTests
  2. 06-29 10:10:46 I/TestInvocation: Starting invocation for 'cts' on build '5.1_r1' on device AYEMA6YHKVNJQOIZ
  3. 06-29 10:10:46 I/AYEMA6YHKVNJQOIZ: Created result dir 2015.06.29_10.10.46
  4. 06-29 10:10:47 I/CtsTest: ABIs: [armeabi-v7a, arm64-v8a]
  5. 06-29 10:11:01 I/AYEMA6YHKVNJQOIZ: Collecting device info
  6. 06-29 10:11:03 I/CtsTest: Start test run of 2 packages, containing 22 tests
  7. 06-29 10:11:03 I/AYEMA6YHKVNJQOIZ: -----------------------------------------
  8. 06-29 10:11:03 I/AYEMA6YHKVNJQOIZ: Test package arm64-v8a android.tests.appsecurity started
  9. 06-29 10:11:03 I/AYEMA6YHKVNJQOIZ: -----------------------------------------
  10. 06-29 10:11:23 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testAppFailAccessPrivateData PASS
  11. 06-29 10:11:32 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testAppUpgradeDifferentCerts PASS
  12. 06-29 10:11:59 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testExternalStorageGifts PASS
  13. 06-29 10:12:10 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testExternalStorageNone PASS
  14. 06-29 10:12:20 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testExternalStorageRead PASS
  15. 06-29 10:12:31 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testExternalStorageWrite PASS
  16. 06-29 10:12:47 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testInstrumentationDiffCert PASS
  17. 06-29 10:12:49 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testMultiUserStorage PASS
  18. 06-29 10:14:06 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testPermissionDiffCert PASS
  19. 06-29 10:14:17 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testSharedUidDifferentCerts PASS
  20. 06-29 10:14:34 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testUninstallRemovesData PASS
  21. 06-29 10:14:37 I/AYEMA6YHKVNJQOIZ: arm64-v8a android.tests.appsecurity package complete: Passed 11, Failed 0, Not Executed 0
  22. 06-29 10:14:37 I/AYEMA6YHKVNJQOIZ: -----------------------------------------
  23. 06-29 10:14:37 I/AYEMA6YHKVNJQOIZ: Test package armeabi-v7a android.tests.appsecurity started
  24. 06-29 10:14:37 I/AYEMA6YHKVNJQOIZ: -----------------------------------------
  25. 06-29 10:14:57 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testAppFailAccessPrivateData PASS
  26. 06-29 10:15:06 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testAppUpgradeDifferentCerts PASS
  27. 06-29 10:15:32 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testExternalStorageGifts PASS
  28. 06-29 10:15:43 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testExternalStorageNone PASS
  29. 06-29 10:15:53 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testExternalStorageRead PASS
  30. 06-29 10:16:04 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testExternalStorageWrite PASS
  31. 06-29 10:16:20 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testInstrumentationDiffCert PASS
  32. 06-29 10:16:22 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testMultiUserStorage PASS
  33. 06-29 10:17:43 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testPermissionDiffCert PASS
  34. 06-29 10:17:56 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testSharedUidDifferentCerts PASS
  35. 06-29 10:18:16 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testUninstallRemovesData PASS
  36. 06-29 10:18:21 I/AYEMA6YHKVNJQOIZ: Saved log device_logcat_892804764496421781.zip
  37. 06-29 10:18:25 I/AYEMA6YHKVNJQOIZ: Saved log host_log_3382781982890595027.zip
  38. 06-29 10:18:25 I/AYEMA6YHKVNJQOIZ: armeabi-v7a android.tests.appsecurity package complete: Passed 11, Failed 0, Not Executed 0
  39. 06-29 10:18:25 I/AYEMA6YHKVNJQOIZ: XML test result file generated at 2015.06.29_10.10.46. Passed 22, Failed 0, Not Executed 0
  40. 06-29 10:18:25 I/AYEMA6YHKVNJQOIZ: Time: 7m 38s

4、android.media.cts.DecodeEditEncodeTest#testVideoEdit720p fail

【步骤】Compatibility Test Package: android.media ABI
android.media.cts.DecodeEditEncodeTest
-- testVideoEdit720p
【现象】
junit.framework.AssertionFailedError: Found 29 bad frames at junit.framework.Assert.fail(Assert.java:50)
这个问题与android.media.cts.EncodeDecodeTest#2项  fail属于同一个原因引起的

【步骤】Compatibility Test Package: android.media ABI
android.media.cts.EncodeDecodeTest
-- testEncodeDecodeVideoFromSurfaceToSurface720p
-- testVP8EncodeDecodeVideoFromSurfaceToSurface720p
【现象】
junit.framework.AssertionFailedError: Found 29 bad frames at junit.framework.Assert.fail(Assert.java:50)

修改方案:

root cause:
PQ_ADL_INDEX_DEFAULT默认打开,会对画面做处理,导致色点有误差。
solution:
修改alps/vendor/mediatek/proprietary/platform/mt6795/hardware/pq/cust_color.h这个文件

    #define PQ_ADL_INDEX_DEFAULT                "1”
改为
    #define PQ_ADL_INDEX_DEFAULT                "0”

5、com.android.cts.devicepolicy.DeviceOwnerTest Fail

测试部分结果

  1. cts-tf > run cts --class com.android.cts.devicepolicy.DeviceOwnerTest
  2. 07-08 11:31:36 I/TestInvocation: Starting invocation for 'cts' on build '5.1_r1' on device 8ef2d4c2
  3. 07-08 11:31:36 I/8ef2d4c2: Created result dir 2015.07.08_11.31.36
  4. 07-08 11:31:36 I/CtsTest: ABIs: [armeabi-v7a, arm64-v8a]
  5. 07-08 11:31:48 I/8ef2d4c2: Collecting device info
  6. 07-08 11:31:50 I/CtsTest: Start test run of 2 packages, containing 14 tests
  7. 07-08 11:31:50 I/8ef2d4c2: -----------------------------------------
  8. 07-08 11:31:50 I/8ef2d4c2: Test package arm64-v8a android.adminhostside started
  9. 07-08 11:31:50 I/8ef2d4c2: -----------------------------------------
  10. 07-08 11:31:50 I/BaseDevicePolicyTest: Installing app CtsDeviceOwnerApp.apk
  11. 07-08 11:31:55 I/DeviceOwnerTest: Output for command dpm set-device-owner 'com.android.cts.deviceowner/com.android.cts.deviceowner.BaseDeviceOwnerTest$BasicAdminReceiver': java.lang.IllegalStateException: Trying to set device owner but device is already provisioned.
  12. at android.os.Parcel.readException(Parcel.java:1569)
  13. at android.os.Parcel.readException(Parcel.java:1509)
  14. at android.app.admin.IDevicePolicyManager$Stub$Proxy.setDeviceOwner(IDevicePolicyManager.java:3212)
  15. at com.android.commands.dpm.Dpm.runSetDeviceOwner(Dpm.java:114)
  16. at com.android.commands.dpm.Dpm.onRun(Dpm.java:82)
  17. at com.android.internal.os.BaseCommand.run(BaseCommand.java:47)
  18. at com.android.commands.dpm.Dpm.main(Dpm.java:38)
  19. at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
  20. at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:249)
  21. 07-08 11:31:55 I/8ef2d4c2: com.android.cts.devicepolicy.DeviceOwnerTest#testApplicationRestrictions FAIL
  22. junit.framework.AssertionFailedError: java.lang.IllegalStateException: Trying to set device owner but device is already provisioned.
  23. at android.os.Parcel.readException(Parcel.java:1569)
  24. at android.os.Parcel.readException(Parcel.java:1509)
  25. at android.app.admin.IDevicePolicyManager$Stub$Proxy.setDeviceOwner(IDevicePolicyManager.java:3212)
  26. at com.android.commands.dpm.Dpm.runSetDeviceOwner(Dpm.java:114)
  27. at com.android.commands.dpm.Dpm.onRun(Dpm.java:82)
  28. at com.android.internal.os.BaseCommand.run(BaseCommand.java:47)
  29. at com.android.commands.dpm.Dpm.main(Dpm.java:38)
  30. at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
  31. at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:249)
  32. expected to start with "Success:"
  33. at junit.framework.Assert.fail(Assert.java:50)
  34. at junit.framework.Assert.assertTrue(Assert.java:20)
  35. at com.android.cts.devicepolicy.DeviceOwnerTest.setDeviceOwner(DeviceOwnerTest.java:96)
  36. at com.android.cts.devicepolicy.DeviceOwnerTest.setUp(DeviceOwnerTest.java:41)
  37. at junit.framework.TestCase.runBare(TestCase.java:132)
  38. at com.android.tradefed.testtype.DeviceTestResult$1.protect(DeviceTestResult.java:81)
  39. at com.android.tradefed.testtype.DeviceTestResult.runProtected(DeviceTestResult.java:56)
  40. at com.android.tradefed.testtype.DeviceTestResult.run(DeviceTestResult.java:85)
  41. at junit.framework.TestCase.run(TestCase.java:124)
  42. at com.android.tradefed.testtype.DeviceTestCase.run(DeviceTestCase.java:117)
  43. at com.android.cts.tradefed.testtype.JarHostTest$TestRunnable.run(JarHostTest.java:248)
  44. at com.android.tradefed.util.RunUtil$RunnableNotifier.run(RunUtil.java:346)
提示:java.lang.IllegalStateException: Trying to set device owner but device is already provisioned.已经存在device owner

解决思路:

去设置-》高级设置-》帐户  中查看

已经存在一个账户了,需要删除这个帐户,方法如下:

删除后重新测试

  1. cts-tf > run cts --class com.android.cts.devicepolicy.DeviceOwnerTest
  2. 07-08 11:38:25 I/TestInvocation: Starting invocation for 'cts' on build '5.1_r1' on device 8ef2d4c2
  3. 07-08 11:38:25 I/8ef2d4c2: Created result dir 2015.07.08_11.38.25
  4. 07-08 11:38:25 I/CtsTest: ABIs: [armeabi-v7a, arm64-v8a]
  5. 07-08 11:38:37 I/8ef2d4c2: Collecting device info
  6. 07-08 11:38:39 I/CtsTest: Start test run of 2 packages, containing 14 tests
  7. 07-08 11:38:39 I/8ef2d4c2: -----------------------------------------
  8. 07-08 11:38:39 I/8ef2d4c2: Test package arm64-v8a android.adminhostside started
  9. 07-08 11:38:39 I/8ef2d4c2: -----------------------------------------
  10. 07-08 11:38:40 I/BaseDevicePolicyTest: Installing app CtsDeviceOwnerApp.apk
  11. 07-08 11:38:44 I/DeviceOwnerTest: Output for command dpm set-device-owner 'com.android.cts.deviceowner/com.android.cts.deviceowner.BaseDeviceOwnerTest$BasicAdminReceiver': Success: Device owner set to package com.android.cts.deviceowner
  12. Active admin set to component {com.android.cts.deviceowner/com.android.cts.deviceowner.BaseDeviceOwnerTest$BasicAdminReceiver}
  13. 07-08 11:38:46 I/BaseDevicePolicyTest: Test com.android.cts.deviceowner.ApplicationRestrictionsTest#testSetApplicationRestrictions: PASSED
  14. 07-08 11:38:46 I/BaseDevicePolicyTest: Test com.android.cts.deviceowner.ApplicationRestrictionsTest#testAndroidTestCaseSetupProperly: PASSED
  15. 07-08 11:38:48 I/BaseDevicePolicyTest: Test com.android.cts.deviceowner.ClearDeviceOwnerTest#testClearDeviceOwner: PASSED
  16. 07-08 11:38:48 I/BaseDevicePolicyTest: Test com.android.cts.deviceowner.ClearDeviceOwnerTest#testAndroidTestCaseSetupProperly: PASSED
  17. 07-08 11:38:49 I/8ef2d4c2: com.android.cts.devicepolicy.DeviceOwnerTest#testApplicationRestrictions PASS
在GTS中也有这项测试:com.google.android.xts.devicepolicy.DeviceOwnerTest

如果有报:java.lang.IllegalStateException: Trying to set device owner but device is already provisioned应该就是同一个问题,只要把帐户删除再测试

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/AllinToyou/article/detail/245395
推荐阅读
相关标签
  

闽ICP备14008679号