Make spectest fuzzing more deterministic
Currently spectest fuzzing indexes into a compile-time-created array of strings which is the list of input files, but the order of this array is dependent on the filesystem that we're reading from. This means that inputs from oss-fuzz may not be easily reproducible locally because files could be read in different orders, so indexes could be distinct. This commit instead reads the directory paths, then sorts them, then includes them for testing. That way fuzz inputs at a specific commit should be consistent.
This commit is contained in:
@@ -13,9 +13,12 @@ fn main() {
|
|||||||
.unwrap()
|
.unwrap()
|
||||||
.join("../../tests/spec_testsuite");
|
.join("../../tests/spec_testsuite");
|
||||||
let mut code = format!("static FILES: &[(&str, &str)] = &[\n");
|
let mut code = format!("static FILES: &[(&str, &str)] = &[\n");
|
||||||
for entry in dir.read_dir().unwrap() {
|
let entries = dir
|
||||||
let entry = entry.unwrap();
|
.read_dir()
|
||||||
let path = entry.path().display().to_string();
|
.unwrap()
|
||||||
|
.map(|p| p.unwrap().path().display().to_string())
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
for path in entries {
|
||||||
if !path.ends_with(".wast") {
|
if !path.ends_with(".wast") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user