When monkey tests are running in android phones, phones have memory leakage and are difficult to trace system status,
although logcat, kernel log can provide some information.
Android limitation
- Linux crond is not supported
- Even if busybox tool package is available, ithas incomplete bash or sh shell capability.
One simple workaround script is provided here to monitor system status in given time interval.
The basic idea is
- push script to phone
adb push monitor.sh /
- grant execution mode ( root needed)
chmod 0777 monitor.sh
- start script execution from PC side
adb shell sh monitor.sh > monitor_log.txt - start normal monkey test
- monitor_log.txt can be analyzed after monkey test is finished
#!/bin/sh
while [ 1 ]
do
echo "uptime"
uptime
echo "cat /proc/cpuinfo"
cat /proc/cpuinfo
echo "top -n 1 -d 1 -m 30 -t"
top -n 1 -d 1 -m 30 -t
echo "procrank"
procrank
echo "cat /proc/vmstat"
cat /proc/vmstat
echo "cat /proc/vmallocinfo"
cat /proc/vmallocinfo
echo "cat /proc/slabinfo"
cat /proc/slabinfo
echo "cat /proc/zoneinfo"
cat /proc/zoneinfo
busybox sleep 60
done