def loop_run_test(during): i = 0 cmd = build_instrument_cmd_v2() start_time = int(time.clock()) while 1: if not AdbUtils.verify_adb_devices_serialno(): if not AdbUtils.adb_connect_to_device(g_device_ip): logging.error('device is disconnect!') exit(1) run_instrument_tests_v2(cmd) time.sleep(3) i += 1 logging.info('run ui test %d times.' % i) cur_run_time = int(time.clock()) - start_time logging.info('current run time: %d minutes %d seconds' % (cur_run_time / 60, cur_run_time % 60)) if ((cur_run_time - start_time) > during): break # END LOOP global g_total_run_times g_total_run_times = i
def main_instument_setup(): if not AdbUtils.verify_adb_devices_serialno(): print 'Error, No adb devices connected, and exit!' exit(1) if not os.path.exists(REPORT_DIR_PATH): os.makedirs(REPORT_DIR_PATH) delete_old_instrument_run_listener_logs()