Example #1
0
 def openCheckSum(self):
     adb.check_output(adb.addQuotes("chmod 777 /data/local/tmp"))
     adb.check_output(adb.addQuotes("setenforce 0"))
     adb.check_output(
         adb.addQuotes("echo 0 1 > /sys/class/vdec/frame_check"))
     adb.check_output(
         adb.addQuotes(
             "echo 0x30 > /sys/module/decoder_common/parameters/fc_debug"))
     adb.check_output(
         adb.addQuotes(
             "echo 1 > /sys/module/decoder_common/parameters/checksum_enable"
         ))
Example #2
0
 def checkTextFile(self):
     '''
     检测待测产品中是否存在 测试文件
     :return:
     '''
     result = adb.check_logcat('shell ls %s' % adb.addQuotes(self.testFile))
     if 'No such file or directory' in ''.join(result.stderr.readlines()):
         print('不存在测试文件,创建中')
         ser.write('su')
         adb.root()
         adb.check_output('touch %s' % adb.addQuotes(self.testFile))
         return True
     else:
         return False
Example #3
0
 def getCpuInfo(self):
     while True:
         with open(self.rootPath + '/result/cpuInfo.log', 'a') as f:
             fcntl.flock(f.fileno(), fcntl.LOCK_EX)
             self.all_count += 1
             topInfo = adb.check_output(adb.addQuotes('top -n 1 -m 5'))
             if topInfo:
                 f.write('Top info:\n')
                 f.write(topInfo)
                 f.write('\n')
                 f.write('current_freq: ')
                 f.write(adb.check_output(self.cur_freq).strip())
                 f.write('\n')
                 f.write('max_freq: ')
                 f.write(adb.check_output(self.max_freq).strip())
                 f.write('\n')
                 f.write('min_freq: ')
                 f.write(adb.check_output(self.min_freq).strip())
                 f.write('\n')
                 f.write('cpu_online: ')
                 f.write(adb.check_output(self.cpu_online).strip())
                 f.write('\n')
                 f.write('cpu_temperature: ')
                 f.write(adb.check_output(self.cpu_temperature).strip())
                 f.write('\n')
                 f.write('-' * 20 + '\n')
                 sleep(3)
             else:
                 self.error_count += 1
Example #4
0
 def switchRation(self):
     for i in self.radioList:
         print('Switch -> ', i)
         self.times += 1
         for j in self.setRatioCommand:
             adb.run(adb.addQuotes(j.format(i)))
         sleep(4)
         current = adb.check_output(self.getRatioCommand)
         print("Current radio: ", adb.check_output(self.getRatioCommand))
         screen.capture(i + str(self.times))
         if i not in current:
             print('切换失败')
             self.errorCount += 1
             self.result = 'Fail'
     adb.check_output(
         adb.addQuotes('echo {} > /sys/class/display/mode'.format(
             self.bestResultion)))
Example #5
0
 def pushRecoverySh(self):
     '''
     检测待测产品中是否存在 recovery.sh
     :return:
     '''
     result = adb.check_logcat('shell ls %s' % adb.addQuotes(self.testSh))
     if 'No such file or directory' in ''.join(result.stderr.readlines()):
         print('不存在测试脚本,创建中')
         adb.root()
         adb.check_logcat('push ' + self.rootPath + '/scriptPython/sh/recovery.sh /data/')
         adb.check_output('chmod a+x /data/recovery.sh')
Example #6
0
 def playback(self,
              videoInfo='',
              random_seek='',
              yuvOpen=False,
              frameDrop=False):
     print('开始播放')
     # 检测是否有弹窗
     if 'name' not in videoInfo:
         videoList = self.videoInfo
     else:
         self.check.videoName = videoInfo['name']
         videoList = [
             videoInfo['url'],
         ]
     adb.check_output('am force-stop %s' % self.playerActivity)
     time.sleep(2)
     adb.check_logcat('logcat -c')
     adb.check_output('setprop vendor.sys.videoplayer.debug true')
     if yuvOpen:
         print('打开checksum')
         self.yuv.active = True
         self.yuv.openCheckSum()
     if frameDrop:
         print('打开framedrop check')
         self.dropCheck.active = True
         self.dropCheck.openOMXLog()
     if random_seek:
         print('开启随机seek')
         adb.check_output('setprop vendor.sys.vprandomseek.enable true')
     for video in videoList:
         self.check.videoPath = video.strip()
         self.check.videoType = 'LocalPlayback'
         video = video.replace('(', '\(').replace(')', '\)').strip()
         print('Playing : %s' % video)
         info = adb.check_output(
             'am start -n ' + self.playerActivity + ' -d ' +
             adb.addQuotes('file:/storage/' + self.uuid +
                           self.uDiskVideoPath + video) + random_seek)
         print(info)
         # Todo 待加入更多的异常判断
         if 'error' in info:
             print('异常!无法播放')
             self.check.error = 'Error'
             log.writeResultTXT(self.check.getvideoName(),
                                self.check.videoType, self.check.decodeType,
                                self.check.error)
             continue
         time.sleep(1)
         self.check.error = 'OK'
         self.check.getLogcat(self.yuv.active, self.dropCheck.active)
         log.cleanStatus()
         time.sleep(1)
     adb.check_output('am force-stop %s' % self.playerActivity)
Example #7
0
 def __init__(self):
     rootPath = os.path.abspath(os.path.dirname(__file__))
     self.rootPath = rootPath[:rootPath.find('AATS_FW') + 7]
     self.cur_freq = 'cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq'
     self.max_freq = 'cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq'
     self.min_freq = 'cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq'
     self.cpu_online = 'cat /sys/devices/system/cpu/online'
     self.cpu_temperature = 'cat /sys/class/thermal/thermal_zone0/temp'
     self.temperature_control = adb.check_output(
         adb.addQuotes(self.cpu_temperature.replace('temp', 'mode')))
     self.error_count = 0
     self.all_count = 0
     if os.path.exists(self.rootPath + '/result/cpuInfo.log'):
         os.remove(self.rootPath + '/result/cpuInfo.log')
Example #8
0
 def run_recovery(self):
     '''
     执行脚本
     :return:
     '''
     adb.check_output('sh %s' % adb.addQuotes(self.testSh))
Example #9
0
 def openOMXLog(self):
     adb.check_output(adb.addQuotes("setprop media.omx.log_levels 255"))
     adb.check_output(adb.addQuotes("setprop vendor.media.omx.log_levels 255"))