Skip to content

Commit 221dd30

Browse files
Migrate run-make/llvm-ident to rmake.rs
1 parent f2ade37 commit 221dd30

File tree

3 files changed

+40
-20
lines changed

3 files changed

+40
-20
lines changed

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ run-make/link-cfg/Makefile
9292
run-make/link-framework/Makefile
9393
run-make/link-path-order/Makefile
9494
run-make/linkage-attr-on-static/Makefile
95-
run-make/llvm-ident/Makefile
9695
run-make/long-linker-command-lines-cmd-exe/Makefile
9796
run-make/long-linker-command-lines/Makefile
9897
run-make/longjmp-across-rust/Makefile

tests/run-make/llvm-ident/Makefile

-19
This file was deleted.

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

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
//@ only-linux
2+
3+
use run_make_support::llvm::llvm_bin_dir;
4+
use run_make_support::{cmd, env_var, llvm_filecheck, read_dir, rustc, source_root};
5+
6+
use std::ffi::OsStr;
7+
8+
fn main() {
9+
// `-Ccodegen-units=16 -Copt-level=2` is used here to trigger thin LTO
10+
// across codegen units to test deduplication of the named metadata
11+
// (see `LLVMRustPrepareThinLTOImport` for details).
12+
rustc()
13+
.emit("link,obj")
14+
.arg("-Csave-temps")
15+
.codegen_units(16)
16+
.opt_level("2")
17+
.target(&env_var("TARGET"))
18+
.arg("-")
19+
.stdin("fn main(){}")
20+
.run();
21+
22+
// `llvm-dis` is used here since `--emit=llvm-ir` does not emit LLVM IR
23+
// for temporary outputs.
24+
let mut files = Vec::new();
25+
read_dir(".", |path| {
26+
if path.is_file() && path.extension().is_some_and(|ext| ext == OsStr::new("bc")) {
27+
files.push(path.to_path_buf());
28+
}
29+
});
30+
cmd(llvm_bin_dir().join("llvm-dis")).args(&files).run();
31+
32+
// Check LLVM IR files (including temporary outputs) have `!llvm.ident`
33+
// named metadata, reusing the related codegen test.
34+
let llvm_ident_path = source_root().join("tests/codegen/llvm-ident.rs");
35+
read_dir(".", |path| {
36+
if path.is_file() && path.extension().is_some_and(|ext| ext == OsStr::new("ll")) {
37+
llvm_filecheck().input_file(path).arg(&llvm_ident_path).run();
38+
}
39+
});
40+
}

0 commit comments

Comments
 (0)