Example #1
0
    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 == {}
Example #2
0
    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
Example #3
0
    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