def test_symbolize_log_no_mutation_sequence(self): mock_device = MockDevice() base_dir = tempfile.mkdtemp() fuzzer = Fuzzer(mock_device, u'mock-package1', u'mock-target2', output=base_dir) os.mkdir(fuzzer.results()) with tempfile.TemporaryFile() as tmp_out: with tempfile.TemporaryFile() as tmp_in: tmp_in.write(""" A line Another line Yet another line """) tmp_in.flush() tmp_in.seek(0) fuzzer.symbolize_log(tmp_in, tmp_out) tmp_out.flush() tmp_out.seek(0) self.assertEqual(tmp_out.read(), """ A line Another line Yet another line """)
def test_symbolize_log_pid_from_deadly_signal(self): mock_device = MockDevice() base_dir = tempfile.mkdtemp() fuzzer = Fuzzer( mock_device, u'mock-package1', u'mock-target2', output=base_dir) os.mkdir(fuzzer.results()) with tempfile.TemporaryFile() as tmp_out: with tempfile.TemporaryFile() as tmp_in: tmp_in.write( """ A line Another line ==67890== ERROR: libFuzzer: deadly signal MS: 1 SomeMutation; base unit: foo Yet another line artifact_prefix='data/'; Test unit written to data/crash-cccc """) tmp_in.flush() tmp_in.seek(0) fuzzer.symbolize_log(tmp_in, tmp_out) tmp_out.flush() tmp_out.seek(0) self.assertIn( ' '.join( mock_device.get_ssh_cmd( [ 'scp', '[::1]:' + fuzzer.data_path('crash-cccc'), fuzzer.results() ])), mock_device.host.history) self.assertEqual( tmp_out.read(), """ A line Another line ==67890== ERROR: libFuzzer: deadly signal Symbolized line 1 Symbolized line 2 Symbolized line 3 MS: 1 SomeMutation; base unit: foo Yet another line artifact_prefix='data/'; Test unit written to data/crash-cccc """)