부팅중 문제가 발생하여 문제를 수정했는데,
데이터 삭제 & 리부팅을 무한 반복하기는 싫고, 그래서 Perl이나 Python으로 자동화 테스트를 하려다보니..
logcat 찍는게 좀 많이 걸려서 하나 만들었음.
돌려놓고 다음날 출근해서 UltraEdit로 몽땅 열어서 log 검색하면 끝~
#!/usr/bin/python
# -*- coding: utf-8 -*-
import time
import os
import sys
import string
import pickle
import subprocess
import logging
import threading
i = 1
#로깅
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.INFO)
class LogPipe(threading.Thread):
def __init__(self, level):
"""Setup the object with a logger and a loglevel
and start the thread
"""
threading.Thread.__init__(self)
self.daemon = False
self.level = level
self.fdRead, self.fdWrite = os.pipe()
self.pipeReader = os.fdopen(self.fdRead)
self.start()
def fileno(self):
"""Return the write file descriptor of the pipe
"""
return self.fdWrite
def run(self):
"""Run the thread, logging everything.
"""
for line in iter(self.pipeReader.readline, ''):
logging.log(self.level, line.strip('\n'))
self.pipeReader.close()
def close(self):
"""Close the write end of the pipe.
"""
os.close(self.fdWrite)
while 1:
print i
# DELETE APPLICATION'S DATA FILES
print "adb shell mount -r -w -o remount device data"
os.system( r"adb shell mount -r -w -o remount device data" )
time.sleep(5)
print "adb shell rm -r data/data/패키지명"
os.system( r"adb shell rm -r data/data/패키지명" )
time.sleep(2)
# REBOOT DEVICE
print "adb reboot"
os.system( r"adb reboot" )
print "wating reboot (15)"
time.sleep(15)
print "wating reboot (15)"
time.sleep(15)
print "wating reboot (15)"
time.sleep(15)
print "wating reboot (15)"
time.sleep(15)
print "wating reboot (15)"
time.sleep(15)
print "wating reboot (15)"
time.sleep(15)
# SAVE LOGCAT
logpipe = LogPipe(logging.INFO)
subprocess.Popen("adb logcat -v time > wipe_reboot_" + string.zfill(i, 4) + ".log", shell=True, stderr=logpipe, stdout=logpipe)
print "wating logging (15)"
time.sleep(15)
print "wating logging (15)"
time.sleep(15)
print "wating logging (15)"
time.sleep(15)
print "wating logging (15)"
time.sleep(15)
subprocess.Popen("adb kill-server", shell=True, stderr=logpipe, stdout=logpipe)
logpipe.close()
time.sleep(2)
i += 1
[참고자료]
http://blog.naver.com/junix?Redirect=Log&logNo=80175741279
'프로그래밍 > Android' 카테고리의 다른 글
Battery Consume Analysis (0) | 2011.01.11 |
---|---|
Admob - 어플에 광고 심기 (0) | 2011.01.07 |
안드로이드 맞고 - 근황 (2) | 2011.01.03 |
안드로이드 유료계정 + Weather paper2 (0) | 2010.12.28 |
안드로이드 다중언어 개발 (0) | 2010.12.15 |