def getLog(self, path, test, result): def isExists(filename): ishave = self.a.adbshell('ls %s' %filename) if 'No such file or directory' in str(ishave): return False else: return True photoFolder = test.name.split("#")[0] caseName = test.name.split("#")[1] if(result == 'FAIL'): photoName = '/sdcard/uiAutoTest/' + photoFolder + '/' + caseName + '.png' if(isExists(photoName)): # print('pull %s %s' %(photoName, path)) self.a.adb('pull %s %s' %(photoName, path)) if(isExists('/data/anr')): os.mkdir(os.path.join(path, 'anr')) self.a.adb('pull /data/anr %s' %os.path.join(path, 'anr')) if(isExists('/data/tombstones/tombstone_0*')): os.mkdir(os.path.join(path, 'tombstones')) self.a.adb('pull /data/tombstones %s' %os.path.join(path, 'tombstones')) s = self.a.adbshell('ls %s' %(log.save_pic_path())) if s != "": for pic in s.splitlines(): self.a.adb('pull %s/%s %s/' %(log.save_pic_path(), pic, path))
def getLog(self, path): def isExists(filename): ishave = self.a.adbshell('ls %s' %filename) if 'No such file or directory' in str(ishave): return False else: return True if(isExists('/data/anr')): os.mkdir(os.path.join(path, 'anr')) self.a.adb('pull /data/anr %s' %os.path.join(path, 'anr')) if(isExists('/data/tombstones/tombstone_0*')): os.mkdir(os.path.join(path, 'tombstones')) self.a.adb('pull /data/tombstones %s' %os.path.join(path, 'tombstones')) s = self.a.adbshell('ls %s' %(log.save_pic_path())) if s != "": for pic in s.splitlines(): self.a.adb('pull %s/%s %s/' %(log.save_pic_path(), pic, path))
def clearLog(self): def isExists(filename): ishave = self.a.adbshell('ls %s' %filename) if 'No such file or directory' in str(ishave): return False else: return True if(isExists('/data/anr')): log.debug('rm -rf /data/anr') self.a.adbshell('rm -rf /data/anr') if(isExists('/data/tombstones/tombstone_0*')): tbs = self.a.adbshell('/data/tombstones/tombstone_0*') for tombstone in tbs.splitlines(): log.debug('rm %s' %tombstone) self.a.adbshell('rm %s' %tombstone) self.a.adbshell('rm %s/*.png' %log.save_pic_path())