Skip to content

Commit

Permalink
Improve code of run-make/llvm-ident
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Jul 2, 2024
1 parent 8f91020 commit 2e5959f
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions tests/run-make/llvm-ident/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
//@ ignore-cross-compile

use run_make_support::llvm::llvm_bin_dir;
use run_make_support::{cmd, env_var, llvm_filecheck, read_dir, rustc, source_root};
use run_make_support::{
cmd, env_var, get_files_with_extension, llvm_filecheck, rustc, source_root,
};

use std::ffi::OsStr;

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

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

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

0 comments on commit 2e5959f

Please sign in to comment.