Camera XTS 处理笔记

一、Camera CTS 调试笔记

1.1 CTS兼容包下载

下载对应版本最新的CTS 兼容性测试包,
注意:
网页切换成英文下载的工具会比中文的新,比如: 现在英文网页有15 R4 ,中文网页只有15 R3

Google 官网CTS 兼容套件下载地址:

https://source.android.google.cn/docs/compatibility/cts/downloads

CTS Google 官网

https://source.android.google.cn/docs/compatibility/cts?hl=zh-cn

1.2 进入CTS 兼容性工具包 ,开启CTS测试

  1. 下载后,打开终端,进入 cts 包 tools目录下
  2. 执行./cts-tradefed 进入cts测试
~/XTS/CTS/15/android-cts-15_r4-linux_x86-arm/android-cts/tools$ ./cts-tradefed 
==================
Notice:
We collect anonymous usage statistics in accordance with our Content Licenses (https://source.android.com/setup/start/licenses), Contributor License Agreement (https://opensource.google.com/docs/cla/), Privacy Policy (https://policies.google.com/privacy) and Terms of Service (https://policies.google.com/terms).
==================
Android Compatibility Test Suite 15_r4 (13449817)
OmniLab lab-4.314.0 github-35bede2eb45412b21afc9122addc25200f15e074
Use "help" to get more information on running commands. Use "dump bugreport" to generate a debug info file. Log dirs: [/tmp/olc_server_log, /tmp/ats_console_log]
06-17 06:02:35 PDT I/ServerPreparer: Connected to existing OLC server, version=[lab_version: "4.314.0" github_version: "35bede2eb45412b21afc9122addc25200f15e074" process_id: 3141893 client_version: "4.32.0"]
06-17 06:02:35 PDT I/ServerPreparer: Using existing OLC server
cts-console > 
cts-console > 

1.3 常用CTS测试命令

1.3.1. adb devices 获取当前挂测设备ID

首先通过 adb devices 获取当前挂测设备ID,方便后续添加 -s 挂测多台机器

C:\Users\>adb devices
List of devices attached
33b9232239991 device

1.3.2. 执行整测 CTS 方法

全跑整机所有模块(Camera、Audio、USB、指纹等)CTS 测试命令如下

 run cts --plan CTS   -s   "devices id”

1.3.3. 单独跑某个模块

单独跑某个模块
通用命令语法:
run cts -m module

Camera 单项CTS 测试Fail 举例

比如 Camera CTS 模块:

 run cts -m  CtsCameraTestCases  -s  "devices id”

1.3.4. 单独跑某个测试fail单项

单跑某个单独的测试fail 项
通用命令语法:
run cts -m module -t 测试fail项
比如 Camera CTS android.hardware.camera2.cts.ReprocessCaptureTest#testMixedBurstReprocessing[1] 单项命令:

run cts -m  CtsCameraTestCases  -t  android.hardware.camera2.cts.ReprocessCaptureTest#testMixedBurstReprocessing[1] 

1.3.5. 单独跑某个类下面的测试项

单跑某个module下的一个类,这个类会包含其他测试项。
通用命令语法:
run cts -m module -t classname

比如我们要跑Camera 的ReprocessCaptureTest 这个类下的所有测试项

run cts -m  CtsCameraTestCases  -t  android.hardware.camera2.cts.ReprocessCaptureTest

1.3.6.通过CTS test apk 测试CTS 测试项

有时候我们没有CTS测试环境,那么自己本地调试将是一个不错的手段,以Camera 测试方法举例如下:

1. 安装 CtsCameraTestCases.apk apk 并授予camera 权限

手机安装 CtsCameraTestCases.apk 然后通过执行命令就可以进行本机CTS 项测试

    adb install  CtsCameraTestCases.apk(来源对应CTS 测试工具包中,比如 15 R4等)
    adb shell pm grant android.camera.cts android.permission.CAMERA
    adb shell  pm list instrumentation
2. 运行测试指令

请在class 后面添加需要测试的fail项即可。

通用命令语法:
adb shell am instrument -w -r -e newRunListenerMode true -e class CTS测试fail项 android.camera.cts/androidx.test.runner.AndroidJUnitRunner

比如: Camera android.hardware.camera2.cts.ReprocessCaptureTest#testMixedBurstReprocessing[1] 测试项举例:

adb shell am instrument -w -r -e newRunListenerMode true -e class    android.hardware.camera2.cts.ReprocessCaptureTest#testMixedBurstReprocessing[1]    android.camera.cts/androidx.test.runner.AndroidJUnitRunner

1.3.7. 查看已经跑过的记录

通用命令语法:
l r
l r 罗列出之前跑过的记录,包括 Session ID ,pass 项,Fail 项,测试设备ID 等,方便后续retry复测。

1.3.8. 复测之前跑过的fail 项

有时候 CTS经常会因为某些原因导致测试timeout,测试未完成,此时我们又不想重新跑之前测试pass的想,这个时候我们就可以使用retry命令来进行续跑之前的fail项。

通用命令语法:
run retry --retry Session id
其中 Session id 通过 l r命令可以查看

二、Camera GSI 调试笔记

GSI 根据刷不同的Google 镜像有不同的测试项,并且测试命令也不一样

2.1 GKI-GSI

GKI-GSI 刷机后刷镜像: Google system.img

刷Google 镜像方法如下:

    adb reboot bootloader
    fastboot reboot fastboot
    // 刷 google  system img
    fastboot flash system  system.img
    #fastboot flash system  [GSI system.img] #signed_signed_asop_arm64_img-xxx(gsi包里的)
    fastboot reboot bootloader
    fastboot -w
    fastboot reboot

2.2 GKI-GSI 测试指令

GKI-GSI 测试指令跟CTS 类似,也是通过 -m -t 实现的

camera 模块整测命令

run cts-on-gsi -m CtsCameraTestCases -s "deviceid"

camera 模块单项测试命令

run cts-on-gsi -m CtsCameraTestCases -t fail模块 -s "deviceid"
比如testMixedBurstReprocessing fail 测试命令如下:

run cts-on-gsi -m CtsCameraTestCases -t android.hardware.camera2.cts.ReprocessCaptureTest#testMixedBurstReprocessing[1]      -s "deviceid"

2.3 OKI-GSI

刷Google bootimage 镜像
OKI-GSI 刷机后刷镜像: Google boot.img

刷Googe 镜像 boot.img 方法如下:

    adb reboot bootloader
    fastboot reboot fastboot
    ////////////google  boot img
    fastboot flash boot signed-gsi_arm64-img-11114065\boot-5.10.img
    #fastboot flash boot [GKI 2.0 boot-5.10~5.15.img(版本路径里的)
    fastboot reboot bootloader
    fastboot -w
    fastboot reboot

OKI-GSI 测试指令:

camera 模块全测命令
run cts-validation -m CtsCameraTestCases -s 手机序列号

单模块 测试命令

run cts-validation -m CtsCameraTestCases -t fail模块 -s 手机序列号

run cts-validation -m CtsCameraTestCases -t android.hardware.camera2.cts.ReprocessCaptureTest#testMixedBurstReprocessing[1]      -s "deviceid"

三、Camera VTS 调试笔记

3.1 GKI-VTS

刷Google System +vendor_boot 镜像

刷机后刷镜像 system.img vendor_boot-debug.img

镜像刷机命令如下:

    adb reboot bootloader
    fastboot reboot fastboot
    // google  system img   
    fastboot flash system   system.img
    // 需要更换vendor_boot debug img
    fastboot flash vendor_boot   vendor_boot-debug.img
    #fastboot flash system  [GSI system.img] #signed_signed_asop_arm64_img-xxx(gsi包里的)
    #fastboot flash vendor_boot [in version patch vendor_boot-debug.img ] (版本路径里面)
    fastboot reboot bootloader
    fastboot -w
    fastboot reboot

GKI-VTS 测试指令:

camera 模块全测命令
run vts -s 手机序列号 -m VtsHalCameraProviderV2_4TargetTest

单模块 测试命令
run vts -s 手机序列号 -m VtsHalCameraProviderV2_4TargetTest -t fail模块

3.2 OKI-VTS

刷Google boot+vendor boot

刷机后刷Google 镜像 boot-5.10.img vendor_boot-debug.img

    adb reboot bootloader
    fastboot reboot fastboot
    // google   boot img
    fastboot flash boot   boot-5.10.img
    // 需要更换vendor_boot debug img
    fastboot flash vendor_boot  vendor_boot-debug.img
    # fastboot flash boot [GKI 2.0 boot-5.10~5.15.img(版本路径里的)
    # fastboot flash vendor_boot [in version patch vendor_boot-debug.img ] (symbol压缩包里面,需要单独下)
    fastboot reboot bootloader
    fastboot -w
    fastboot reboot

OKI-VTS 测试指令:

camera 模块全测命令
run run vts-validation -m VtsHalCameraProviderV2_4TargetTest -s 手机序列号

单模块 测试命令
run run vts-validation -m VtsHalCameraProviderV2_4TargetTest -t fail模块 -s 手机序列号

四、Camera GTS 调试笔记

4.1 camera GTS模块:

 run gts -m  GtsCameraTestCases    -s 手机序列号

4.2camera GTS 单项 fail 测试命令:

 run gts -m  GtsCameraTestCases  -t fail模块  -s 手机序列号

4.3 通过GTS test apk 测试GTS 测试项

adb shell am instrument -w -r -e newRunListenerMode true -e class GTS测试fail项 com.google.android.camera.gts/androidx.test.runner.AndroidJUnitRunner
测试方法举例:


GTS:
adb shell am instrument -w -r -e newRunListenerMode true -e class com.google.android.camera.gts.GainmapTest#testMultiAtlasGlyphsWithColorSpace com.google.android.camera.gts/androidx.test.runner.AndroidJUnitRunner

adb shell am instrument -w -r -e newRunListenerMode true -e class com.google.android.camera.gts.GainmapTest#testEmojiRespectsColorSpace com.google.android.camera.gts/androidx.test.runner.AndroidJUnitRunner

五、CTS Verifier

CTS Verifier 是手动测试,需要安装CtsVerifier.apk测试apk,然后参考文档进行人工测试。

5.1 CtsVerifier.apk 安装授权命令如下:

adb install -g  CtsVerifier.apk
adb shell settings put global hidden_api_policy 1
adb shell appops set com.android.cts.verifier android:read_device_identifiers allow
adb shell appops set com.android.cts.verifier MANAGE_EXTERNAL_STORAGE 0

六、ITS 调试笔记

6.1 Google 官方ITS测试 参考文档

https://source.android.google.cn/docs/compatibility/cts/camera-its-tests

6.2 测试方法

6.2.1. 配置灯箱,测试机器,平板等等

修改 config.yml 文件,将测试机,以及平板的device id 替换,将测试图片push 到平板中,开启灯箱进行测试。

TestBeds:
  - Name: TEST_BED_TABLET_SCENES
    # Test configuration for scenes[0:4, 6, _change]
    Controllers:
        AndroidDevice:
          - serial: 8A9X0NS5Z---> 修改 用来测试的手机的device id
            label: dut
          - serial: 5B16001229-->修改为灯箱中用于存放图片的平板device id
            label: tablet

    TestParams:
      brightness: 192
      chart_distance: 22.0
      debug_mode: "False"  # "True" or "False"; quotes needed
      lighting_cntl: <controller-type>  # "arduino" or "None"; quotes needed
      lighting_ch: <controller-channel>
      camera: 0
      foldable_device: "False". # set "True" if testing foldable
      scene: <scene-name>  # if <scene-name> runs all scenes

# SENSOR_FUSION 配置
Testbeds
  - Name: TEST_BED_SENSOR_FUSION
    # Test configuration for sensor_fusion/test_sensor_fusion.py
    Controllers:
        AndroidDevice:
          - serial: 8A9X0NS5Z---> 修改 用来测试的手机的device id
            label: dut

    TestParams:
      fps: 30
      img_size: 640,480
      test_length: 7
      debug_mode: "False"
      chart_distance: 25
      rotator_cntl: arduino
      rotator_ch: 1
      camera: 0

6.2.2. source 环境,执行source build/envsetup.sh

 :~/XTS/ITS/14/R3/test/android-cts-verifier-14_r3-linux_x86-arm/android-cts-verifier/CameraITS$ source build/envsetup.sh 
CAMERA_ITS_TOP=/XTS/ITS/14/R3/test/android-cts-verifier-14_r3-linux_x86-arm/android-cts-verifier/CameraITS
*****Please execute below adb command on your dut before running the tests*****
adb -s <device_id> shell am compat enable ALLOW_TEST_API_ACCESS com.android.cts.verifier

6.2.3. 安装CTS verifier apk

安装apk 并按提示执行 adb -s <device_id> shell am compat enable ALLOW_TEST_API_ACCESS com.android.cts.verifier

 :~/XTS/ITS/14/R3/test/android-cts-verifier-14_r3-linux_x86-arm/android-cts-verifier/$ adb install -r -g CtsVerifier.apk 
 :~/XTS/ITS/14/R3/test/android-cts-verifier-14_r3-linux_x86-arm/android-cts-verifier/CameraITS$ adb -s 33e86118B3240 shell am compat enable ALLOW_TEST_API_ACCESS com.android.cts.verifier
Enabled change 166236554 for com.android.cts.verifier.

6.2.4. ITS 相机主要测试场景

scene0:拍摄元数据、抖动、陀螺仪、振动
scene0 测试不需要具体的场景信息。但是,执行陀螺仪和振动测试时,手机必须静止不动。

scene1:曝光、感光度、EV 补偿、YUV 与 JPEG/RAW
scene2:人脸检测、需要彩色场景或完全黑暗的测试
scene3:边缘增强、镜头移动
Scene4:宽高比、剪裁、视野范围
scene5:镜头阴影
scene6:缩放
scene_extensions:相机扩展
sensor_fusion:相机/陀螺仪时间偏差

6.2.5. 单场景测试命令

后摄像头单个场景测试
比如需要测试后摄 场景0 ,可以执行下面命令

python tools/run_all_tests.py camera=0 scenes=0

 :~/XTS/ITS/14/R3/test/android-cts-verifier-14_r3-linux_x86-arm/android-cts-verifier/CameraITS$ python tools/run_all_tests.py  camera=0 scenes=0
INFO:root:Saving test_bed_tablet_scenes output files to: /tmp/CameraITS_705uiw4u
INFO:root:Running ITS on device: 33e86118B3240, camera(s): ['0'], scene(s): ['scene0']
INFO:root:camera: 0, scene(s): ['scene0']
INFO:root:Using config_vfytn673.yml as temporary config yml file
INFO:root:Running tests for scene0 with camera 0
INFO:root:PASS  scene0/test_burst_capture.py
... ...

6.2.6. 多场景测试命令

后摄像头多场景测试:
python tools/run_all_tests.py camera=0 scenes=0,1,2,3,4,6

 :~/XTS/ITS/14/R3/test/android-cts-verifier-14_r3-linux_x86-arm/android-cts-verifier/CameraITS$ python tools/run_all_tests.py  camera=0 scenes=0,1,2,3,4,6
INFO:root:Saving test_bed_tablet_scenes output files to: /tmp/CameraITS_hb57s37g
INFO:root:Running ITS on device: 33e86118B3240, camera(s): ['0'], scene(s): ['scene0', 'scene1_1', 'scene1_2', 'scene2_a', 'scene2_b', 'scene2_c', 'scene2_d', 'scene2_e', 'scene2_f', 'scene3', 'scene4', 'scene6']
INFO:root:camera: 0, scene(s): ['scene0', 'scene1_1', 'scene1_2', 'scene2_a', 'scene2_b', 'scene2_c', 'scene2_d', 'scene2_e', 'scene2_f', 'scene3', 'scene4', 'scene6']
INFO:root:Using config__v2_mhgn.yml as temporary config yml file
INFO:root:Running tests for scene0 with camera 0
INFO:root:PASS  scene0/test_burst_capture.py
INFO:root:PASS  scene0/test_capture_result_dump.py
INFO:root:PASS  scene0/test_gyro_bias.py
INFO:root:PASS  scene0/test_jitter.py
INFO:root:PASS  scene0/test_metadata.py
... ...
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容