Skip to content

Commit

Permalink
Rollup merge of #126310 - GuillaumeGomez:migrate-run-make-prefer-rlib…
Browse files Browse the repository at this point in the history
…, r=Kobzol

Migrate run make prefer rlib

Part of #121876.

r? `@jieyouxu`
  • Loading branch information
workingjubilee authored Jun 12, 2024
2 parents 3862f01 + 45a9bd5 commit 6f4f405
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
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 @@ -175,7 +175,6 @@ run-make/pgo-gen/Makefile
run-make/pgo-indirect-call-promotion/Makefile
run-make/pgo-use/Makefile
run-make/pointer-auth-link-with-c/Makefile
run-make/prefer-rlib/Makefile
run-make/pretty-print-to-file/Makefile
run-make/pretty-print-with-dep-file/Makefile
run-make/print-calling-conventions/Makefile
Expand Down
6 changes: 2 additions & 4 deletions tests/run-make/prefer-dylib/rmake.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
//@ ignore-cross-compile

use run_make_support::{cwd, dynamic_lib_name, read_dir, run, run_fail, rustc};
use std::fs::remove_file;
use std::process::Command;
use run_make_support::{cwd, dynamic_lib_name, fs_wrapper, read_dir, run, run_fail, rustc};

fn main() {
rustc().input("bar.rs").crate_type("dylib").crate_type("rlib").arg("-Cprefer-dynamic").run();
rustc().input("foo.rs").arg("-Cprefer-dynamic").run();

run("foo");

remove_file(dynamic_lib_name("bar")).unwrap();
fs_wrapper::remove_file(dynamic_lib_name("bar"));
// This time the command should fail.
run_fail("foo");
}
9 changes: 0 additions & 9 deletions tests/run-make/prefer-rlib/Makefile

This file was deleted.

15 changes: 15 additions & 0 deletions tests/run-make/prefer-rlib/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Check that `foo.rs` prefers to link to `bar` statically, and can be executed even if the `bar`
// library artifacts are removed.

//@ ignore-cross-compile

use run_make_support::{dynamic_lib_name, fs_wrapper, path, run, rust_lib_name, rustc};

fn main() {
rustc().input("bar.rs").crate_type("dylib").crate_type("rlib").run();
assert!(path(rust_lib_name("bar")).exists());
rustc().input("foo.rs").run();
fs_wrapper::remove_file(rust_lib_name("bar"));
fs_wrapper::remove_file(dynamic_lib_name("bar"));
run("foo");
}

0 comments on commit 6f4f405

Please sign in to comment.