CTS/GTS/GSI/VTS无法提交报告问题复盘

一.问题原因

这个问题是由于多个方面造成的,梳理下问题发生的流程

本次问题产生原因

1.首先这个是odm产生的问题,修改了修改model name不规范,只修改了system的属性,没有修改vendor下面的属性

2.odm的推送直接push到了dev上,但是有一条change又进了stable1x,dev上的默认被拉到了stable2x,但是gerrit上只有1x这个提交

3.士伟搜了gerrit上odm的修改,认为只进了1x,所以修复也只进了1x,注意对这个问题进行总结 (要不不进,要进进全)

4.打小数版时CTS测试没有按照上传报告失败问题总结进行检查,导致2x小数版没有发现该问题

5.整数包上传报告时暴露问题

二.问题预防

1.修改时就按照要求修改system和vendor分区的相关属性,保证同名(不过这个不是我们这边进,没法控制)

2.在小数版测试时由CTS测试进行先期校验,预防等到整数包才发现问题(但是这个按照wiki那样检查比较麻烦,测试有时候也会忘记校验)

那么对于上面无法上传报告的那类问题,我们写个脚本进行校验,让测试校验起来更加方便;这样每次小数版测试前直接进行校验,有问题上报,防止问题等到整数版再暴露;同时,运行一行简单的命令就可以进行校验,再忘了就说不过去了吧;

用这种方法我们就可以把问题控制在上面说的第四步,防止问题的发生。

脚本下载:

checkimg

#! /bin/bash

function main()
{   
    echo 'welcome to check properties of this package, print -h to see the help'
    if [ "$1" = "-h" ]
    then
       printhelp
       exit 1
    fi
    if [ $# -lt 3 ]
    then
        echo 'wrong args'
        printhelp
        exit 1
    fi
    unziprom $1 $2 
    gotoimage $2
    unzip_systemimage $3
    unzip_vendorimage $3
    changemode $3
    printresult $3
    
}

function printhelp()
{
   echo 'There are 3 parameters of this script:'
   echo '1st: the absolute path where you put the rom'
   echo '2nd: the name of your rom'
   echo '3rd: the password when you excute sudo'
}

function unziprom()
{   
    echo 'unzipimg start...'
    dir_with_package=$1
    package_name=$2
    echo ${dir_with_package}
    echo ${package_name}
    cd ${dir_with_package}
    tar zxvf ${package_name} -C ${dir_with_package}
    echo 'unzipimg end...'
}

function finddir()
{
    ls -al | grep "^d" | grep $1
}


function gotoimage()
{   
    package_name=$1
    tmp=${package_name%_*} #remove the right string of the last
    echo "${tmp}"
    finddir "${tmp}"
    if [ $? == 0 ]; then
        echo 'find want destination'
        new_dir=./${tmp}/images/
    else
        echo 'try to find the destination by ls command'
        tmp_product=${tmp%%_*}
        tmp1=$(finddir ${tmp_product})
        tmp_lsname=${tmp1##*' '}
        new_dir=./${tmp_lsname}/images/ #relative path
    fi
    echo ${new_dir}
    cd ${new_dir}
}


function unzip_systemimage()
{  
   echo 'unzip system.img start...'
   unzipimg system.img $1
   echo 'unzip system.img end...'
}


function unzip_vendorimage()
{  
   echo 'unzip vendor.img start...'
   unzipimg vendor.img $1
   echo 'unzip vendor.img end...'
}

function unzipimg()
{

   password=$2
   origin_img=$1
   tmp=${origin_img%.img*}
   new_img=${tmp}"_tmp.img"
   simg2img  ${origin_img}  ${new_img}
   destdir=${tmp}"tmp"
   mkdir ${destdir}
   echo ${destdir}
   echo ${password} | sudo -S mount -t ext4 -o loop ${new_img} ${destdir}
   
}

function changemode()
{   
    echo 'start to chmod 777 build.prop...'
    password=$1
    if [ -f "./systemtmp/build.prop" ];then
        echo ${password} | sudo chmod 777 ./systemtmp/build.prop
    else
        echo 'systemtmp/build.prop dose not exist'
    fi
    if [ -f "./systemtmp/system/build.prop" ];then
        echo ${password} | sudo chmod 777 ./systemtmp/system/build.prop
    else
        echo 'systemtmp/system/build.prop dose not exist'
    fi
    if [ -f "./vendortmp/build.prop" ];then
        echo ${password} | sudo chmod 777 ./vendortmp/build.prop
    else
        echo 'vendortmp/build.prop dose not exist'
    fi
    echo ${password} | sudo chmod 777 ./systemtmp/build.prop
    echo ${password} | sudo chmod 777 ./systemtmp/system/build.prop
    echo ${password} | sudo chmod 777 ./vendortmp/build.prop
    echo 'success to chmod 777 build.prop...'
}


#ro.build.fingerprint
function getsystemfingerprint()
{
    password=$1
    if [ -f "./systemtmp/build.prop" ];then
        echo ${password} | sudo find ./systemtmp -name 'build.prop' | xargs grep -v '^#' | grep "ro.build.fingerprint" | head -n 1 
    fi
    if [ -f "./systemtmp/system/build.prop" ];then
        echo ${password} | sudo find ./systemtmp/system -name 'build.prop' | xargs grep -v '^#' | grep "ro.build.fingerprint" | head -n 1 
    fi
    #echo ${password} | sudo find ./systemtmp -name 'build.prop' | xargs grep "ro.build.fingerprint"
    #It seems like passwork var not changed,however, echo will return what shown in the terminal
}

#ro.vendor.build.fingerprint
function getvendorfingerprint()
{
    password=$1
    echo ${password} | sudo find ./vendortmp -name 'build.prop' | xargs grep -v '^#' | grep "ro.vendor.build.fingerprint" | head -n 1 
    #It seems like passwork var not changed,however, echo will return what shown in the terminal
}

#ro.product.brand
function getsystembrand()
{
    password=$1
    if [ -f "./systemtmp/build.prop" ];then 
        echo ${password} | sudo find ./systemtmp -name 'build.prop' | xargs grep -v '^#' | grep "ro.product.brand" | head -n 1 
    fi
    if [ -f "./systemtmp/system/build.prop" ];then
        echo ${password} | sudo find ./systemtmp/system -name 'build.prop' | xargs grep -v '^#' | grep "ro.product.brand" | head -n 1 
    fi
    #echo ${password} | sudo find ./systemtmp -name 'build.prop' | xargs grep "ro.product.brand"
    #It seems like passwork var not changed,however, echo will return what shown in the terminal
}

#ro.vendor.product.brand
function getvendorbrand()
{
    password=$1
    echo ${password} | sudo find ./vendortmp -name 'build.prop' | xargs grep -v '^#' | grep -E "ro.vendor.product.brand|ro.product.vendor.brand" | head -n 1 
    #It seems like passwork var not changed,however, echo will return what shown in the terminal
}

#ro.product.device
function getsystemdevice()
{
    password=$1
    if [ -f "./systemtmp/build.prop" ];then
        # eclude string starts with '#',may be the annotation
        echo ${password} | sudo find ./systemtmp -name 'build.prop' | xargs grep -v '^#' | grep "ro.product.device" | head -n 1 
    fi
    if [ -f "./systemtmp/system/build.prop" ];then
        echo ${password} | sudo find ./systemtmp/system -name 'build.prop' | xargs grep -v '^#' | grep "ro.product.device" | head -n 1 
    fi
    #echo ${password} | sudo find ./systemtmp -name 'build.prop' | xargs grep "ro.product.device"
    #It seems like passwork var not changed,however, echo will return what shown in the terminal
}

#ro.vendor.product.device
function getvendordevice()
{
    password=$1
    echo ${password} | sudo find ./vendortmp -name 'build.prop' | xargs grep -v '^#' | grep -E "ro.vendor.product.device|ro.product.vendor.device" | head -n 1 
    #It seems like passwork var not changed,however, echo will return what shown in the terminal
}

#ro.product.manufacturer
function getsystemmanufacturer()
{
    password=$1
    if [ -f "./systemtmp/build.prop" ];then
        echo ${password} | sudo find ./systemtmp -name 'build.prop' | xargs grep -v '^#' | grep "ro.product.manufacturer" | head -n 1 
    fi
    if [ -f "./systemtmp/system/build.prop" ];then
        echo ${password} | sudo find ./systemtmp/system -name 'build.prop' | xargs grep -v '^#' | grep "ro.product.manufacturer" | head -n 1 
    fi
    #echo ${password} | sudo find ./systemtmp -name 'build.prop' | xargs grep "ro.product.manufacturer"
    #It seems like passwork var not changed,however, echo will return what shown in the terminal
}

#ro.vendor.product.manufacturer
function getvendormanufacturer()
{
    password=$1
    echo ${password} | sudo find ./vendortmp -name 'build.prop' | xargs grep -v '^#' | grep -E "ro.vendor.product.manufacturer|ro.product.vendor.manufacturer" | head -n 1 
    #It seems like passwork var not changed,however, echo will return what shown in the terminal
}

#ro.product.model
function getsystemmodel()
{
    password=$1
    if [ -f "./systemtmp/build.prop" ];then 
        echo ${password} | sudo find ./systemtmp -name 'build.prop'| xargs grep -v '^#' | grep "ro.product.model" | head -n 1 
    fi
    if [ -f "./systemtmp/system/build.prop" ];then
        echo ${password} | sudo find ./systemtmp/system -name 'build.prop' | xargs grep  -v '^#' | grep "ro.product.model" | head -n 1 
    fi
    #It seems like passwork var not changed,however, echo will return what shown in the terminal
}

#ro.vendor.product.model
function getvendormodel()
{
    password=$1
    echo ${password} | sudo find ./vendortmp -name 'build.prop' | xargs grep  -v '^#' | grep -E "ro.vendor.product.model|ro.product.vendor.model" | head -n 1 
    #It seems like passwork var not changed,however, echo will return what shown in the terminal
}

#ro.product.name
function getsystemname()
{
    password=$1
    if [ -f "./systemtmp/build.prop" ];then
        echo ${password} | sudo find ./systemtmp -name 'build.prop' | xargs grep  -v '^#' | grep "ro.product.name" | head -n 1 
    fi
    if [ -f "./systemtmp/system/build.prop" ];then
        echo ${password} | sudo find ./systemtmp/system -name 'build.prop' | xargs grep  -v '^#' | grep "ro.product.name" | head -n 1 
    fi
    #echo ${password} | sudo find ./systemtmp -name 'build.prop' | xargs grep "ro.product.name"
    #It seems like passwork var not changed,however, echo will return what shown in the terminal
}

#ro.vendor.product.name
function getvendorname()
{
    password=$1
    echo ${password} | sudo find ./vendortmp -name 'build.prop' | xargs grep  -v '^#' | grep -E "ro.vendor.product.name|ro.product.vendor.name" | head -n 1 
    #It seems like passwork var not changed,however, echo will return what shown in the terminal
}

function checkfingerprint()
{
    systemfingerprint=$1
    vendorfingerprint=$2
    if [ "${systemfingerprint}" = "${vendorfingerprint}" ];then
        echo 'fingerprint check pass'
    else
        echo 'diffenerent fingerprint, need to modify'
    fi
}

function checkbrand()
{
    systembrand=$1
    vendorbrand=$2
    if [ "${systembrand}" = "${vendorbrand}" ];then
        echo 'brand check pass'
    else
        echo 'diffenerent brand, need to modify'
    fi
}

function checkdevice()
{
    systemdevice=$1
    vendordevice=$2
    if [ "${systemdevice}" = "${vendordevice}" ];then
        echo 'device check pass'
    else
        echo 'diffenerent device, need to modify'
    fi
}

function checkmanufacturer()
{
    systemmanufacturer=$1
    vendormanufacturer=$2
    if [ "${systemmanufacturer}" = "${vendormanufacturer}" ];then
        echo 'manufacturer check pass'
    else
        echo 'manufacturer device, need to modify'
    fi
}

function checkmodel()
{
    systemmodel=$1
    vendormodel=$2
    if [ "${systemmodel}" = "${vendormodel}" ];then
        echo 'model check pass'
    else
        echo 'diffenerent model, need to modify'
    fi
}

function checkname()
{
    systemname=$1
    vendorname=$2
    if [ "${systemname}" = "${vendorname}" ];then
        echo 'name check pass'
    else
        echo 'diffenerent name, need to modify'
    fi
}


function printresult()
{
    #the name of var cannot contain '.' character
    systemfingerprint=$(getsystemfingerprint $1)
    systemfingerprint_new=${systemfingerprint#*=*}
    systemfingerprint_new=${systemfingerprint_new%#*}
    vendorfingerprint=$(getvendorfingerprint $1)
    vendorfingerprint_new=${vendorfingerprint#*=*}
    vendorfingerprint_new=${vendorfingerprint_new%#*}

    systembrand=$(getsystembrand $1)
    systembrand_new=${systembrand#*=*}
    systembrand_new=${systembrand_new%#*}
    vendorbrand=$(getvendorbrand $1)
    vendorbrand_new=${vendorbrand#*=*}
    vendorbrand_new=${vendorbrand_new%#*}
    
    systemdevice=$(getsystemdevice $1)
    systemdevice_new=${systemdevice#*=*}
    systemdevice_new=${systemdevice_new%#*}
    vendordevice=$(getvendordevice $1)
    vendordevice_new=${vendordevice#*=*}
    vendordevice_new=${vendordevice_new%#*}

    systemmanufacturer=$(getsystemmanufacturer $1)
    systemmanufacturer_new=${systemmanufacturer#*=*}
    systemmanufacturer_new=${systemmanufacturer_new%#*}
    vendormanufacturer=$(getvendormanufacturer $1)
    vendormanufacturer_new=${vendormanufacturer#*=*}
    vendormanufacturer_new=${vendormanufacturer_new%#*}

    systemmodel=$(getsystemmodel $1)
    systemmodel_new=${systemmodel#*=*}
    systemmodel_new=${systemmodel_new%#*}
    vendormodel=$(getvendormodel $1)
    vendormodel_new=${vendormodel#*=*}
    vendormodel_new=${vendormodel_new%#*}
    

    systemname=$(getsystemname $1)
    systemname_new=${systemname#*=*}
    systemname_new=${systemname_new%#*}
    vendorname=$(getvendorname $1)
    vendorname_new=${vendorname#*=*}
    vendorname_new=${vendorname_new%#*}
    

    echo '---------------------------------------------------------------------------------------------------------------------------'
    echo ''
    echo '' 
    echo 'now print results:'
    echo ''
    echo '' 
    echo '---------------------------------------------------------------------------------------------------------------------------'
    echo 'print important properties:'
    echo '***************************************************************************************************************************'
    echo ${systemfingerprint}
    echo ${vendorfingerprint}

    echo ${systembrand}
    echo ${vendorbrand}

    echo ${systemdevice}
    echo ${vendordevice}

    echo ${systemmanufacturer}
    echo ${vendormanufacturer}

    echo ${systemmodel}
    echo ${vendormodel}

    echo ${systemname}
    echo ${vendorname}
    echo '***************************************************************************************************************************'    
    echo 'print compare results:'
    echo '***************************************************************************************************************************'
    checkfingerprint "${systemfingerprint_new}" "${vendorfingerprint_new}"
    checkbrand "${systembrand_new}" "${vendorbrand_new}"
    checkdevice "${systemdevice_new}" "${vendordevice_new}"
    checkmanufacturer "${systemmanufacturer_new}" "${vendormanufacturer_new}"
    checkmodel "${systemmodel_new}" "${vendormodel_new}"
    checkname "${systemname_new}" "${vendorname_new}"
    echo '***************************************************************************************************************************'

}


main $1 $2 $3
# where:
#$1 absolute package dir 
#$2 package name 
#$3 sudo password

使用方法:

(1) sudo chmod 777 checkimg

(2) 将checkimg的存放路径加到环境变量中(.bashrc)

(3) checkimg v1 v2 v3

  v1:存放要检查的rom包的绝对路径

  v2:要检查的rom包的名称

  v3:执行sudo时你电脑上的密码

运行结果示例:

F9关键结果部分:


now print results:


print important properties:


ro.build.fingerprint=xiaomi/lotus/lotus:8.1.0/O11019/V10.1.2.0.OFICNFI:user/release-keys
ro.vendor.build.fingerprint=xiaomi/lotus/lotus:8.1.0/O11019/V10.1.2.0.OFICNFI:user/release-keys
ro.product.brand=xiaomi
ro.vendor.product.brand=xiaomi
ro.product.device=lotus
ro.vendor.product.device=lotus
ro.product.manufacturer=Xiaomi
ro.vendor.product.manufacturer=Xiaomi
ro.product.model=MI PLAY
ro.vendor.product.model=lotus
ro.product.name=lotus
ro.vendor.product.name=lotus


print compare results:


fingerprint check pass
brand check pass
device check pass
manufacturer check pass
diffenerent model, need to modify
name check pass


可以看到model name有问题,需要处理,测试就把这个终端上显示的结果贴出来,建个jira指给CTS研发即可

F1关键结果部分:


now print results:


print important properties:


./systemtmp/system/build.prop:ro.build.fingerprint=Xiaomi/cepheus/cepheus:9/PKQ1.181121.001/9.1.23:user/release-keys
ro.vendor.build.fingerprint=Xiaomi/cepheus/cepheus:9/PKQ1.181121.001/9.1.23:user/release-keys
./systemtmp/system/build.prop:ro.product.brand=Xiaomi
ro.product.vendor.brand=Xiaomi
./systemtmp/system/build.prop:ro.product.device=cepheus
ro.product.vendor.device=cepheus
./systemtmp/system/build.prop:ro.product.manufacturer=Xiaomi
ro.product.vendor.manufacturer=Xiaomi
./systemtmp/system/build.prop:ro.product.model=Cepheus
ro.product.vendor.model=Cepheus
./systemtmp/system/build.prop:ro.product.name=cepheus
ro.product.vendor.name=cepheus


print compare results:


fingerprint check pass
brand check pass
device check pass
manufacturer check pass
model check pass
name check pass


这是我下的F1最新开发版,可以看到6个属性都是一样的,没问题,这种就目前来说,不会影响测试,无需提单

三.脚本原理及优缺点

原理:把包解压开来,解压system.img和vendor.img;找到其中的build.prop中的元素进行对比,看看有没有不一样的;

优点:
1.避免了测试刷机,正常测试需要刷miui版本先校验一下,再刷gsi版本进行校验,其实也浪费时间,并测试项过多,常常忘测或者漏测
2.防止开发在miui版本对属性进行overlay,导致刷miui版本时属性一致,直到刷了gsi之后才暴露;这种检查方式即方便,也能做到排除overlay的干扰

缺点:
1.脚本需要跟着build.prop的位置,属性名称的修改,检查项的增加与修改而变化,健壮性不够,后续还要根据google的修改及时维护;
2.功能不够完善,写的也不是太好看

四.问题总结

这个问题最近常常出现,因此觉得人工的检查方式似乎是有些局限性的,因此写了脚本进行处理;

请CTS测试再测小数版之前一定要用脚本进行验证,避免此类问题在整数版出现

同时有新问题注意及时反馈,修改脚本

你可能感兴趣的:(CTS/GTS/GSI/VTS无法提交报告问题复盘)