Skip to content

Commit

Permalink
runtime-fuzzer(tests): Add test cases which could cause previously fi…
Browse files Browse the repository at this point in the history
…xed panics (#3880)
  • Loading branch information
techraed authored Apr 18, 2024
1 parent 7958bb6 commit e1fb708
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 2 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
46 changes: 44 additions & 2 deletions utils/runtime-fuzzer/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ fn proptest_input_validity() {
assert!(MIN_GEAR_CALLS_BYTES <= MAX_GEAR_CALLS_BYTES);
}

#[test]
fn test_corpus_aa91f1d5873e3fa7045ceeef9e26448e71f82482() {
gear_utils::init_default_logger();

let input = include_bytes!("../fuzz_corpus/aa91f1d5873e3fa7045ceeef9e26448e71f82482");
assert!(run_impl(FuzzerInput::new(input)).is_ok());
}

// This is a crashing input before c85f4563ce35d822958a23a92d85f798252c8466 commit to master.
#[test]
fn test_corpus_c6e2a597aebabecc9bbb11eefdaa4dd8a6770188() {
Expand All @@ -40,14 +48,48 @@ fn test_corpus_c6e2a597aebabecc9bbb11eefdaa4dd8a6770188() {
assert!(run_impl(FuzzerInput::new(input)).is_ok());
}

// This is a crashing input before https://github.com/gear-tech/gear/pull/3678 was merged to master.
// The 25b29b826 commit to master was adapted by removing fixes from #3678 to test the bug.
#[test]
fn test_corpus_aa91f1d5873e3fa7045ceeef9e26448e71f82482() {
fn test_corpus_3a8de0dbd12a8a5e6e77bf5a81f2c511816a0ec2() {
gear_utils::init_default_logger();

let input = include_bytes!("../fuzz_corpus/aa91f1d5873e3fa7045ceeef9e26448e71f82482");
let input = include_bytes!("../fuzz_corpus/3a8de0dbd12a8a5e6e77bf5a81f2c511816a0ec2");
assert!(run_impl(FuzzerInput::new(input)).is_ok());
}

// This is a crashing input before https://github.com/gear-tech/gear/pull/3152 was merged to master.
// The 25b29b826 commit to master was adapted by removing fixes from #3152 to test the bug.
#[test]
fn test_corpus_03d70a0b413038867c102a2b52f56b637ca6b277() {
gear_utils::init_default_logger();

let input = include_bytes!("../fuzz_corpus/03d70a0b413038867c102a2b52f56b637ca6b277");
assert!(run_impl(FuzzerInput::new(input)).is_ok());
}

// This is a crashing input before https://github.com/gear-tech/gear/pull/2745 was merged to master.
// The 25b29b826 commit to master was adapted by removing fixes from #2745 to test the bug.
#[test]
fn test_corpus_888e61e90b2d419b40d362af7036387364eef9bf() {
gear_utils::init_default_logger();

let input = include_bytes!("../fuzz_corpus/888e61e90b2d419b40d362af7036387364eef9bf");
assert!(run_impl(FuzzerInput::new(input)).is_ok());
}

// This is a crashing input before https://github.com/gear-tech/gear/pull/976 was merged to master.
// The 25b29b826 commit to master was adapted by removing fixes from #976 to test the bug.
#[test]
fn test_corpus_bfcd26c09ccc57e35aaabc0937b0711520bddf75() {
gear_utils::init_default_logger();

let input = include_bytes!("../fuzz_corpus/bfcd26c09ccc57e35aaabc0937b0711520bddf75");
assert!(run_impl(FuzzerInput::new(input)).is_ok());
}

// TODO #3900 implement test for the input b09f6282c0e906c06168e7fc22fb5417c3f6fafb-pr-3496-gas5k-delay10k.

proptest! {
#![proptest_config(ProptestConfig::with_cases(10))]
#[test]
Expand Down

0 comments on commit e1fb708

Please sign in to comment.