Monkey自动化测试脚本以及电量记录脚本

Monkey自动化测试过程中发现monkey进程重启,因此加入检测monkey进程重启脚本。


#!/system/bin/sh while true do echo "checking monkey..." monkeyPID=$(pgrep com.android.commands.monkey) echo $monkeyPID if [ -z "$monkeyPID"] ; then echo "monkey is died, reboot monkey..." monkey --ignore-crashes --ignore-timeouts --ignore-security-exceptions --ignore-native-crashes --kill-process-after-error --pkg-whitelist-file /data/local/tmp/monkey-whitelist.dat --throttle 250 -v -v -v 99999999 > sdcard/monkey_log/monkey.log & else echo "monkey exist, continue..." fi sleep 30 done



另外加入monkey测试过程中记录电量变化的脚本


#!/system/bin/shfile_date=$(date +'%Y%m%d-%H%M')chmod 777 /sdcardmkdir /sdcard/Atestlogmkdir /sdcard/Atestlog/bqmkdir /sdcard/Atestlog/logchmod 777 /sdcard/Atestlogchmod 777 /sdcard/Atestlog/bqchmod 777 /sdcard/Atestlog/logecho 'file qpnp-bms.c +p' > /sys/kernel/debug/dynamic_debug/controlcat /proc/kmsg > /sdcard/Atestlog/log/kmsg_$file_date.txt &logcat -v time > /sdcard/Atestlog/log/logcat_$file_date.txt &#把当前的时间和电量值写入文件record(){echo $(date +'%Y/%m/%d\t%H:%M:%S\t')$(cat /sys/class/power_supply/bq27542/voltage_now)'\t'$(cat /sys/class/power_supply/bq27542/current_now)'\t'$(cat /sys/class/power_supply/bq27542/temp)'\t'$(cat /sys/class/power_supply/bq27542/capacity)%'\t' "

" >> /sdcard/Atestlog/bq/bq_$file_date.txt}#无限循环执行写电量值操作,每次循环间隔count=0while truedo  record $count  sleep 5  let count=$count+1done

你可能感兴趣的:(Monkey自动化测试脚本以及电量记录脚本)