Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate run-make/llvm-ident to rmake.rs #126941

Merged
merged 2 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/tools/run-make-support/src/llvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,13 @@ impl LlvmFilecheck {
self.cmd.arg(path.as_ref());
self
}

/// `--input-file` option.
pub fn input_file<P: AsRef<Path>>(&mut self, input_file: P) -> &mut Self {
self.cmd.arg("--input-file");
self.cmd.arg(input_file.as_ref());
self
}
}

impl LlvmObjdump {
Expand Down
1 change: 0 additions & 1 deletion src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ run-make/link-cfg/Makefile
run-make/link-framework/Makefile
run-make/link-path-order/Makefile
run-make/linkage-attr-on-static/Makefile
run-make/llvm-ident/Makefile
run-make/long-linker-command-lines-cmd-exe/Makefile
run-make/long-linker-command-lines/Makefile
run-make/longjmp-across-rust/Makefile
Expand Down
19 changes: 0 additions & 19 deletions tests/run-make/llvm-ident/Makefile

This file was deleted.

41 changes: 41 additions & 0 deletions tests/run-make/llvm-ident/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//@ only-linux
//@ 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 std::ffi::OsStr;

fn main() {
// `-Ccodegen-units=16 -Copt-level=2` is used here to trigger thin LTO
// across codegen units to test deduplication of the named metadata
// (see `LLVMRustPrepareThinLTOImport` for details).
rustc()
.emit("link,obj")
.arg("-")
.arg("-Csave-temps")
.codegen_units(16)
.opt_level("2")
.target(&env_var("TARGET"))
.stdin("fn main(){}")
.run();

// `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();

// 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");
Kobzol marked this conversation as resolved.
Show resolved Hide resolved
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();
}
});
}
Loading