STS、CTS、GTS、VTS测试指南

Android Security Test Suite (STS) 是谷歌关于android安全补丁安装情况的一个测试套件STS和security patch相关的,是CTS测试新增加一项安全测试套件。STS是201808才开始测试的。Security patch日期在3个月内是GTS的一个case,如果不通过无法获得google认证。在18年5月之前谷歌对于security patch这个属性都是在build库下面跟着aosp更新的。现在需要通过STS之后由vendor来更新。STS需要通过userdebug版本的targetfile来生成一个user版本的结果。

STS测试前提

  • 设备必须刷是userdebug rom
  • usb调试已经打开,usb安装、点击功能需要正常
  • 可以获得root,执行adb root必须成功

STS 工具  自行下载

STS 测试命令

                sts-tradefed run sts-dynamic-incremental -m <模块名> -t <单项名称> MR版本测试指令 

                sts-tradefed run sts-dynamic-full -m <模块名> -t <单项名称> IR版本测试指令 

默认执行:

sts-tradefed run sts-dynamic-full

指定目标设备:

sts-tradefed run sts-dynamic-full -s 【指定你的android设备】

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

CTS,GSI,GTS,VTS,STS区别

区别:

1.烧录img版本不同

     CTS,GSI,GTS,VTS  烧录user版本img

   STS 烧录user-debug版本img

2.是否需要额外烧录谷歌img

     VTS 需额外推送 谷歌img 和 boot-debug.img

      GSI 需额外推送谷歌img

      其它测试不需要

3.测试前是否需要推送媒体包 

      CTS , GSI ,GTS 需要推媒体包

      其余测试不需要

//推送媒体包的方式:在Media执行脚本+设备SN号

4.测试指令有细微差别,仅需修改对应测试名称

//注意事项: CTS 测试和 GSI 测试共用一个测试脚本,因此GSI测试可在CTS测试下进行,但不可同时进行(即这个两个测试不可以同时共用一个测试工具)

  4.1.CTS测试(单台测试预计170小时)
  全测命令:run cts --shard-count 3 -s CTS00000001 -s CTS00000002 -s CTS00000003    // -s  【SN号】
  重测命令:run retry -r 1 --shard-count 3 -s CTS00000001 -s CTS00000002 -s CTS00000003    / -r  【第几个测试报告】
  单侧模块:run cts -m  CtsPermission2TestCases -s CTS00000001   // -m 【测试模块】
  单侧case:run cts -m  CtsPermission2TestCases -t android.permission2.cts.PermissionPolicyTest#platformPermissionPolicyIsUnaltered -s CTS00000001   // -t 【测试项】
 
  4.2.GTS测试(单台测试预计20小时)
  全测命令:run gts --shard-count 3 -s GTS00000001 -s GTS00000002 -s GTS00000003
  重测命令:run retry -r 1 --shard-count 3 -s GTS00000001 -s GTS00000002 -s GTS00000003
 
  4.3.VTS测试(单台测试预计45小时)
   注:需要烧录Google System.img 
   全测命令:run vts --shard-count 3 -s VTS00000001 -s VTS00000002 -s VTS00000003
   重测命令:run retry -r 1 --shard-count 3 -s VTS00000001 -s VTS00000002 -s VTS00000003

  4.4.GSI测试(单台测试预计35小时)-->与CTS共用Tool
   注:需要烧录Google System.img
   全测命令:run cts-on-gsi --shard-count 3 -s GSI00000001 -s GSI00000002 -s GSI00000003
   重测命令:run retry -r 1 --shard-count 3 -s GSI00000001 -s GSI00000002 -s GSI00000003
   
  4.5.STS测试(单台测试预计7小时)
   注:需要烧录Userdebug版本测试
   全测命令:run sts-dynamic-full --shard-count 3 -s STS00000001 -s STS00000002 -s STS00000003
   重测命令:run retry -r 1 --shard-count 3 -s GSI00000001 -s GSI00000002 -s GSI00000003

  4.6.CTS_V测试 -->DQA 负责测

#其它测试指令 

 l i

 l d

 l r

 l c

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

一、指令

basic:

套件 指令 测试版本 更新频率 下载地址
cts run cts release 季度 https://source.android.com/docs/compatibility/cts/downloads
gts run gts ; run gts-interactive release 季度 https://docs.partner.android.com/gms/testing/gts 须登陆
vts run vts release 季度 https://docs.partner.android.com/gms/testing/vts 须登陆
cts-on-gsi run cts-on-gsi release CTS套件:季度; system.img:每月 同CTS
sts run sts-dynamic-full debug 每月 https://drive.google.com/drive/folders/1xqPTtC6MWiQizfFVdG7Ho0f2oGsmH0e-
tvts run tvts release https://docs.partner.android.com/tv/test/tvts/release-notes

pior:

功能 指令 备注
重试多台只64位且不包括3个包 run retry --retry 1 --shard-count 2 --abi arm64-v8a --exclude-filter CtsLibcoreTestCases --exclude-filter CtsNetTestCases --exclude-filter CtsAppSecurityHostTestCases 此3个包涉及IPV6
测试CTS子计划 run cts --subplan
帮助 help
cts帮助 run cts --help; run cts --help -all

monthly:

月份 CTS(使用月份) GTS(使用月份) VTS(使用月份) STS(安全补丁月份) img(安全补丁月份)
发布月份 3 6 9 12 3 6 9 12 3 6 9 12 上一个月
2023-10 android-cts-13_r5-linux_x86-arm android-gts-11-R1(11-14)-10495246 android-vts-10477834_arm64(13_R5) android-sts-13_sts-r19-linux-arm64 android13-arm64-img-10694250.zip
2023-11 android-sts-13_sts-r20-linux-arm64 signed-gsi_arm64-img-10828306.zip
2023-12 android-sts-13_sts-r21-linux-arm64 signed-gsi_arm64-img-10953849.zip
2024-01 android-cts-13_r6-linux_x86-arm android-gts-11-R2(11-14)-11137706.zip android-vts-11183460_arm64(13_R6) android-sts-13_sts-r22-linux-arm64 signed-gsi_arm64-img-11114083.zip

常用网址:

功能 网址 备注
https://source.android.com/docs/ 内网
partner之gms https://docs.partner.android.com/gms/testing/overview 外网+授权账号登陆
partner之security https://docs.partner.android.com/security 外网+授权账号登陆
GTS/VTS/system.img最新版下载 https://drive.google.com/drive/folders/0ByUA0TZpIQ_UYll6QnFxaVVNVTA?resourcekey=0-OaeHWcxibqcFpnZw_OzYiw 外网+授权账号登陆
TV system.img最新版下载 https://docs.partner.android.com/tv/test/android/gsi?hl=en 外网+授权账号登陆
SPL https://drive.google.com/drive/folders/0B85mEDAGzAbsckRrZFhhV3YwTEk?resourcekey=0-6zNsbY0nWUmYsJO2TF-RZQ 外网+授权账号登陆
apa https://partner.android.com/approvals 外网+授权账号登陆

三、镜像文件

通过指令
adb shell getprop | grep patch得到的信息看安全补丁的日期

[ro.build.version.security_patch]: [2023-10-05]  # 此为system.img的
[ro.vendor.build.security_patch]: [2023-10-05]   # 此为公司版本的

  • 命令之间用 ; 时,前一个命令完成后(不论是否成功)运行下一个命令,
  • 命令之间用 && 时,前一个命令完成后(成功时)运行下一个命令
CTS-on-GSI 一键更换image

在system.img所在目录下执行如下指令:
adb reboot bootloader&&fastboot flashing unlock&&fastboot flashing unlock_critical&&fastboot reboot fastboot&&fastboot flash system system.img&&fastboot -w&&fastboot reboot

VTS 一键更换image

在system.img/vendor_boot.img所在目录下执行如下指令:
adb reboot bootloader&&fastboot flashing unlock&&fastboot flashing unlock_critical&&fastboot reboot fastboot&&fastboot flash system system.img&&fastboot flash vendor_boot vendor_boot-debug.img&&fastboot -w&&fastboot reboot

# CTS-on-GSI
adb reboot bootloader
fastboot flashing unlock
fastboot flashing unlock_critical
fastboot reboot fastboot
fastboot flash system system.img
fastboot -w
fastboot reboot


# VTS
adb reboot bootloader
fastboot flashing unlock
fastboot flashing unlock_critical
fastboot reboot fastboot
fastboot flash system system.img
fastboot flash vendor_boot vendor_boot-debug.img
fastboot -w
fastboot reboot

四、每日构建版本

每日构建地址 android 13:
https://ci.android.com/builds/branches/aosp-android13-tests-release/grid?legacy=1

1)下载CTS,VTS,CTS-VERIFIER搜索字段,例如android12
aosp-android12-tests-dev
aosp-android12-tests-release

2)下载TVTS搜索字段
git_master-tv-dev

3)下载google system image搜索字段
git_tm-gsi-release
git_sc-tv-gsi-release
git_rvc-tv-gsi-release

五、子计划使用

为什么使用子计划?
以CTS测试为例,有1058个测试模块,全部测试完需要1周时间。如果只需要验证其中的某几个模块,如media相关的模块。没有子计划时需要一个模块输入一条指令,使用子计划可以将所有media模块放在一个测试计划中,运行一条指令可以实现所有Media模块测试。
help add 可以查看子计划的具体使用方式
以android 13的 13_r4套件为例,其CTS有1055个模块,样机充足时可以分多台提升测试效率

测试项 模块数 耗时
CTS 1055 在样机充足时,可以使用子计划,分为三部分测试,提升测试效率
P1: DEQP1台:30h;
P2:Media1台:24h,之后多次retry ;
P3:其他模块:2台:36h,之后多次retry ;
CTS-on-GSI 347 1台:36h,之后多次retry
CTS-Verifier 手动测试3天
GTS 273 1台:24h
STS 20 1台:6h
VTS 643 1台:6h

六、样机端操作

进入开发者模式:settings->About->build num (tap 5 times) ->open Developer options
设置设备常亮:Developer options->Stay awake->on
打开USB调试:Developer options->USB debugging->on
关掉USB安装应用提示:Developer options->Verify apps over USB->off

七、电脑端操作

1 Media相关的测试需要将media文件放在电脑/tmp/android-cts-media路径下,测试前不需要将Media文件拷贝到手机中,测试时会自动拷贝。
如果/tmp/android-cts-media路径下没有media文件,将会从网上下载,由于文件比较大,比较耗时

rkp attestattion key
获取rkp json文件

在工厂模式下,版本信息处 左左右右,此时弹出提示信息; 在另一个菜单处,点击右键,会自动保存到U盘

way1:需要登陆网页输入账号
python3.9 ./device_info_uploader.py --credentials ./cred.json --json-csr csrs.json --cache-token --company-id 25958473112589

way2:可以直接使用
python3.9 ./device_info_uploader.py --credentials-keyfile ./-rkp-cd-service-account.json --json-csr csrs.json --company-id 25958473112589

八. 测试分析

android13
测试周期(包含verifier):7天
预测试周期(不包含verifier): 4天
机器数量:7台

测试项 用时 机器数量(台)
CTS-without-deqp-media 3d 2台
CTS-without-deqp-media-64 2d 2台
CTS-deqp 30h 1台
CTS-deqp-64 15h 1台
CTS-media 3d 1台
CTS-media-64 2d 1台
gts 2d 1台
cts-on-gsi 3d 1台
vts 6h 1台
sts 6h 1台
cts-verifier 4d 1台

本文参考了:

https://www.cnblogs.com/qev211/p/17570911.html

https://www.cnblogs.com/a-n-yan/p/16043606.html

Android S XTS 测试入门_android xts-CSDN博客

GMS测试命令-CSDN博客

https://source.android.com/docs/security/test/sts-sdk

猜你喜欢

转载自blog.csdn.net/ab6326795/article/details/135113206
VTS
今日推荐