循环打开关闭camera 测试

这篇博客探讨了由于camera的monkey测试导致的指纹卡死问题。为了解决这个问题,作者提出了一种模拟monkey测试的方法,包括通过adb shell命令打开和关闭apk。在执行过程中遇到浮点数运算的语法错误,解决方案是利用awk进行浮点数运算。
摘要由CSDN通过智能技术生成

camera的monkey导致指纹卡死。做以下测试模拟monkey过程。

#! /bin/bash


declare -i counter=0
declare -i count_max=9999999

function get_time(){
	#echo $#
	#echo $1
	begin_s=`echo $1 | cut -d \. -f 1`
	begin_ns=10#`echo $1 | cut -d \. -f 2`
	#echo $2
	end_s=`echo $2 | cut -d \. -f 1`
	end_ns=10#`echo $2 | cut -d \. -f 2`
	#echo $begin_s
	#echo $begin_ns
	#echo $end_s
	#echo $end_ns
	declare -i period_s=$end_s-$begin_s
	declare -i period_ns=$end_ns-$begin_ns
	#echo $period_ns
	if(( period_ns < 0 )); then 
		#echo "ns<0"
		period_s=period_s-1
		period_ns=1000000000+period_ns
	fi
	result_period=$period_s.$period_ns
	echo $result_period
	#return $result_period
}

while [ $counter -lt $count_max ]
do 
	echo $counter
	begin_s=`date +%s.%N`
	adb shell am start -n com.zte.camera/com.zte.camera.CameraActivity
	sleep 0.5
	adb shell am force-stop com.zte.came
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值