Skip to content

Commit 2e5959f

Browse files
Improve code of run-make/llvm-ident
1 parent 8f91020 commit 2e5959f

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

tests/run-make/llvm-ident/rmake.rs

+7-13
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
//@ ignore-cross-compile
33

44
use run_make_support::llvm::llvm_bin_dir;
5-
use run_make_support::{cmd, env_var, llvm_filecheck, read_dir, rustc, source_root};
5+
use run_make_support::{
6+
cmd, env_var, get_files_with_extension, llvm_filecheck, rustc, source_root,
7+
};
68

79
use std::ffi::OsStr;
810

@@ -22,20 +24,12 @@ fn main() {
2224

2325
// `llvm-dis` is used here since `--emit=llvm-ir` does not emit LLVM IR
2426
// for temporary outputs.
25-
let mut files = Vec::new();
26-
read_dir(".", |path| {
27-
if path.is_file() && path.extension().is_some_and(|ext| ext == OsStr::new("bc")) {
28-
files.push(path.to_path_buf());
29-
}
30-
});
31-
cmd(llvm_bin_dir().join("llvm-dis")).args(&files).run();
27+
cmd(llvm_bin_dir().join("llvm-dis")).args(get_files_with_extension(".", "bc")).run();
3228

3329
// Check LLVM IR files (including temporary outputs) have `!llvm.ident`
3430
// named metadata, reusing the related codegen test.
3531
let llvm_ident_path = source_root().join("tests/codegen/llvm-ident.rs");
36-
read_dir(".", |path| {
37-
if path.is_file() && path.extension().is_some_and(|ext| ext == OsStr::new("ll")) {
38-
llvm_filecheck().input_file(path).arg(&llvm_ident_path).run();
39-
}
40-
});
32+
for file in get_files_with_extension(".", "ll") {
33+
llvm_filecheck().input_file(file).arg(&llvm_ident_path).run();
34+
}
4135
}

0 commit comments

Comments
 (0)