Esempio n. 1
0
    def test_stuff_missing(self):
        raw_crash = {}
        processed_crash = DotDict()
        processor_meta = get_basic_processor_meta()

        rule = OSInfoRule()

        # the call to be tested
        rule.act(raw_crash, {}, processed_crash, processor_meta)

        # processed crash should have empties
        assert processed_crash['os_name'] == 'Unknown'
        assert processed_crash['os_version'] == ''

        # raw crash should be unchanged
        assert raw_crash == {}
    def test_process_crash_existing_processed_crash(self):
        raw_crash = DotDict({"uuid": "1"})
        raw_dumps = {}
        processed_crash = DotDict({
            "processor_notes": "we've been here before; yep",
            "started_datetime": "2014-01-01T00:00:00",
        })

        p = ProcessorPipeline(self.get_config(),
                              rules=[CPUInfoRule(),
                                     OSInfoRule()])
        with mock.patch("socorro.processor.processor_pipeline.utc_now"
                        ) as faked_utcnow:
            faked_utcnow.return_value = "2015-01-01T00:00:00"
            processed_crash = p.process_crash(raw_crash, raw_dumps,
                                              processed_crash)

        assert processed_crash.success
        assert processed_crash.started_datetime == "2015-01-01T00:00:00"
        assert processed_crash.startedDateTime == "2015-01-01T00:00:00"
        assert processed_crash.completed_datetime == "2015-01-01T00:00:00"
        assert processed_crash.completeddatetime == "2015-01-01T00:00:00"
        expected = (
            "dwight; ProcessorPipeline; earlier processing: 2014-01-01T00:00:00;"
            " we've been here before; yep")
        assert processed_crash.processor_notes == expected
Esempio n. 3
0
    def test_process_crash_existing_processed_crash(self):
        raw_crash = DotDict({'uuid': '1'})
        raw_dumps = {}
        processed_crash = DotDict({
            'processor_notes': 'we\'ve been here before; yep',
            'started_datetime': '2014-01-01T00:00:00'
        })

        p = ProcessorPipeline(self.get_config(),
                              rules=[
                                  CPUInfoRule(),
                                  OSInfoRule(),
                              ])
        with patch('socorro.processor.processor_pipeline.utc_now'
                   ) as faked_utcnow:
            faked_utcnow.return_value = '2015-01-01T00:00:00'
            processed_crash = p.process_crash(raw_crash, raw_dumps,
                                              processed_crash)

        assert processed_crash.success
        assert processed_crash.started_datetime == '2015-01-01T00:00:00'
        assert processed_crash.startedDateTime == '2015-01-01T00:00:00'
        assert processed_crash.completed_datetime == '2015-01-01T00:00:00'
        assert processed_crash.completeddatetime == '2015-01-01T00:00:00'
        expected = (
            "dwight; ProcessorPipeline; earlier processing: 2014-01-01T00:00:00;"
            " we've been here before; yep")
        assert processed_crash.processor_notes == expected
    def get_ruleset(self, config):
        """Generate rule set for Mozilla crash processing.

        :arg config: configman DotDict config instance

        :returns: pipeline of rules

        """
        return [
            # fix the raw crash removing null characters
            DeNullRule(),
            # rules to change the internals of the raw crash
            ProductRewrite(),
            ESRVersionRewrite(),
            PluginContentURL(),
            PluginUserComment(),
            # rules to transform a raw crash into a processed crash
            IdentifierRule(),
            MinidumpSha256Rule(),
            BreakpadStackwalkerRule2015(
                dump_field=config.breakpad.dump_field,
                symbols_urls=config.breakpad.symbols_urls,
                command_line=config.breakpad.command_line,
                command_pathname=config.breakpad.command_pathname,
                kill_timeout=config.breakpad.kill_timeout,
                symbol_tmp_path=config.breakpad.symbol_tmp_path,
                symbol_cache_path=config.breakpad.symbol_cache_path,
                tmp_storage_path=config.breakpad.tmp_storage_path),
            ProductRule(),
            UserDataRule(),
            EnvironmentRule(),
            PluginRule(),
            AddonsRule(),
            DatesAndTimesRule(),
            OutOfMemoryBinaryRule(),
            JavaProcessRule(),
            MozCrashReasonRule(),
            # post processing of the processed crash
            CrashingThreadRule(),
            CPUInfoRule(),
            OSInfoRule(),
            BetaVersionRule(
                version_string_api=config.betaversion.version_string_api),
            ExploitablityRule(),
            FlashVersionRule(),
            OSPrettyVersionRule(),
            TopMostFilesRule(),
            ThemePrettyNameRule(),
            MemoryReportExtraction(),
            # generate signature now that we've done all the processing it depends on
            SignatureGeneratorRule(),
            # a set of classifiers to help with jit crashes--must be last since it
            # depends on signature generation
            JitCrashCategorizeRule(
                dump_field=config.jit.dump_field,
                command_line=config.jit.command_line,
                command_pathname=config.jit.command_pathname,
                kill_timeout=config.jit.kill_timeout),
        ]
Esempio n. 5
0
    def test_everything_we_hoped_for(self):
        raw_crash = {}
        processed_crash = DotDict({
            'json_dump': {
                'system_info': {
                    'os': 'Windows NT',
                    'os_ver': '6.1.7601 Service Pack 1'
                }
            }
        })
        processor_meta = get_basic_processor_meta()

        rule = OSInfoRule()

        # the call to be tested
        rule.act(raw_crash, {}, processed_crash, processor_meta)

        assert processed_crash['os_name'] == "Windows NT"
        assert processed_crash['os_version'] == "6.1.7601 Service Pack 1"

        # raw crash should be unchanged
        assert raw_crash == {}
Esempio n. 6
0
    def test_everything_we_hoped_for(self):
        raw_crash = {}
        processed_crash = {
            "json_dump": {
                "system_info": {
                    "os": "Windows NT",
                    "os_ver": "6.1.7601 Service Pack 1",
                }
            }
        }
        processor_meta = get_basic_processor_meta()

        rule = OSInfoRule()

        # the call to be tested
        rule.act(raw_crash, {}, processed_crash, processor_meta)

        assert processed_crash["os_name"] == "Windows NT"
        assert processed_crash["os_version"] == "6.1.7601 Service Pack 1"

        # raw crash should be unchanged
        assert raw_crash == {}