def test_wrong_signature(self, mocked_subprocess_module): config = self.get_basic_config() raw_crash = copy.copy(canonical_standard_raw_crash) raw_dumps = {config.dump_field: 'a_fake_dump.dump'} processed_crash = DotDict() processed_crash.product = 'Firefox' processed_crash.os_name = 'Windows NT' processed_crash.cpu_name = 'x86' processed_crash.signature = 'this-is-not-a-JIT-signature' processed_crash['json_dump.crashing_thread.frames'] = [ DotDict({'not_module': 'not-a-module',}), DotDict({'module': 'a-module',}) ] processor_meta = self.get_basic_processor_meta() mocked_subprocess_handle = ( mocked_subprocess_module.Popen.return_value ) mocked_subprocess_handle.stdout.read.return_value = ( 'EXTRA-SPECIAL' ) mocked_subprocess_handle.wait.return_value = 0 rule = JitCrashCategorizeRule(config) # the call to be tested rule.act(raw_crash, raw_dumps, processed_crash, processor_meta) ok_('classifications.jit.category' not in processed_crash) ok_('classifications.jit.category_return_code' not in processed_crash)
def test_module_on_stack_top(self, mocked_subprocess_module): config = self.get_basic_config() raw_crash = copy.copy(canonical_standard_raw_crash) raw_dumps = {config.dump_field: 'a_fake_dump.dump'} processed_crash = DotDict() processed_crash.product = 'Firefox' processed_crash.os_name = 'Windows NT' processed_crash.cpu_name = 'x86' processed_crash.signature = 'EnterBaseline' processed_crash['json_dump.crashing_thread.frames'] = [ DotDict({'module': 'a-module'}), DotDict({'not_module': 'not-a-module'}), ] processor_meta = self.get_basic_processor_meta() mocked_subprocess_handle = ( mocked_subprocess_module.Popen.return_value) mocked_subprocess_handle.stdout.read.return_value = ('EXTRA-SPECIAL') mocked_subprocess_handle.wait.return_value = 0 rule = JitCrashCategorizeRule(config) # the call to be tested rule.act(raw_crash, raw_dumps, processed_crash, processor_meta) assert 'classifications.jit.category' not in processed_crash assert 'classifications.jit.category_return_code' not in processed_crash
def test_subprocess_fail(self, mocked_subprocess_module): config = self.get_basic_config() raw_crash = copy.copy(canonical_standard_raw_crash) raw_dumps = {config.dump_field: 'a_fake_dump.dump'} processed_crash = CDotDict() processed_crash.product = 'Firefox' processed_crash.os_name = 'Windows 386' processed_crash.cpu_name = 'x86' processed_crash.signature = 'EnterBaseline' processed_crash['json_dump.crashing_thread.frames'] = [ DotDict({'not_module': 'not-a-module',}), DotDict({'module': 'a-module',}) ] processor_meta = self.get_basic_processor_meta() mocked_subprocess_handle = ( mocked_subprocess_module.Popen.return_value ) mocked_subprocess_handle.stdout.read.return_value = ( None ) mocked_subprocess_handle.wait.return_value = -1 rule = JitCrashCategorizeRule(config) # the call to be tested rule.act(raw_crash, raw_dumps, processed_crash, processor_meta) eq_(processor_meta.processor_notes, []) ok_(processed_crash.classifications.jit.category is None) eq_(processed_crash.classifications.jit.category_return_code, -1)
def test_subprocess_fail(self, mocked_subprocess_module): config = self.get_basic_config() raw_crash = copy.copy(canonical_standard_raw_crash) raw_dumps = {config.dump_field: 'a_fake_dump.dump'} processed_crash = DotDict() processed_crash.product = 'Firefox' processed_crash.os_name = 'Windows 386' processed_crash.cpu_name = 'x86' processed_crash.signature = 'EnterBaseline' processed_crash['json_dump.crashing_thread.frames'] = [ DotDict({'not_module': 'not-a-module'}), DotDict({'module': 'a-module'}) ] processor_meta = get_basic_processor_meta() mocked_subprocess_handle = mocked_subprocess_module.Popen.return_value mocked_subprocess_handle.stdout.read.return_value = None mocked_subprocess_handle.wait.return_value = -1 rule = JitCrashCategorizeRule(config) rule.act(raw_crash, raw_dumps, processed_crash, processor_meta) assert processor_meta.processor_notes == [] assert processed_crash.classifications.jit.category is None assert processed_crash.classifications.jit.category_return_code == -1
def test_everything_we_hoped_for(self, mocked_subprocess_module): config = self.get_basic_config() raw_crash = copy.copy(canonical_standard_raw_crash) raw_dumps = {config.dump_field: 'a_fake_dump.dump'} processed_crash = DotDict() processed_crash.product = 'Firefox' processed_crash.os_name = 'Windows 386' processed_crash.cpu_name = 'x86' processed_crash.signature = 'EnterBaseline' processed_crash['json_dump.crashing_thread.frames'] = [ DotDict({'not_module': 'not-a-module'}), DotDict({'module': 'a-module'}) ] processor_meta = get_basic_processor_meta() mocked_subprocess_handle = mocked_subprocess_module.Popen.return_value mocked_subprocess_handle.stdout.read.return_value = 'EXTRA-SPECIAL' mocked_subprocess_handle.wait.return_value = 0 rule = JitCrashCategorizeRule(config) rule.act(raw_crash, raw_dumps, processed_crash, processor_meta) assert processor_meta.processor_notes == [] assert processed_crash.classifications.jit.category == 'EXTRA-SPECIAL' assert processed_crash.classifications.jit.category_return_code == 0
def test_everything_we_hoped_for_2(self, mocked_subprocess_module): config = self.get_basic_config() raw_crash = copy.copy(canonical_standard_raw_crash) raw_dumps = {config.dump_field: 'a_fake_dump.dump'} processed_crash = CDotDict() processed_crash.product = 'Firefox' processed_crash.os_name = 'Windows 386' processed_crash.cpu_name = 'x86' processed_crash.signature = 'EnterIon' processed_crash['json_dump.crashing_thread.frames'] = [ DotDict({ 'not_module': 'not-a-module', }), DotDict({ 'module': 'a-module', }) ] processor_meta = self.get_basic_processor_meta() mocked_subprocess_handle = ( mocked_subprocess_module.Popen.return_value) mocked_subprocess_handle.stdout.read.return_value = ('EXTRA-SPECIAL') mocked_subprocess_handle.wait.return_value = 0 rule = JitCrashCategorizeRule(config) # the call to be tested rule.act(raw_crash, raw_dumps, processed_crash, processor_meta) eq_(processor_meta.processor_notes, []) eq_(processed_crash.classifications.jit.category, 'EXTRA-SPECIAL') eq_(processed_crash.classifications.jit.category_return_code, 0)
def test_success_all_types_of_signatures(self, mocked_subprocess_module): config = self.get_basic_config() raw_crash = copy.copy(canonical_standard_raw_crash) raw_dumps = {config.dump_field: 'a_fake_dump.dump'} base_processed_crash = CDotDict() base_processed_crash.product = 'Firefox' base_processed_crash.os_name = 'Windows 386' base_processed_crash.cpu_name = 'x86' base_processed_crash['json_dump.crashing_thread.frames'] = [ DotDict({'not_module': 'not-a-module'}), DotDict({'module': 'a-module'}) ] processor_meta = self.get_basic_processor_meta() mocked_subprocess_handle = ( mocked_subprocess_module.Popen.return_value ) mocked_subprocess_handle.stdout.read.return_value = ( 'EXTRA-SPECIAL' ) mocked_subprocess_handle.wait.return_value = 0 rule = JitCrashCategorizeRule(config) signatures = [ 'EnterBaseline', 'moz::something | EnterBaseline', 'EnterIon', 'js::jit::FastInvoke', 'Foo::Bar__js::jit::IonCannon', 'Small | js::irregexp::ExecuteCode<T>', ] for signature in signatures: processed_crash = CDotDict(base_processed_crash) processed_crash.signature = signature # the call to be tested rule.act(raw_crash, raw_dumps, processed_crash, processor_meta) eq_(processor_meta.processor_notes, []) eq_(processed_crash.classifications.jit.category, 'EXTRA-SPECIAL') eq_(processed_crash.classifications.jit.category_return_code, 0)
def test_success_all_types_of_signatures(self, mocked_subprocess_module): config = self.get_basic_config() raw_crash = copy.copy(canonical_standard_raw_crash) raw_dumps = {config.dump_field: 'a_fake_dump.dump'} base_processed_crash = CDotDict() base_processed_crash.product = 'Firefox' base_processed_crash.os_name = 'Windows 386' base_processed_crash.cpu_name = 'x86' base_processed_crash['json_dump.crashing_thread.frames'] = [ DotDict({'not_module': 'not-a-module'}), DotDict({'module': 'a-module'}) ] processor_meta = self.get_basic_processor_meta() mocked_subprocess_handle = ( mocked_subprocess_module.Popen.return_value ) mocked_subprocess_handle.stdout.read.return_value = ( 'EXTRA-SPECIAL' ) mocked_subprocess_handle.wait.return_value = 0 rule = JitCrashCategorizeRule(config) signatures = [ 'EnterBaseline', 'moz::something | EnterBaseline', 'EnterIon', 'js::jit::FastInvoke', 'Foo::Bar__js::jit::IonCannon', 'Small | js::irregexp::ExecuteCode<T>', ] for signature in signatures: processed_crash = CDotDict(base_processed_crash) processed_crash.signature = signature # the call to be tested rule.act(raw_crash, raw_dumps, processed_crash, processor_meta) eq_(processor_meta.processor_notes, []) eq_(processed_crash.classifications.jit.category, 'EXTRA-SPECIAL') eq_(processed_crash.classifications.jit.category_return_code, 0)