Android CTS測試Fail項改動總結(四)

weixin_34197488發表於2015-12-29

Android5.1上的測試

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

列印的log

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) 
這個是典型的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

cts-tf > run cts --class com.android.cts.appsecurity.AppSecurityTests
06-29 10:10:46 I/TestInvocation: Starting invocation for 'cts' on build '5.1_r1' on device AYEMA6YHKVNJQOIZ
06-29 10:10:46 I/AYEMA6YHKVNJQOIZ: Created result dir 2015.06.29_10.10.46
06-29 10:10:47 I/CtsTest: ABIs: [armeabi-v7a, arm64-v8a]
06-29 10:11:01 I/AYEMA6YHKVNJQOIZ: Collecting device info
06-29 10:11:03 I/CtsTest: Start test run of 2 packages, containing 22 tests
06-29 10:11:03 I/AYEMA6YHKVNJQOIZ: -----------------------------------------
06-29 10:11:03 I/AYEMA6YHKVNJQOIZ: Test package arm64-v8a android.tests.appsecurity started
06-29 10:11:03 I/AYEMA6YHKVNJQOIZ: -----------------------------------------
06-29 10:11:23 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testAppFailAccessPrivateData PASS 
06-29 10:11:32 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testAppUpgradeDifferentCerts PASS 
06-29 10:11:59 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testExternalStorageGifts PASS 
06-29 10:12:10 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testExternalStorageNone PASS 
06-29 10:12:20 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testExternalStorageRead PASS 
06-29 10:12:31 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testExternalStorageWrite PASS 
06-29 10:12:47 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testInstrumentationDiffCert PASS 
06-29 10:12:49 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testMultiUserStorage PASS 
06-29 10:14:06 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testPermissionDiffCert PASS 
06-29 10:14:17 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testSharedUidDifferentCerts PASS 
06-29 10:14:34 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testUninstallRemovesData PASS 
06-29 10:14:37 I/AYEMA6YHKVNJQOIZ: arm64-v8a android.tests.appsecurity package complete: Passed 11, Failed 0, Not Executed 0
06-29 10:14:37 I/AYEMA6YHKVNJQOIZ: -----------------------------------------
06-29 10:14:37 I/AYEMA6YHKVNJQOIZ: Test package armeabi-v7a android.tests.appsecurity started
06-29 10:14:37 I/AYEMA6YHKVNJQOIZ: -----------------------------------------
06-29 10:14:57 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testAppFailAccessPrivateData PASS 
06-29 10:15:06 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testAppUpgradeDifferentCerts PASS 
06-29 10:15:32 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testExternalStorageGifts PASS 
06-29 10:15:43 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testExternalStorageNone PASS 
06-29 10:15:53 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testExternalStorageRead PASS 
06-29 10:16:04 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testExternalStorageWrite PASS 
06-29 10:16:20 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testInstrumentationDiffCert PASS 
06-29 10:16:22 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testMultiUserStorage PASS 
06-29 10:17:43 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testPermissionDiffCert PASS 
06-29 10:17:56 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testSharedUidDifferentCerts PASS 
06-29 10:18:16 I/AYEMA6YHKVNJQOIZ: com.android.cts.appsecurity.AppSecurityTests#testUninstallRemovesData PASS 
06-29 10:18:21 I/AYEMA6YHKVNJQOIZ: Saved log device_logcat_892804764496421781.zip
06-29 10:18:25 I/AYEMA6YHKVNJQOIZ: Saved log host_log_3382781982890595027.zip
06-29 10:18:25 I/AYEMA6YHKVNJQOIZ: armeabi-v7a android.tests.appsecurity package complete: Passed 11, Failed 0, Not Executed 0
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
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

測試部分結果

cts-tf > run cts --class com.android.cts.devicepolicy.DeviceOwnerTest
07-08 11:31:36 I/TestInvocation: Starting invocation for 'cts' on build '5.1_r1' on device 8ef2d4c2
07-08 11:31:36 I/8ef2d4c2: Created result dir 2015.07.08_11.31.36
07-08 11:31:36 I/CtsTest: ABIs: [armeabi-v7a, arm64-v8a]
07-08 11:31:48 I/8ef2d4c2: Collecting device info
07-08 11:31:50 I/CtsTest: Start test run of 2 packages, containing 14 tests
07-08 11:31:50 I/8ef2d4c2: -----------------------------------------
07-08 11:31:50 I/8ef2d4c2: Test package arm64-v8a android.adminhostside started
07-08 11:31:50 I/8ef2d4c2: -----------------------------------------
07-08 11:31:50 I/BaseDevicePolicyTest: Installing app CtsDeviceOwnerApp.apk
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.
    at android.os.Parcel.readException(Parcel.java:1569)
    at android.os.Parcel.readException(Parcel.java:1509)
    at android.app.admin.IDevicePolicyManager$Stub$Proxy.setDeviceOwner(IDevicePolicyManager.java:3212)
    at com.android.commands.dpm.Dpm.runSetDeviceOwner(Dpm.java:114)
    at com.android.commands.dpm.Dpm.onRun(Dpm.java:82)
    at com.android.internal.os.BaseCommand.run(BaseCommand.java:47)
    at com.android.commands.dpm.Dpm.main(Dpm.java:38)
    at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
    at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:249)

07-08 11:31:55 I/8ef2d4c2: com.android.cts.devicepolicy.DeviceOwnerTest#testApplicationRestrictions FAIL 
junit.framework.AssertionFailedError: java.lang.IllegalStateException: Trying to set device owner but device is already provisioned.
    at android.os.Parcel.readException(Parcel.java:1569)
    at android.os.Parcel.readException(Parcel.java:1509)
    at android.app.admin.IDevicePolicyManager$Stub$Proxy.setDeviceOwner(IDevicePolicyManager.java:3212)
    at com.android.commands.dpm.Dpm.runSetDeviceOwner(Dpm.java:114)
    at com.android.commands.dpm.Dpm.onRun(Dpm.java:82)
    at com.android.internal.os.BaseCommand.run(BaseCommand.java:47)
    at com.android.commands.dpm.Dpm.main(Dpm.java:38)
    at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
    at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:249)
 expected to start with "Success:"
    at junit.framework.Assert.fail(Assert.java:50)
    at junit.framework.Assert.assertTrue(Assert.java:20)
    at com.android.cts.devicepolicy.DeviceOwnerTest.setDeviceOwner(DeviceOwnerTest.java:96)
    at com.android.cts.devicepolicy.DeviceOwnerTest.setUp(DeviceOwnerTest.java:41)
    at junit.framework.TestCase.runBare(TestCase.java:132)
    at com.android.tradefed.testtype.DeviceTestResult$1.protect(DeviceTestResult.java:81)
    at com.android.tradefed.testtype.DeviceTestResult.runProtected(DeviceTestResult.java:56)
    at com.android.tradefed.testtype.DeviceTestResult.run(DeviceTestResult.java:85)
    at junit.framework.TestCase.run(TestCase.java:124)
    at com.android.tradefed.testtype.DeviceTestCase.run(DeviceTestCase.java:117)
    at com.android.cts.tradefed.testtype.JarHostTest$TestRunnable.run(JarHostTest.java:248)
    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

解決思路:

去設定-》高階設定-》帳戶  中檢視

已經存在一個賬戶了,須要刪除這個帳戶。方法例如以下:

刪除後又一次測試

cts-tf > run cts --class com.android.cts.devicepolicy.DeviceOwnerTest
07-08 11:38:25 I/TestInvocation: Starting invocation for 'cts' on build '5.1_r1' on device 8ef2d4c2
07-08 11:38:25 I/8ef2d4c2: Created result dir 2015.07.08_11.38.25
07-08 11:38:25 I/CtsTest: ABIs: [armeabi-v7a, arm64-v8a]
07-08 11:38:37 I/8ef2d4c2: Collecting device info
07-08 11:38:39 I/CtsTest: Start test run of 2 packages, containing 14 tests
07-08 11:38:39 I/8ef2d4c2: -----------------------------------------
07-08 11:38:39 I/8ef2d4c2: Test package arm64-v8a android.adminhostside started
07-08 11:38:39 I/8ef2d4c2: -----------------------------------------
07-08 11:38:40 I/BaseDevicePolicyTest: Installing app CtsDeviceOwnerApp.apk
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
Active admin set to component {com.android.cts.deviceowner/com.android.cts.deviceowner.BaseDeviceOwnerTest$BasicAdminReceiver}

07-08 11:38:46 I/BaseDevicePolicyTest: Test com.android.cts.deviceowner.ApplicationRestrictionsTest#testSetApplicationRestrictions: PASSED
07-08 11:38:46 I/BaseDevicePolicyTest: Test com.android.cts.deviceowner.ApplicationRestrictionsTest#testAndroidTestCaseSetupProperly: PASSED
07-08 11:38:48 I/BaseDevicePolicyTest: Test com.android.cts.deviceowner.ClearDeviceOwnerTest#testClearDeviceOwner: PASSED
07-08 11:38:48 I/BaseDevicePolicyTest: Test com.android.cts.deviceowner.ClearDeviceOwnerTest#testAndroidTestCaseSetupProperly: PASSED
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應該就是同一個問題,僅僅要把帳戶刪除再測試


相關文章