Skip to content

Commit

Permalink
Rollup merge of #126211 - lolbinarycat:llvm-outputs-rmake, r=jieyouxu
Browse files Browse the repository at this point in the history
migrate tests/run-make/llvm-outputs to use rmake.rs

part of #121876

<!--
If this PR is related to an unstable feature or an otherwise tracked effort,
please link to the relevant tracking issue here. If you don't know of a related
tracking issue or there are none, feel free to ignore this.

This PR will get automatically assigned to a reviewer. In case you would like
a specific user to review your work, you can assign it to them by using

    r​? <reviewer name>
-->
  • Loading branch information
matthiaskrgr authored Jun 10, 2024
2 parents 146f4b3 + 91f5530 commit 61eb29e
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 6 deletions.
7 changes: 7 additions & 0 deletions src/tools/run-make-support/src/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ impl Rustc {
self
}

/// Specify path to the output directory. Equivalent to `--out-dir`` in rustc.
pub fn out_dir<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
self.cmd.arg("--out-dir");
self.cmd.arg(path.as_ref());
self
}

/// This flag defers LTO optimizations to the linker.
pub fn linker_plugin_lto(&mut self, option: &str) -> &mut Self {
self.cmd.arg(format!("-Clinker-plugin-lto={option}"));
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 @@ -122,7 +122,6 @@ 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/llvm-outputs/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
5 changes: 0 additions & 5 deletions tests/run-make/llvm-outputs/Makefile

This file was deleted.

20 changes: 20 additions & 0 deletions tests/run-make/llvm-outputs/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// test that directories get created when emitting llvm bitcode and IR

use run_make_support::{cwd, run_in_tmpdir, rustc};
use std::path::PathBuf;

fn main() {
let mut path_bc = PathBuf::new();
let mut path_ir = PathBuf::new();
run_in_tmpdir(|| {
let p = cwd();
path_bc = p.join("nonexistant_dir_bc");
path_ir = p.join("nonexistant_dir_ir");
rustc().input("-").stdin("fn main() {}").out_dir(&path_bc).emit("llvm-bc").run();
rustc().input("-").stdin("fn main() {}").out_dir(&path_ir).emit("llvm-ir").run();
assert!(path_bc.exists());
assert!(path_ir.exists());
});
assert!(!path_bc.exists());
assert!(!path_ir.exists());
}

0 comments on commit 61eb29e

Please sign in to comment.