-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
use internal::dirs::output_directory_from_target; | ||
use predicates::prelude::*; | ||
use std::{ffi::OsStr, fs::remove_dir_all}; | ||
use testing::{examples, retry, CommandExt}; | ||
|
||
const CPUS: &str = "2"; | ||
const TIME_SLICE: &str = "30"; | ||
|
||
#[test] | ||
fn fuzz_parallel() { | ||
for i in 0..6 { | ||
let output_dir = output_directory_from_target("parallel", &format!("target_{i}")); | ||
remove_dir_all(output_dir).unwrap_or_default(); | ||
} | ||
|
||
examples::test("parallel", "test") | ||
.unwrap() | ||
.logged_assert() | ||
.success(); | ||
|
||
retry(3, || { | ||
examples::test_fuzz_inexact("parallel", "target") | ||
.unwrap() | ||
.args([ | ||
"--exit-code", | ||
"--run-until-crash", | ||
"--cpus", | ||
CPUS, | ||
"--slice", | ||
TIME_SLICE, | ||
]) | ||
.logged_assert() | ||
.try_code(predicate::eq(1)) | ||
}) | ||
.unwrap(); | ||
|
||
// smoelius: Verify that all `.cur_input` files were removed. | ||
for i in 0..6 { | ||
let output_dir = output_directory_from_target("parallel", &format!("target_{i}")); | ||
if output_dir.exists() { | ||
assert!(!walkdir::WalkDir::new(output_dir) | ||
.into_iter() | ||
.any(|entry| entry.unwrap().path().file_name() == Some(OsStr::new(".cur_input")))); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#[test_fuzz::test_fuzz] | ||
fn target_0(x: bool) {} | ||
|
||
#[test_fuzz::test_fuzz] | ||
fn target_1(x: bool) {} | ||
|
||
#[test_fuzz::test_fuzz] | ||
fn target_2(x: bool) {} | ||
|
||
#[test_fuzz::test_fuzz] | ||
fn target_3(x: bool) { | ||
assert!(!x); | ||
} | ||
|
||
#[test_fuzz::test_fuzz] | ||
fn target_4(x: bool) {} | ||
|
||
#[test_fuzz::test_fuzz] | ||
fn target_5(x: bool) {} | ||
|
||
#[test] | ||
fn test() { | ||
target_0(false); | ||
target_1(false); | ||
target_2(false); | ||
target_3(false); | ||
target_4(false); | ||
target_5(false); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters