一.问题原因
这个问题是由于多个方面造成的,梳理下问题发生的流程
本次问题产生原因
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 |
#! /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
1 2 3 4 5 |
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测试再测小数版之前一定要用脚本进行验证,避免此类问题在整数版出现
同时有新问题注意及时反馈,修改脚本