def test_missing_json_dump(self): raw_crash = {} raw_dumps = {} processed_crash = {} processor_meta = get_basic_processor_meta() rule = CPUInfoRule() # the call to be tested rule.act(raw_crash, raw_dumps, processed_crash, processor_meta) assert processed_crash['cpu_info'] == '' assert processed_crash['cpu_name'] == '' # 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
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), ]
def test_everything_we_hoped_for(self): raw_crash = copy.copy(canonical_standard_raw_crash) raw_dumps = {} processed_crash = copy.copy(canonical_processed_crash) processor_meta = get_basic_processor_meta() rule = CPUInfoRule() # the call to be tested rule.act(raw_crash, raw_dumps, processed_crash, processor_meta) assert processed_crash.cpu_name == 'x86' assert processed_crash.cpu_info == 'GenuineIntel family 6 model 42 stepping 7' assert processed_crash.cpu_count == 4 # raw crash should be unchanged assert raw_crash == canonical_standard_raw_crash
def test_missing_cpu_count(self): raw_crash = copy.copy(canonical_standard_raw_crash) raw_dumps = {} system_info = copy.copy(canonical_processed_crash["json_dump"]["system_info"]) del system_info["cpu_count"] processed_crash = DotDict() processed_crash.json_dump = {"system_info": system_info} processor_meta = get_basic_processor_meta() rule = CPUInfoRule() # the call to be tested rule.act(raw_crash, raw_dumps, processed_crash, processor_meta) assert processed_crash.cpu_info == "GenuineIntel family 6 model 42 stepping 7" assert processed_crash.cpu_name == "x86" # raw crash should be unchanged assert raw_crash == canonical_standard_raw_crash