Update libm-test/build.rs to skip directories
Don't try to generate tests for directories, or for files that contain `f16` or `f128` (as these types are not provided by musl's math implementations). (cherry picked from commit fd7ad36b70d0bbc0f0b9bc7e54d10258423fda29)
This commit is contained in:
parent
395419d2d2
commit
ad1c652293
1 changed files with 18 additions and 1 deletions
|
|
@ -156,7 +156,11 @@ mod musl_serialized_tests {
|
|||
return;
|
||||
}
|
||||
|
||||
let files = fs::read_dir(math_src).unwrap().map(|f| f.unwrap().path()).collect::<Vec<_>>();
|
||||
let files = fs::read_dir(math_src)
|
||||
.unwrap()
|
||||
.map(|f| f.unwrap().path())
|
||||
.filter(file_needs_test)
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let mut math = Vec::new();
|
||||
for file in files {
|
||||
|
|
@ -187,6 +191,19 @@ mod musl_serialized_tests {
|
|||
generate_unit_tests(&math);
|
||||
}
|
||||
|
||||
/// Check whether a path within `src/math` should get tests generated.
|
||||
fn file_needs_test(path: &PathBuf) -> bool {
|
||||
// Skip directories
|
||||
if path.is_dir() {
|
||||
return false;
|
||||
}
|
||||
|
||||
let fname = path.file_name().unwrap().to_str().unwrap();
|
||||
|
||||
// Musl doesn't support `f16` or `f128`
|
||||
!(fname.contains("f16") || fname.contains("f128"))
|
||||
}
|
||||
|
||||
/// A "poor man's" parser for the signature of a function
|
||||
fn parse(s: &str) -> Function {
|
||||
let s = eat(s, "pub fn ");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue