diff options
| author | Jubilee <46493976+workingjubilee@users.noreply.github.com> | 2024-06-12 03:57:25 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-12 03:57:25 -0700 |
| commit | 6f4f405c396159a33bf98f2e7ccf638d49542e9d (patch) | |
| tree | fa4879d4903064ab9575a48c1d83ee57c5612939 | |
| parent | 3862f01655093637ee965e9c893eb14eeaecd739 (diff) | |
| parent | 45a9bd5d40d1674af33287088dbc24bd092541ac (diff) | |
| download | rust-6f4f405c396159a33bf98f2e7ccf638d49542e9d.tar.gz rust-6f4f405c396159a33bf98f2e7ccf638d49542e9d.zip | |
Rollup merge of #126310 - GuillaumeGomez:migrate-run-make-prefer-rlib, r=Kobzol
Migrate run make prefer rlib Part of https://github.com/rust-lang/rust/issues/121876. r? `@jieyouxu`
| -rw-r--r-- | src/tools/tidy/src/allowed_run_make_makefiles.txt | 1 | ||||
| -rw-r--r-- | tests/run-make/prefer-dylib/rmake.rs | 6 | ||||
| -rw-r--r-- | tests/run-make/prefer-rlib/Makefile | 9 | ||||
| -rw-r--r-- | tests/run-make/prefer-rlib/rmake.rs | 15 |
4 files changed, 17 insertions, 14 deletions
diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt index 448d4887d32..ac89a30f353 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -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 diff --git a/tests/run-make/prefer-dylib/rmake.rs b/tests/run-make/prefer-dylib/rmake.rs index ad9fd8a15a2..6b3b3ad6d3b 100644 --- a/tests/run-make/prefer-dylib/rmake.rs +++ b/tests/run-make/prefer-dylib/rmake.rs @@ -1,8 +1,6 @@ //@ 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(); @@ -10,7 +8,7 @@ fn main() { 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"); } diff --git a/tests/run-make/prefer-rlib/Makefile b/tests/run-make/prefer-rlib/Makefile deleted file mode 100644 index 2e86b9c1dd7..00000000000 --- a/tests/run-make/prefer-rlib/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# ignore-cross-compile -include ../tools.mk - -all: - $(RUSTC) bar.rs --crate-type=dylib --crate-type=rlib - ls $(TMPDIR)/$(call RLIB_GLOB,bar) - $(RUSTC) foo.rs - rm $(TMPDIR)/*bar* - $(call RUN,foo) diff --git a/tests/run-make/prefer-rlib/rmake.rs b/tests/run-make/prefer-rlib/rmake.rs new file mode 100644 index 00000000000..96861a264e6 --- /dev/null +++ b/tests/run-make/prefer-rlib/rmake.rs @@ -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"); +} |
