def get_suspend_resume_time_stamp(): if wait_for_boot(): control_relay08_port_thread(port_id=1).start() for i in range(1000): time.sleep(1) if wait_for_device(): continue else: break else: return False time.sleep(10) control_relay08_port_thread(port_id=1).start() time.sleep(2) for r_time in range(180): if wait_for_boot() & r_time < 10: return True else: return False return False
def main(): host_passwd = _get_passwd() for t in range(500): if wait_for_boot(): t += 1 systrace_cmd = "echo '" + host_passwd + "'|sudo -S python runner/tools/systrace/systrace/systrace.py gfx input view webview wm am sm hal app res dalvik rs bionic power pm ss database sched irq i2c freq idle disk mmc load sync workq memreclaim binder_driver binder_lock pagecache -o {0}/sys_{1}.html -t 10 -b 32768".format( out_dir, str(t)) print systrace_cmd os.system(systrace_cmd) else: time.sleep(10)
def main(): host_passwd = _get_passwd() for t in range(500): if wait_for_boot(): t += 1 if os.path.isdir(out_dir): os.system( 'cp "./runner/tools/cpu/GPUCPU/cat_cpu_gpu.sh" {0}'.format( out_dir)) os.system('cp "./runner/tools/cpu/GPUCPU/plot.sh" {0}'.format( out_dir)) os.chdir(os.path.join(cmd_path + '/' + out_dir)) os.system("./cat_cpu_gpu.sh") else: time.sleep(10)
def get_suspend_resume_time_stamp(): control_relay08_port_thread(port_id=1).start() # click button for i in range(1000): time.sleep(1) if os.popen('adb devices').readlines()[1] == '\n': break # into suspend else: continue else: return False time.sleep(10) control_relay08_port_thread(port_id=1).start() time.sleep(2) for r_time in range(180): time.sleep(1) if wait_for_boot(): if r_time < 10: return True # suspend is sucessful else: return False else: return False return False
def get_suspend_resume_time_stamp(logs, out_dir, passwd): global count_time global waittime count_time += 1 passwd = _get_passwd() reboot_cmd = "echo " + passwd + "|sudo -S python runner/operation_lib/serial_com.py -p /dev/ttyUSB2 -c n1#" sus_start = 0 if wait_for_boot(): os.system('adb root') time.sleep(2) os.system('adb push ' + os.path.join(CUR_DIR, 'lib', 'abl_dumper_app') + ' /data') time.sleep(5) os.system('adb push ' + os.path.join(CUR_DIR, 'lib', 'android.sh') + ' /sdcard/') time.sleep(5) os.system('adb shell <' + os.path.join(CUR_DIR, 'capture-start.txt')) time.sleep(2) ctl_button = control_relay08_port_thread(port_id=1) ctl_button.start() for i in range(1000): time.sleep(1) if wait_for_device(): continue else: logs.info('into suspend') logs.info(i) break sus_start += 1 time.sleep(10) os.system('echo ' + passwd + '|sudo -S python runner/operation_lib/base_lib/relay08_ctrl_button.py -p 1') time.sleep(2) print sus_start if sus_start > 15: os.system(reboot_cmd) return False else: if wait_for_boot(): print "resume done" time.sleep(2) os.system('adb root') time.sleep(2) cmd = 'adb shell cat /d/suspend_stats >' + os.path.join(out_dir, 'suspend_stats.txt') logs.info(cmd) os.popen(cmd) time.sleep(5) f = open(os.path.join(out_dir, 'suspend_stats.txt')) line = f.readlines() if len(line) == 0: time.sleep(5) logs.info(cmd) os.system(cmd) time.sleep(5) f = open(os.path.join(out_dir, 'suspend_stats.txt')) line = f.readlines() # logs.debug(line) for i in line: if 'success:' in i: # try: item = re.search(r"\d+", i).group(0) os.system('adb root') os.system('adb shell <' + os.path.join(CUR_DIR, 'abl_dump.txt')) os.system('adb shell <' + os.path.join(CUR_DIR, 'capture-end.txt')) os.system('adb pull /data/abl_dump.txt ' + os.path.join(out_dir, 'abl_dump.txt')) os.system('adb pull /sdcard/ftrace.txt ' + os.path.join(out_dir, 'ftrace.txt')) os.system('adb pull /sdcard/dmesg.txt ' + os.path.join(out_dir, 'dmesg.txt')) os.system('adb pull /sdcard/log.txt ' + os.path.join(out_dir, 'log.txt')) p = subprocess.Popen('python ' + os.path.join(CUR_DIR, 'lib/analyze_suspend.py') + ' -ftrace ' + os.path.join(out_dir, 'ftrace.txt') + ' -dmesg ' + os.path.join(out_dir, 'dmesg.txt'), shell=True, cwd=out_dir) p.wait() os.system('adb logcat -d > ' + os.path.join(out_dir, 'logcat.txt')) try: os.rename(os.path.join(out_dir, 'output.html'), os.path.join(out_dir, 'output.h5')) except Exception, e: logs.error(e) get_abl_data(out_dir) if item == 0: os.system(reboot_cmd) return False else: return True else:
def get_suspend_resume_time_stamp(logs, out_dir): global count_time global waittime global lists_all passwd = _get_passwd() list_tmp = [] count_time += 1 reboot_cmd = "echo " + passwd + "|sudo -S python runner/operation_lib/serial_com.py -p /dev/ttyUSB2 -c n1#" list_tmp.append(count_time) if wait_for_boot(): ctl_button = control_relay08_port_thread(port_id=1) ctl_button.start() for i in range(500): time.sleep(1) if wait_for_dev(): continue else: logs.info('into suspend') break time.sleep(10) os.system( "echo " + passwd + " | sudo -S python runner/operation_lib/base_lib/relay08_ctrl_button.py -p 1" ) time.sleep(2) if wait_for_boot(): kill_fork_server() device_state() os.system('adb root') time.sleep(1) cmd = 'adb shell cat /d/suspend_stats >' + os.path.join( out_dir, 'suspend_stats.txt') logs.info(cmd) os.popen(cmd) time.sleep(1) f = open(os.path.join(out_dir, 'suspend_stats.txt')) line = f.readlines() if len(line) == 0: time.sleep(1) logs.info(cmd) os.system(cmd) time.sleep(1) f = open(os.path.join(out_dir, 'suspend_stats.txt')) line = f.readlines() else: pass for i in line: if 'success:' in i: try: item = re.search(r"\d+", i).group(0) if item == '0': list_tmp.append('0') list_tmp.append('1') lists_all.append(list_tmp) return False except Exception, e: print e else: cmd = 'adb shell dmesg >' + os.path.join(out_dir, 'dmesg.txt') os.popen(cmd) list_tmp.append('1') list_tmp.append('0') lists_all.append(list_tmp) run_case(logs, out_dir) return True
time.sleep(10) control_relay08_port_thread(port_id=1).start() time.sleep(2) for r_time in range(180): time.sleep(1) if wait_for_boot(): if r_time < 10: return True # suspend is sucessful else: return False else: return False return False def main(): tr = TestResult(__file__) if get_suspend_resume_time_stamp(): tr.result("pass") tr.save() else: tr.result("fail") tr.save() if __name__ == "__main__": if wait_for_boot(): main() else: print "can't find devices"