当前位置: 首页>>代码示例>>Python>>正文


Python Runner.check_for_crashes方法代码示例

本文整理汇总了Python中mozrunner.Runner.check_for_crashes方法的典型用法代码示例。如果您正苦于以下问题:Python Runner.check_for_crashes方法的具体用法?Python Runner.check_for_crashes怎么用?Python Runner.check_for_crashes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mozrunner.Runner的用法示例。


在下文中一共展示了Runner.check_for_crashes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: GaiaUnitTestRunner

# 需要导入模块: from mozrunner import Runner [as 别名]
# 或者: from mozrunner.Runner import check_for_crashes [as 别名]
class GaiaUnitTestRunner(object):

    def __init__(self, binary=None, profile=None, symbols_path=None,
                 browser_arg=()):
        self.binary = binary
        self.profile = profile
        self.symbols_path = symbols_path
        self.browser_arg = browser_arg

    def run(self):
        self.profile_dir = os.path.join(tempfile.mkdtemp(suffix='.gaiaunittest'),
                                        'profile')
        shutil.copytree(self.profile, self.profile_dir)

        cmdargs = ['--runapp', 'Test Agent']
        if self.browser_arg:
            cmdargs += list(self.browser_arg)

        profile = Profile(profile=self.profile_dir)
        self.runner = Runner(binary=self.binary,
                             profile=profile,
                             clean_profile=False,
                             cmdargs=cmdargs,
                             symbols_path=self.symbols_path)
        self.runner.start()

    def cleanup(self):
        print 'checking for crashes'
        crashed = self.runner.check_for_crashes()
        self.runner.cleanup()
        shutil.rmtree(os.path.dirname(self.profile_dir))
        return crashed

    __del__ = cleanup
开发者ID:AaskaShah,项目名称:gaia,代码行数:36,代码来源:main.py

示例2: GeckoInstance

# 需要导入模块: from mozrunner import Runner [as 别名]
# 或者: from mozrunner.Runner import check_for_crashes [as 别名]
class GeckoInstance(object):

    required_prefs = {"marionette.defaultPrefs.enabled": True,
                      "marionette.defaultPrefs.port": 2828,
                      "marionette.logging": True,
                      "startup.homepage_welcome_url": "about:blank",
                      "browser.shell.checkDefaultBrowser": False,
                      "browser.startup.page": 0,
                      "browser.sessionstore.resume_from_crash": False,
                      "browser.warnOnQuit": False}

    def __init__(self, host, port, bin, profile, app_args=None, symbols_path=None,
                  gecko_log=None):
        self.marionette_host = host
        self.marionette_port = port
        self.bin = bin
        self.profile_path = profile
        self.app_args = app_args or []
        self.runner = None
        self.symbols_path = symbols_path
        self.gecko_log = gecko_log

    def start(self):
        profile_args = {"preferences": self.required_prefs}
        if not self.profile_path:
            profile_args["restore"] = False
            profile = Profile(**profile_args)
        else:
            profile_args["path_from"] = self.profile_path
            profile = Profile.clone(**profile_args)

        if self.gecko_log is None:
            self.gecko_log = 'gecko.log'
        elif os.path.isdir(self.gecko_log):
            fname = "gecko-%d.log" % time.time()
            self.gecko_log = os.path.join(self.gecko_log, fname)

        self.gecko_log = os.path.realpath(self.gecko_log)
        if os.access(self.gecko_log, os.F_OK):
            os.remove(self.gecko_log)

        env = os.environ.copy()

        # environment variables needed for crashreporting
        # https://developer.mozilla.org/docs/Environment_variables_affecting_crash_reporting
        env.update({ 'MOZ_CRASHREPORTER': '1',
                     'MOZ_CRASHREPORTER_NO_REPORT': '1', })
        self.runner = Runner(
            binary=self.bin,
            profile=profile,
            cmdargs=['-no-remote', '-marionette'] + self.app_args,
            env=env,
            symbols_path=self.symbols_path,
            process_args={
                'processOutputLine': [NullOutput()],
                'logfile': self.gecko_log})
        self.runner.start()

    def check_for_crashes(self):
        return self.runner.check_for_crashes()

    def close(self):
        if self.runner:
            self.runner.stop()
            self.runner.cleanup()
开发者ID:franzks,项目名称:gecko-dev,代码行数:67,代码来源:geckoinstance.py

示例3: GeckoInstance

# 需要导入模块: from mozrunner import Runner [as 别名]
# 或者: from mozrunner.Runner import check_for_crashes [as 别名]
class GeckoInstance(object):

    required_prefs = {"marionette.defaultPrefs.enabled": True,
                      "marionette.defaultPrefs.port": 2828,
                      "marionette.logging": True,
                      "startup.homepage_welcome_url": "about:blank",
                      "browser.shell.checkDefaultBrowser": False,
                      "browser.startup.page": 0,
                      "browser.sessionstore.resume_from_crash": False,
                      "browser.warnOnQuit": False}

    def __init__(self, host, port, bin, profile, app_args=None, symbols_path=None,
                  gecko_log=None, prefs=None):
        self.marionette_host = host
        self.marionette_port = port
        self.bin = bin
        self.profile_path = profile
        self.prefs = prefs
        self.app_args = app_args or []
        self.runner = None
        self.symbols_path = symbols_path
        self.gecko_log = gecko_log

    def start(self):
        profile_args = {"preferences": deepcopy(self.required_prefs)}
        if self.prefs:
            profile_args["preferences"].update(self.prefs)
        if not self.profile_path:
            profile_args["restore"] = False
            profile = Profile(**profile_args)
        else:
            profile_args["path_from"] = self.profile_path
            profile = Profile.clone(**profile_args)

        if self.gecko_log is None:
            self.gecko_log = 'gecko.log'
        elif os.path.isdir(self.gecko_log):
            fname = "gecko-%d.log" % time.time()
            self.gecko_log = os.path.join(self.gecko_log, fname)

        self.gecko_log = os.path.realpath(self.gecko_log)
        if os.access(self.gecko_log, os.F_OK):
            if platform.system() is 'Windows':
                # NOTE: windows has a weird filesystem where it happily 'closes'
                # the file, but complains if you try to delete it. You get a
                # 'file still in use' error. Sometimes you can wait a bit and
                # a retry will succeed.
                # If all retries fail, we'll just continue without removing
                # the file. In this case, if we are restarting the instance,
                # then the new logs just get appended to the old file.
                tries = 0
                while tries < 10:
                    try:
                        os.remove(self.gecko_log)
                        break
                    except WindowsError as e:
                        if e.errno == errno.EACCES:
                            tries += 1
                            time.sleep(0.5)
                        else:
                            raise e
            else:
                os.remove(self.gecko_log)

        env = os.environ.copy()

        # environment variables needed for crashreporting
        # https://developer.mozilla.org/docs/Environment_variables_affecting_crash_reporting
        env.update({ 'MOZ_CRASHREPORTER': '1',
                     'MOZ_CRASHREPORTER_NO_REPORT': '1', })
        self.runner = Runner(
            binary=self.bin,
            profile=profile,
            cmdargs=['-no-remote', '-marionette'] + self.app_args,
            env=env,
            symbols_path=self.symbols_path,
            process_args={
                'processOutputLine': [NullOutput()],
                'logfile': self.gecko_log})
        self.runner.start()

    def check_for_crashes(self):
        return self.runner.check_for_crashes()

    def close(self):
        if self.runner:
            self.runner.stop()
            self.runner.cleanup()

    def restart(self, prefs=None):
        self.close()
        if prefs:
            self.prefs = prefs
        else:
            self.prefs = None
        self.start()
开发者ID:jrmuizel,项目名称:mozilla-central-skia,代码行数:98,代码来源:geckoinstance.py


注:本文中的mozrunner.Runner.check_for_crashes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。