def test_no_issue(self): """Test generating details without an issue ID.""" crash_type = 'Heap-buffer-overflow' crash_state = 'Foo\nBar\nBlah\n' details = oss_fuzz.get_oss_fuzz_details('', crash_type, crash_state) self.assertEqual( 'Crash type: Heap-buffer-overflow\n' 'Crash state:\n' 'Foo\n' 'Bar\n' 'Blah\n', details)
def test_assert(self): """Basic assertion failures.""" crash_type = 'ASSERT' crash_state = 'idx < length\nFoo\nBar\n' summary = oss_fuzz.get_oss_fuzz_summary(crash_type, crash_state) self.assertEqual('ASSERT: idx < length', summary) details = oss_fuzz.get_oss_fuzz_details('1337', crash_type, crash_state) self.assertEqual( 'OSS-Fuzz report: ' 'https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1337\n\n' 'Crash type: ASSERT\n' 'Crash state:\n' 'idx < length\n' 'Foo\n' 'Bar\n', details)
def test_bad_cast(self): """Basic bad casts.""" crash_type = 'Bad-cast' crash_state = 'Bad-cast to A from B\nFoo\nBar\n' summary = oss_fuzz.get_oss_fuzz_summary(crash_type, crash_state) self.assertEqual('Bad-cast to A from B', summary) details = oss_fuzz.get_oss_fuzz_details('1337', crash_type, crash_state) self.assertEqual( 'OSS-Fuzz report: ' 'https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1337\n\n' 'Crash type: Bad-cast\n' 'Crash state:\n' 'Bad-cast to A from B\n' 'Foo\n' 'Bar\n', details)
def test_basic(self): """Basic tests.""" crash_type = 'Heap-buffer-overflow' crash_state = 'Foo\nBar\nBlah\n' summary = oss_fuzz.get_oss_fuzz_summary(crash_type, crash_state) self.assertEqual('Heap-buffer-overflow in Foo', summary) details = oss_fuzz.get_oss_fuzz_details('1337', crash_type, crash_state) self.assertEqual( 'OSS-Fuzz report: ' 'https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1337\n\n' 'Crash type: Heap-buffer-overflow\n' 'Crash state:\n' 'Foo\n' 'Bar\n' 'Blah\n', details)