def is_process_exist(self): # Crash report中找到了ipa的名字,说明crash了 process_exist = True cmd = CommandUtils.is_ios_process_exist(self.rule.udid) stdout, stderr = CommandUtils.command_exe(cmd) if self.process_name in stdout: logger.info("========!!!!!!!!!!!iOS IPA: {0} crashed!!!!".format( self.process_name)) process_exist = False return process_exist
def run(TrafficFilters, Ports, Drvs, DrvPorts): result = {"health_drilldowns": []} handle_traffic_filters(result, TrafficFilters, Ports) handle_drvs(result, Drvs, DrvPorts) CommandUtils.set_attribute("Result", json_util.dumps(result), _get_this_cmd()) return True
def android_sdk_version(self, udid): cmd = CommandUtils.android_sdk_version(udid) stdout, stderr = CommandUtils.command_exe(cmd) if len(stderr) == 1: raise UDIDError( "Fail to get sdk version; udid : {0} is wrong!".format(udid)) elif len(stdout) != 1: raise CommandError("cmd result is wrong; cmd ==> {0}".format( cmd.join(" "))) logger.info("info : current android sdk version is {0}".format( stdout[0])) return stdout[0]
def run(TrafficFilters, Ports, Drvs, DrvPorts, CallbackInfo): cb = json_util.loads(CallbackInfo) clear_sequencer() cmd = create_command_hnd(TrafficFilters, Ports, Drvs, DrvPorts) with AutoCommand("SequencerInsertCommand") as seq_insert_cmd: seq_insert_cmd.SetCollection("CommandList", [cmd]) seq_insert_cmd.Execute() with AutoCommand("SubscribePropertyChangeCommand") as sub_cmd: sub_cmd.Set("PropertyClassId", "sequencer") sub_cmd.SetCollection("PropertyIdList", [ "sequencer.state", "sequencer.teststate" ]) sub_cmd.Set("PublishUrl", cb["url"]) sub_cmd.Set("Context", cb["context"]) sub_cmd.Execute() CommandUtils.set_attribute("StartedCommand", cmd, _get_this_cmd()) return True
def is_process_exist(self): # adb命令查找进程名字, 找不到说明crash logger.info("action : confirm app process exist or not") process_exist = True cmd = CommandUtils.is_android_process_exist(self.rule.udid, self.process_name) stdout, stderr = CommandUtils.command_exe(cmd) if len(stdout) == 0: logger.info( "info : Android Package: {0} not found in process list.It is crashed." .format(self.process_name)) process_exist = False else: if self.process_name not in stdout[0]: logger.info( "info : Android Package: {0} not found in process list.It is crashed." .format(self.process_name)) process_exist = False return process_exist
def run(TrafficFilter, TargetPort, CallbackInfo): hnd_reg = CHandleRegistry.Instance() cb = json.loads(CallbackInfo) with AutoCommand("SubscribePropertyChangeCommand") as pushCmd: pushCmd.Set("PropertyClassId", "ResultViewData") pushCmd.SetCollection("PropertyIdList", ["ResultViewData.ResultData"]) pushCmd.Set("PublishUrl", str(cb["url"])) pushCmd.Set("Context", str(cb["context"])) pushCmd.Execute() with AutoCommand("CreateDrvFromResultFilterCommand") as createDrvCmd: createDrvCmd.Set("CounterResultFilter", TrafficFilter) createDrvCmd.SetCollection("RxPortHandleList", [TargetPort]) createDrvCmd.Execute() drvHnd = createDrvCmd.Get("DynamicResultView") drv = hnd_reg.Find(drvHnd) prq = drv.GetObject('PresentationResultQuery') columns = prq.GetCollection("SelectProperties") with AutoCommand('subscribeDynamicResultView') as subscribeCmd: subscribeCmd.Set('DynamicResultView', drvHnd) subscribeCmd.Execute() with AutoCommand("TimedRefreshResumeCommand") as refresh_cmd: refresh_cmd.Set("DynamicResultView", drvHnd) refresh_cmd.Execute() CommandUtils.set_attribute("HealthDetailDrv", drvHnd, _get_this_cmd()) CommandUtils.set_attribute("HealthDetailDrvChild", prq.GetObjectHandle(), _get_this_cmd()) CommandUtils.set_collection("HealthDetailColumns", columns, _get_this_cmd()) return True