• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python mozcrash.check_for_crashes函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mozcrash.check_for_crashes函数的典型用法代码示例。如果您正苦于以下问题:Python check_for_crashes函数的具体用法?Python check_for_crashes怎么用?Python check_for_crashes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: cleanupAndCheckForCrashes

    def cleanupAndCheckForCrashes(self, browser_config, profile_dir, test_name):
        """cleanup browser processes and process crashes if found"""

        # cleanup processes
        self._ffprocess.cleanupProcesses(browser_config['process'],
                                         browser_config['child_process'],
                                         browser_config['browser_wait'])

        # find stackwalk binary
        if platform.system() in ('Windows', 'Microsoft'):
            stackwalkpaths = ['win32', 'minidump_stackwalk.exe']
        elif platform.system() == 'Linux':
            # are we 64 bit?
            if '64' in platform.architecture()[0]:
                stackwalkpaths = ['linux64', 'minidump_stackwalk']
            else:
                stackwalkpaths = ['linux', 'minidump_stackwalk']
        elif platform.system() == 'Darwin':
            stackwalkpaths = ['osx', 'minidump_stackwalk']
        else:
            # no minidump_stackwalk available for your platform
            return
        stackwalkbin = os.path.join(os.path.dirname(__file__), 'breakpad', *stackwalkpaths)
        assert os.path.exists(stackwalkbin), "minidump_stackwalk binary not found: %s" % stackwalkbin

        if browser_config['remote'] is True:
            # favour using Java exceptions in the logcat over minidumps
            if os.path.exists('logcat.log'):
                with open('logcat.log') as f:
                    logcat = f.read().split('\r')
                found = mozcrash.check_for_java_exception(logcat)

            remoteminidumpdir = profile_dir + '/minidumps/'
            if not found:
                # check for minidumps
                minidumpdir = tempfile.mkdtemp()
                try:
                    if self._ffprocess.testAgent.dirExists(remoteminidumpdir):
                        self._ffprocess.testAgent.getDirectory(remoteminidumpdir, minidumpdir)
                except mozdevice.DMError:
                    print "Remote Device Error: Error getting crash minidumps from device"
                    raise
                found = mozcrash.check_for_crashes(minidumpdir,
                                                   browser_config['symbols_path'],
                                                   stackwalk_binary=stackwalkbin,
                                                   test_name=test_name)
                self._hostproc.removeDirectory(minidumpdir)

            # cleanup dumps on remote
            self._ffprocess.testAgent.removeDir(remoteminidumpdir)
        else:
            # check for minidumps
            minidumpdir = os.path.join(profile_dir, 'minidumps')
            found = mozcrash.check_for_crashes(minidumpdir,
                                               browser_config['symbols_path'],
                                               stackwalk_binary=stackwalkbin,
                                               test_name=test_name)

        if found:
            raise talosCrash("Found crashes after test run, terminating test")
开发者ID:lundjordan,项目名称:build-talos,代码行数:60,代码来源:ttest.py


示例2: run_gtest

    def run_gtest(self, prog, xre_path, symbols_path=None):
        """
        Run a single C++ unit test program.

        Arguments:
        * prog: The path to the test program to run.
        * env: The environment to use for running the program.
        * symbols_path: A path to a directory containing Breakpad-formatted
                        symbol files for producing stack traces on crash.

        Return True if the program exits with a zero status, False otherwise.
        """
        self.xre_path = xre_path
        env = self.build_environment()
        log.info("Running gtest")
        proc = mozprocess.ProcessHandler([prog, "-unittest"],
                                         cwd=os.getcwd(),
                                         env=env)
        #TODO: After bug 811320 is fixed, don't let .run() kill the process,
        # instead use a timeout in .wait() and then kill to get a stack.
        proc.run(timeout=GTests.TEST_PROC_TIMEOUT,
                 outputTimeout=GTests.TEST_PROC_NO_OUTPUT_TIMEOUT)
        proc.wait()
        if proc.timedOut:
            log.testFail("gtest | timed out after %d seconds", GTests.TEST_PROC_TIMEOUT)
            return False
        if mozcrash.check_for_crashes(os.getcwd(), symbols_path, test_name="gtest"):
            # mozcrash will output the log failure line for us.
            return False
        result = proc.proc.returncode == 0
        if not result:
            log.testFail("gtest | test failed with return code %d", proc.proc.returncode)
        return result
开发者ID:JuannyWang,项目名称:gecko-dev,代码行数:33,代码来源:rungtests.py


示例3: run_one_test

    def run_one_test(self, prog, env, symbols_path=None, interactive=False):
        """
        Run a single C++ unit test program remotely.

        Arguments:
        * prog: The path to the test program to run.
        * env: The environment to use for running the program.
        * symbols_path: A path to a directory containing Breakpad-formatted
                        symbol files for producing stack traces on crash.

        Return True if the program exits with a zero status, False otherwise.
        """
        basename = os.path.basename(prog)
        remote_bin = posixpath.join(self.remote_bin_dir, basename)
        self.log.test_start(basename)
        buf = StringIO.StringIO()
        returncode = self.device.shell([remote_bin], buf, env=env, cwd=self.remote_home_dir,
                                       timeout=cppunittests.CPPUnitTests.TEST_PROC_TIMEOUT)
        self.log.process_output(basename, "\n%s" % buf.getvalue(),
                                command=[remote_bin])
        with mozfile.TemporaryDirectory() as tempdir:
            self.device.getDirectory(self.remote_home_dir, tempdir)
            if mozcrash.check_for_crashes(tempdir, symbols_path,
                                          test_name=basename):
                self.log.test_end(basename, status='CRASH', expected='PASS')
                return False
        result = returncode == 0
        if not result:
            self.log.test_end(basename, status='FAIL', expected='PASS',
                              message=("test failed with return code %d" %
                                       returncode))
        else:
            self.log.test_end(basename, status='PASS', expected='PASS')
        return result
开发者ID:c0mmandCS,项目名称:Waterfox,代码行数:34,代码来源:remotecppunittests.py


示例4: check_for_crashes

    def check_for_crashes(self, dump_directory=None, dump_save_path=None, test_name=None, quiet=False):
        """
        Check for a possible crash and output stack trace.

        :param dump_directory: Directory to search for minidump files
        :param dump_save_path: Directory to save the minidump files to
        :param test_name: Name to use in the crash output
        :param quiet: If `True` don't print the PROCESS-CRASH message to stdout
        :returns: True if a crash was detected, otherwise False
        """
        if not dump_directory:
            dump_directory = os.path.join(self.profile.profile, "minidumps")

        if not dump_save_path:
            dump_save_path = self.dump_save_path

        try:
            logger = get_default_logger()
            if logger is not None:
                if test_name is None:
                    test_name = "runner.py"
                self.crashed += mozcrash.log_crashes(
                    logger, dump_directory, self.symbols_path, dump_save_path=dump_save_path, test=test_name
                )
            else:
                crashed = mozcrash.check_for_crashes(
                    dump_directory, self.symbols_path, dump_save_path=dump_save_path, test_name=test_name, quiet=quiet
                )
                if crashed:
                    self.crashed += 1
        except:
            traceback.print_exc()

        return self.crashed
开发者ID:imace,项目名称:gecko-dev-speech,代码行数:34,代码来源:runner.py


示例5: check_for_crashes

    def check_for_crashes(self, dump_directory=None, dump_save_path=None,
                          test_name=None, quiet=False):
        """
        Check for a possible crash and output stack trace.

        :param dump_directory: Directory to search for minidump files
        :param dump_save_path: Directory to save the minidump files to
        :param test_name: Name to use in the crash output
        :param quiet: If `True` don't print the PROCESS-CRASH message to stdout
        :returns: True if a crash was detected, otherwise False
        """
        if not dump_directory:
            dump_directory = os.path.join(self.profile.profile, 'minidumps')

        crashed = False
        try:
            crashed = mozcrash.check_for_crashes(dump_directory,
                                                 self.symbols_path,
                                                 dump_save_path=dump_save_path,
                                                 test_name=test_name,
                                                 quiet=quiet)
        except:
            traceback.print_exc()

        return crashed
开发者ID:qiuyang001,项目名称:Spidermonkey,代码行数:25,代码来源:runner.py


示例6: run_one_test

    def run_one_test(self, prog, env, symbols_path=None):
        """
        Run a single C++ unit test program.

        Arguments:
        * prog: The path to the test program to run.
        * env: The environment to use for running the program.
        * symbols_path: A path to a directory containing Breakpad-formatted
                        symbol files for producing stack traces on crash.

        Return True if the program exits with a zero status, False otherwise.
        """
        basename = os.path.basename(prog)
        log.info("Running test %s", basename)
        with TemporaryDirectory() as tempdir:
            proc = mozprocess.ProcessHandler([prog],
                                             cwd=tempdir,
                                             env=env)
            #TODO: After bug 811320 is fixed, don't let .run() kill the process,
            # instead use a timeout in .wait() and then kill to get a stack.
            proc.run(timeout=CPPUnitTests.TEST_PROC_TIMEOUT)
            proc.wait()
            if proc.timedOut:
                log.testFail("%s | timed out after %d seconds",
                             basename, CPPUnitTests.TEST_PROC_TIMEOUT)
                return False
            if mozcrash.check_for_crashes(tempdir, symbols_path,
                                          test_name=basename):
                log.testFail("%s | test crashed", basename)
                return False
            result = proc.proc.returncode == 0
            if not result:
                log.testFail("%s | test failed with return code %d",
                             basename, proc.proc.returncode)
            return result
开发者ID:jraff,项目名称:mozilla-central,代码行数:35,代码来源:runcppunittests.py


示例7: run_one_test

    def run_one_test(self, prog, env, symbols_path=None):
        """
        Run a single C++ unit test program remotely.

        Arguments:
        * prog: The path to the test program to run.
        * env: The environment to use for running the program.
        * symbols_path: A path to a directory containing Breakpad-formatted
                        symbol files for producing stack traces on crash.

        Return True if the program exits with a zero status, False otherwise.
        """
        basename = os.path.basename(prog)
        remote_bin = posixpath.join(self.remote_bin_dir, basename)
        log.info("Running test %s", basename)
        buf = StringIO.StringIO()
        returncode = self.device.shell([remote_bin], buf, env=env, cwd=self.remote_home_dir,
                                       timeout=cppunittests.CPPUnitTests.TEST_PROC_TIMEOUT)
        print >> sys.stdout, buf.getvalue()
        with mozfile.TemporaryDirectory() as tempdir:
            self.device.getDirectory(self.remote_home_dir, tempdir)
            if mozcrash.check_for_crashes(tempdir, symbols_path,
                                          test_name=basename):
                log.testFail("%s | test crashed", basename)
                return False
        result = returncode == 0
        if not result:
            log.testFail("%s | test failed with return code %s",
                         basename, returncode)
        return result
开发者ID:JuannyWang,项目名称:gecko-dev,代码行数:30,代码来源:remotecppunittests.py


示例8: test_symbol_path_url

    def test_symbol_path_url(self):
        """
        Test that passing a URL as symbols_path correctly fetches the URL.
        """
        open(os.path.join(self.tempdir, "test.dmp"), "w").write("foo")
        self.stdouts.append(["this is some output"])

        def make_zipfile():
            data = StringIO.StringIO()
            z = zipfile.ZipFile(data, 'w')
            z.writestr("symbols.txt", "abc/xyz")
            z.close()
            return data.getvalue()
        def get_symbols(req):
            headers = {}
            return (200, headers, make_zipfile())
        httpd = mozhttpd.MozHttpd(port=0,
                                  urlhandlers=[{'method':'GET', 'path':'/symbols', 'function':get_symbols}])
        httpd.start()
        symbol_url = urlparse.urlunsplit(('http', '%s:%d' % httpd.httpd.server_address,
                                        '/symbols','',''))
        self.assert_(mozcrash.check_for_crashes(self.tempdir,
                                                symbol_url,
                                                stackwalk_binary=self.stackwalk,
                                                quiet=True))
开发者ID:Ghost-script,项目名称:mozbase,代码行数:25,代码来源:test.py


示例9: test_symbol_path_not_present

 def test_symbol_path_not_present(self):
     open(os.path.join(self.tempdir, "test.dmp"), "w").write("foo")
     self.stdouts.append(["this is some output"])
     self.assert_(mozcrash.check_for_crashes(self.tempdir,
                                             symbols_path=None,
                                             stackwalk_binary=self.stackwalk,
                                             quiet=True))
开发者ID:MekliCZ,项目名称:positron,代码行数:7,代码来源:test.py


示例10: test_nodumps

 def test_nodumps(self):
     """
     Test that check_for_crashes returns False if no dumps are present.
     """
     self.stdouts.append(["this is some output"])
     self.assertFalse(mozcrash.check_for_crashes(self.tempdir,
                                                 'symbols_path',
                                                 stackwalk_binary=self.stackwalk))
开发者ID:AshishNamdev,项目名称:mozilla-central,代码行数:8,代码来源:test.py


示例11: check_for_crashes

    def check_for_crashes(self, browser_config, profile_dir, test_name):
        # check for minidumps
        minidumpdir = os.path.join(profile_dir, "minidumps")
        found = mozcrash.check_for_crashes(minidumpdir, browser_config["symbols_path"], test_name=test_name)
        mozfile.remove(minidumpdir)

        if found:
            raise TalosCrash("Found crashes after test run, terminating test")
开发者ID:DINKIN,项目名称:Waterfox,代码行数:8,代码来源:ttest.py


示例12: run_gtest

    def run_gtest(self, prog, xre_path, cwd, symbols_path=None,
                  utility_path=None):
        """
        Run a single C++ unit test program.

        Arguments:
        * prog: The path to the test program to run.
        * env: The environment to use for running the program.
        * cwd: The directory to run tests from (support files will be found
               in this direcotry).
        * symbols_path: A path to a directory containing Breakpad-formatted
                        symbol files for producing stack traces on crash.
        * utility_path: A path to a directory containing utility programs.
                        currently used to locate a stack fixer to provide
                        symbols symbols for assertion stacks.

        Return True if the program exits with a zero status, False otherwise.
        """
        self.xre_path = xre_path
        env = self.build_environment()
        log.info("Running gtest")

        if cwd and not os.path.isdir(cwd):
            os.makedirs(cwd)

        stream_output = mozprocess.StreamOutput(sys.stdout)
        process_output = stream_output
        if utility_path:
            stack_fixer = get_stack_fixer_function(utility_path, symbols_path)
            if stack_fixer:
                process_output = lambda line: stream_output(stack_fixer(line))


        proc = mozprocess.ProcessHandler([prog, "-unittest",
                                         "--gtest_death_test_style=threadsafe"],
                                         cwd=cwd,
                                         env=env,
                                         processOutputLine=process_output)
        #TODO: After bug 811320 is fixed, don't let .run() kill the process,
        # instead use a timeout in .wait() and then kill to get a stack.
        proc.run(timeout=GTests.TEST_PROC_TIMEOUT,
                 outputTimeout=GTests.TEST_PROC_NO_OUTPUT_TIMEOUT)
        proc.wait()
        if proc.timedOut:
            if proc.outputTimedOut:
                log.testFail("gtest | timed out after %d seconds without output",
                             GTests.TEST_PROC_NO_OUTPUT_TIMEOUT)
            else:
                log.testFail("gtest | timed out after %d seconds",
                             GTests.TEST_PROC_TIMEOUT)
            return False
        if mozcrash.check_for_crashes(cwd, symbols_path, test_name="gtest"):
            # mozcrash will output the log failure line for us.
            return False
        result = proc.proc.returncode == 0
        if not result:
            log.testFail("gtest | test failed with return code %d", proc.proc.returncode)
        return result
开发者ID:luke-chang,项目名称:gecko-1,代码行数:58,代码来源:rungtests.py


示例13: check_for_crashes

    def check_for_crashes(self, browser_config, minidump_dir, test_name):
        # check for minidumps
        found = mozcrash.check_for_crashes(minidump_dir,
                                           browser_config['symbols_path'],
                                           test_name=test_name)
        mozfile.remove(minidump_dir)

        if found:
            raise TalosCrash("Found crashes after test run, terminating test")
开发者ID:kitcambridge,项目名称:gecko-dev,代码行数:9,代码来源:ttest.py


示例14: test_simple

 def test_simple(self):
     """
     Test that check_for_crashes returns True if a dump is present.
     """
     open(os.path.join(self.tempdir, "test.dmp"), "w").write("foo")
     self.stdouts.append(["this is some output"])
     self.assert_(mozcrash.check_for_crashes(self.tempdir,
                                             'symbols_path',
                                             stackwalk_binary=self.stackwalk))
开发者ID:AshishNamdev,项目名称:mozilla-central,代码行数:9,代码来源:test.py


示例15: check_for_crashes

 def check_for_crashes(self, dump_directory, test_name=None):
     crashed = False
     try:
         crashed = mozcrash.check_for_crashes(dump_directory,
                                              self.symbols_path,
                                              test_name=test_name)
     except:
         traceback.print_exc()
     return crashed
开发者ID:drexler,项目名称:releases-mozilla-aurora,代码行数:9,代码来源:runner.py


示例16: test_stackwalk_envvar

 def test_stackwalk_envvar(self):
     """
     Test that check_for_crashes uses the MINIDUMP_STACKWALK environment var.
     """
     open(os.path.join(self.tempdir, "test.dmp"), "w").write("foo")
     self.stdouts.append(["this is some output"])
     os.environ["MINIDUMP_STACKWALK"] = self.stackwalk
     self.assert_(mozcrash.check_for_crashes(self.tempdir, "symbols_path", quiet=True))
     del os.environ["MINIDUMP_STACKWALK"]
开发者ID:Antonius32,项目名称:Pale-Moon,代码行数:9,代码来源:test.py


示例17: run_one_test

    def run_one_test(self, prog, env, symbols_path=None, interactive=False,
                     timeout_factor=1):
        """
        Run a single C++ unit test program.

        Arguments:
        * prog: The path to the test program to run.
        * env: The environment to use for running the program.
        * symbols_path: A path to a directory containing Breakpad-formatted
                        symbol files for producing stack traces on crash.
        * timeout_factor: An optional test-specific timeout multiplier.

        Return True if the program exits with a zero status, False otherwise.
        """
        basename = os.path.basename(prog)
        self.log.test_start(basename)
        with mozfile.TemporaryDirectory() as tempdir:
            if interactive:
                # For tests run locally, via mach, print output directly
                proc = mozprocess.ProcessHandler([prog],
                                                 cwd=tempdir,
                                                 env=env,
                                                 storeOutput=False)
            else:
                proc = mozprocess.ProcessHandler([prog],
                                                 cwd=tempdir,
                                                 env=env,
                                                 storeOutput=True,
                                                 processOutputLine=lambda _: None)
            #TODO: After bug 811320 is fixed, don't let .run() kill the process,
            # instead use a timeout in .wait() and then kill to get a stack.
            test_timeout = CPPUnitTests.TEST_PROC_TIMEOUT * timeout_factor
            proc.run(timeout=test_timeout,
                     outputTimeout=CPPUnitTests.TEST_PROC_NO_OUTPUT_TIMEOUT)
            proc.wait()
            if proc.output:
                output = "\n%s" % "\n".join(proc.output)
                self.log.process_output(proc.pid, output, command=[prog])
            if proc.timedOut:
                message = "timed out after %d seconds" % CPPUnitTests.TEST_PROC_TIMEOUT
                self.log.test_end(basename, status='TIMEOUT', expected='PASS',
                                  message=message)
                return False
            if mozcrash.check_for_crashes(tempdir, symbols_path,
                                          test_name=basename):
                self.log.test_end(basename, status='CRASH', expected='PASS')
                return False
            result = proc.proc.returncode == 0
            if not result:
                self.log.test_end(basename, status='FAIL', expected='PASS',
                                  message=("test failed with return code %d" %
                                           proc.proc.returncode))
            else:
                self.log.test_end(basename, status='PASS', expected='PASS')
            return result
开发者ID:MichaelKohler,项目名称:gecko-dev,代码行数:55,代码来源:runcppunittests.py


示例18: check_for_crashes

    def check_for_crashes(self, dump_directory=None, test_name=None):
        if not dump_directory:
            dump_directory = os.path.join(self.profile.profile, 'minidumps')

        crashed = False
        try:
            crashed = mozcrash.check_for_crashes(dump_directory,
                                                 self.symbols_path,
                                                 test_name=test_name)
        except:
            traceback.print_exc()
        return crashed
开发者ID:Nicksol,项目名称:mozbase,代码行数:12,代码来源:runner.py


示例19: checkForCrashes

 def checkForCrashes(self, directory, symbolsPath):
     crashed = False
     remote_dump_dir = self._remoteProfile + "/minidumps"
     if self._devicemanager.dirExists(remote_dump_dir):
         local_dump_dir = tempfile.mkdtemp()
         self._devicemanager.getDirectory(remote_dump_dir, local_dump_dir)
         try:
             crashed = mozcrash.check_for_crashes(local_dump_dir, symbolsPath, test_name=self.lastTestSeen)
         finally:
             shutil.rmtree(local_dump_dir)
             self._devicemanager.removeDir(remote_dump_dir)
     return crashed
开发者ID:pnkfelix,项目名称:iontrail,代码行数:12,代码来源:b2gautomation.py


示例20: test_save_path_not_present

 def test_save_path_not_present(self):
     """
     Test that dump_save_path works when the directory doesn't exist.
     """
     open(os.path.join(self.tempdir, "test.dmp"), "w").write("foo")
     save_path = os.path.join(self.tempdir, "saved")
     self.stdouts.append(["this is some output"])
     self.assert_(mozcrash.check_for_crashes(self.tempdir,
                                             'symbols_path',
                                             stackwalk_binary=self.stackwalk,
                                             dump_save_path=save_path))
     self.assert_(os.path.isfile(os.path.join(save_path, "test.dmp")))
开发者ID:luser,项目名称:mozbase,代码行数:12,代码来源:test.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python mozcrash.check_for_java_exception函数代码示例发布时间:2022-05-27
下一篇:
Python authentication.get_credentials函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap