Skip to content

Commit dd41484

Browse files
vanhauser-thcsmoelius
authored andcommitted
try maze 3 times for integration
1 parent c41944b commit dd41484

File tree

2 files changed

+44
-4
lines changed

2 files changed

+44
-4
lines changed

afl/src/lib.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,12 @@ macro_rules! ijon_bits {
154154
#[macro_export]
155155
macro_rules! ijon_strdist {
156156
($x:expr, $y:expr) => {
157-
unsafe { afl::ijon_set(afl::ijon_hashint(afl::ijon_hashstack(), afl::ijon_strdist($x, $y))) }
157+
unsafe {
158+
afl::ijon_set(afl::ijon_hashint(
159+
afl::ijon_hashstack(),
160+
afl::ijon_strdist($x, $y),
161+
))
162+
}
158163
};
159164
}
160165

@@ -173,7 +178,12 @@ macro_rules! ijon_dist {
173178
#[macro_export]
174179
macro_rules! ijon_cmp {
175180
($x:expr, $y:expr) => {
176-
unsafe { afl::ijon_inc(afl::ijon_hashint(afl::ijon_hashstack(), ($x ^ $y).count_ones())) }
181+
unsafe {
182+
afl::ijon_inc(afl::ijon_hashint(
183+
afl::ijon_hashstack(),
184+
($x ^ $y).count_ones(),
185+
))
186+
}
177187
};
178188
}
179189

cargo-afl/tests/integration.rs

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,37 @@ fn integration_maze() {
7171
return;
7272
}
7373

74-
fuzz_example("maze", true);
74+
let mut fail = 0;
75+
let temp_dir = tempfile::TempDir::new().expect("Could not create temporary directory");
76+
let temp_dir_path = temp_dir.path();
77+
78+
for i in 0..3 {
79+
let _: ExitStatus = process::Command::new(cargo_afl_path())
80+
.arg("afl")
81+
.arg("fuzz")
82+
.arg("-i")
83+
.arg(input_path())
84+
.arg("-o")
85+
.arg(temp_dir_path)
86+
.args(["-V", "15"]) // 15 seconds
87+
.arg(examples_path("maze"))
88+
.env("AFL_BENCH_UNTIL_CRASH", "1")
89+
.env("AFL_NO_CRASH_README", "1")
90+
.env("AFL_NO_UI", "1")
91+
.stdout(process::Stdio::inherit())
92+
.stderr(process::Stdio::inherit())
93+
.status()
94+
.expect("Could not run cargo afl fuzz");
95+
assert!(temp_dir_path.join("default").join("fuzzer_stats").is_file());
96+
let crashes = std::fs::read_dir(temp_dir_path.join("default").join("crashes"))
97+
.unwrap()
98+
.count();
99+
if (crashes >= 1) {
100+
return;
101+
}
102+
}
103+
104+
assert!(false);
75105
}
76106

77107
fn fuzz_example(name: &str, should_crash: bool) {
@@ -84,7 +114,7 @@ fn fuzz_example(name: &str, should_crash: bool) {
84114
.arg(input_path())
85115
.arg("-o")
86116
.arg(temp_dir_path)
87-
.args(["-V", "10"]) // 5 seconds
117+
.args(["-V", "5"]) // 5 seconds
88118
.arg(examples_path(name))
89119
.env("AFL_BENCH_UNTIL_CRASH", "1")
90120
.env("AFL_NO_CRASH_README", "1")

0 commit comments

Comments
 (0)