Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit e8e6ffc

Browse files
committed
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 76f84e6)
1 parent 5603a53 commit e8e6ffc

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

crates/libm-test/build.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ mod musl_reference_tests {
6363
let files = fs::read_dir(math_src)
6464
.unwrap()
6565
.map(|f| f.unwrap().path())
66+
.filter(file_needs_test)
6667
.collect::<Vec<_>>();
6768

6869
let mut math = Vec::new();
@@ -94,6 +95,19 @@ mod musl_reference_tests {
9495
generate_unit_tests(&math);
9596
}
9697

98+
/// Check whether a path within `src/math` should get tests generated.
99+
fn file_needs_test(path: &PathBuf) -> bool {
100+
// Skip directories
101+
if path.is_dir() {
102+
return false;
103+
}
104+
105+
let fname = path.file_name().unwrap().to_str().unwrap();
106+
107+
// Musl doesn't support `f16` or `f128`
108+
!(fname.contains("f16") || fname.contains("f128"))
109+
}
110+
97111
/// A "poor man's" parser for the signature of a function
98112
fn parse(s: &str) -> Function {
99113
let s = eat(s, "pub fn ");

0 commit comments

Comments
 (0)