Skip to content

Commit 295eea4

Browse files
committed
fix: fuzz targets missing target dir and silent CI failures
1 parent a340afb commit 295eea4

6 files changed

Lines changed: 8 additions & 4 deletions

File tree

.github/workflows/fuzzing.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
fuzz/corpus/${{ matrix.test-target.name }}
6969
- name: Run ${{ matrix.test-target.name }} for XX seconds
7070
shell: bash
71-
continue-on-error: ${{ !matrix.test-target.name.should_pass }}
71+
continue-on-error: ${{ !matrix.test-target.should_pass }}
7272
run: |
7373
cargo fuzz run ${{ matrix.test-target.name }} -- -max_total_time=${{ env.RUN_FOR }} -detect_leaks=0
7474
- name: Save Corpus Cache

fuzz/fuzz_targets/fuzz_cmp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ extern crate libfuzzer_sys;
44
use diffutilslib::cmp::{self, Cmp};
55

66
use std::ffi::OsString;
7-
use std::fs::File;
7+
use std::fs::{self, File};
88
use std::io::Write;
99

1010
fn os(s: &str) -> OsString {
@@ -18,7 +18,7 @@ fuzz_target!(|x: (Vec<u8>, Vec<u8>)| {
1818
.peekable();
1919

2020
let (from, to) = x;
21-
21+
fs::create_dir_all("target").unwrap();
2222
File::create("target/fuzz.cmp.a")
2323
.unwrap()
2424
.write_all(&from)

fuzz/fuzz_targets/fuzz_ed.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ fuzz_target!(|x: (Vec<u8>, Vec<u8>)| {
3838
} else {
3939
return;
4040
}
41+
fs::create_dir_all("target").unwrap();
4142
let diff = diff_w(&from, &to, "target/fuzz.file").unwrap();
4243
File::create("target/fuzz.file.original")
4344
.unwrap()

fuzz/fuzz_targets/fuzz_normal.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ fuzz_target!(|x: (Vec<u8>, Vec<u8>)| {
2323
return
2424
}*/
2525
let diff = normal_diff::diff(&from, &to, &Params::default());
26+
fs::create_dir_all("target").unwrap();
2627
File::create("target/fuzz.file.original")
2728
.unwrap()
2829
.write_all(&from)

fuzz/fuzz_targets/fuzz_patch.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ fuzz_target!(|x: (Vec<u8>, Vec<u8>, u8)| {
2121
} else {
2222
return
2323
}*/
24+
fs::create_dir_all("target").unwrap();
2425
let diff = unified_diff::diff(
2526
&from,
2627
&to,

fuzz/fuzz_targets/fuzz_side.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ extern crate libfuzzer_sys;
44

55
use diffutilslib::side_diff;
66

7-
use std::fs::File;
7+
use std::fs::{self, File};
88
use std::io::Write;
99
use diffutilslib::params::Params;
1010

@@ -21,6 +21,7 @@ fuzz_target!(|x: (Vec<u8>, Vec<u8>, /* usize, usize */ bool)| {
2121
expand_tabs: expand,
2222
..Default::default()
2323
};
24+
fs::create_dir_all("target").unwrap();
2425
let mut output_buf = vec![];
2526
side_diff::diff(&original, &new, &mut output_buf, &params);
2627
File::create("target/fuzz.file.original")

0 commit comments

Comments
 (0)