def run_raptor(self, **kwargs): build_obj = self is_android = Conditions.is_android(build_obj) or \ kwargs['app'] in FIREFOX_ANDROID_BROWSERS if is_android: from mozrunner.devices.android_device import ( verify_android_device, InstallIntent) from mozdevice import ADBAndroid install = InstallIntent.NO if kwargs.pop( 'noinstall', False) else InstallIntent.PROMPT if not verify_android_device( build_obj, install=install, app=kwargs['binary'], xre=True): # Equivalent to 'run_local' = True. return 1 debug_command = '--debug-command' if debug_command in sys.argv: sys.argv.remove(debug_command) raptor = self._spawn(RaptorRunner) device = None try: if kwargs['power_test'] and is_android: device = ADBAndroid(verbose=True) disable_charging(device) return raptor.run_test(sys.argv[2:], kwargs) except Exception as e: print(repr(e)) return 1 finally: if kwargs['power_test'] and device: enable_charging(device)
def run_raptor(self, **kwargs): # Defers this import so that a transitive dependency doesn't # stop |mach bootstrap| from running from raptor.power import enable_charging, disable_charging build_obj = self is_android = (Conditions.is_android(build_obj) or kwargs["app"] in ANDROID_BROWSERS) if is_android: from mozrunner.devices.android_device import ( verify_android_device, InstallIntent, ) from mozdevice import ADBDeviceFactory install = (InstallIntent.NO if kwargs.pop("noinstall", False) else InstallIntent.YES) verbose = False if (kwargs.get("log_mach_verbose") or kwargs.get("log_tbpl_level") == "debug" or kwargs.get("log_mach_level") == "debug" or kwargs.get("log_raw_level") == "debug"): verbose = True if not verify_android_device( build_obj, install=install, app=kwargs["binary"], verbose=verbose, xre=True, ): # Equivalent to 'run_local' = True. return 1 debug_command = "--debug-command" if debug_command in sys.argv: sys.argv.remove(debug_command) raptor = self._spawn(RaptorRunner) device = None try: if kwargs["power_test"] and is_android: device = ADBDeviceFactory(verbose=True) disable_charging(device) return raptor.run_test(sys.argv[2:], kwargs) except BinaryNotFoundException as e: self.log(logging.ERROR, "raptor", {"error": str(e)}, "ERROR: {error}") self.log(logging.INFO, "raptor", {"help": e.help()}, "{help}") return 1 except Exception as e: print(repr(e)) return 1 finally: if kwargs["power_test"] and device: enable_charging(device)
def run_raptor(self, **kwargs): # Defers this import so that a transitive dependency doesn't # stop |mach bootstrap| from running from raptor.power import enable_charging, disable_charging build_obj = self is_android = Conditions.is_android(build_obj) or \ kwargs['app'] in ANDROID_BROWSERS if is_android: from mozrunner.devices.android_device import ( verify_android_device, InstallIntent) from mozdevice import ADBAndroid install = InstallIntent.NO if kwargs.pop( 'noinstall', False) else InstallIntent.YES verbose = False if kwargs.get('log_mach_verbose') or kwargs.get('log_tbpl_level') == 'debug' or \ kwargs.get('log_mach_level') == 'debug' or kwargs.get('log_raw_level') == 'debug': verbose = True if not verify_android_device( build_obj, install=install, app=kwargs['binary'], verbose=verbose, xre=True): # Equivalent to 'run_local' = True. return 1 debug_command = '--debug-command' if debug_command in sys.argv: sys.argv.remove(debug_command) raptor = self._spawn(RaptorRunner) device = None try: if kwargs['power_test'] and is_android: device = ADBAndroid(verbose=True) disable_charging(device) return raptor.run_test(sys.argv[2:], kwargs) except BinaryNotFoundException as e: self.log(logging.ERROR, 'raptor', {'error': str(e)}, 'ERROR: {error}') self.log(logging.INFO, 'raptor', {'help': e.help()}, '{help}') return 1 except Exception as e: print(repr(e)) return 1 finally: if kwargs['power_test'] and device: enable_charging(device)
def run_raptor(self, **kwargs): build_obj = self is_android = Conditions.is_android(build_obj) or \ kwargs['app'] in ANDROID_BROWSERS if is_android: from mozrunner.devices.android_device import ( verify_android_device, InstallIntent) from mozdevice import ADBAndroid install = InstallIntent.NO if kwargs.pop( 'noinstall', False) else InstallIntent.YES if not verify_android_device( build_obj, install=install, app=kwargs['binary'], xre=True): # Equivalent to 'run_local' = True. return 1 debug_command = '--debug-command' if debug_command in sys.argv: sys.argv.remove(debug_command) raptor = self._spawn(RaptorRunner) device = None try: if kwargs['power_test'] and is_android: device = ADBAndroid(verbose=True) disable_charging(device) return raptor.run_test(sys.argv[2:], kwargs) except BinaryNotFoundException as e: self.log(logging.ERROR, 'raptor', {'error': str(e)}, 'ERROR: {error}') self.log(logging.INFO, 'raptor', {'help': e.help()}, '{help}') return 1 except Exception as e: print(repr(e)) return 1 finally: if kwargs['power_test'] and device: enable_charging(device)
def run_raptor(self, **kwargs): # Defers this import so that a transitive dependency doesn't # stop |mach bootstrap| from running from raptor.power import enable_charging, disable_charging build_obj = self is_android = (Conditions.is_android(build_obj) or kwargs["app"] in ANDROID_BROWSERS) if is_android: from mozrunner.devices.android_device import ( verify_android_device, InstallIntent, ) from mozdevice import ADBDeviceFactory install = (InstallIntent.NO if kwargs.pop("noinstall", False) else InstallIntent.YES) verbose = False if (kwargs.get("log_mach_verbose") or kwargs.get("log_tbpl_level") == "debug" or kwargs.get("log_mach_level") == "debug" or kwargs.get("log_raw_level") == "debug"): verbose = True if not verify_android_device( build_obj, install=install, app=kwargs["binary"], verbose=verbose, xre=True, ): # Equivalent to 'run_local' = True. return 1 # Remove mach global arguments from sys.argv to prevent them # from being consumed by raptor. Treat any item in sys.argv # occuring before "raptor" as a mach global argument. argv = [] in_mach = True for arg in sys.argv: if not in_mach: argv.append(arg) if arg.startswith("raptor"): in_mach = False raptor = self._spawn(RaptorRunner) device = None try: if kwargs["power_test"] and is_android: device = ADBDeviceFactory(verbose=True) disable_charging(device) return raptor.run_test(argv, kwargs) except BinaryNotFoundException as e: self.log(logging.ERROR, "raptor", {"error": str(e)}, "ERROR: {error}") self.log(logging.INFO, "raptor", {"help": e.help()}, "{help}") return 1 except Exception as e: print(repr(e)) return 1 finally: if kwargs["power_test"] and device: enable_charging(device)