Rollup merge of #126174 - GuillaumeGomez:migrate-run-make-prefer-dylib, r=jieyouxu

Migrate `tests/run-make/prefer-dylib` to `rmake.rs`

Part of https://github.com/rust-lang/rust/issues/121876.

r? ```@jieyouxu```
This commit is contained in:
许杰友 Jieyou Xu (Joe) 2024-06-11 21:27:47 +01:00 committed by GitHub
commit e37c423f10
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 10 deletions

View File

@ -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-dylib/Makefile
run-make/prefer-rlib/Makefile
run-make/pretty-print-to-file/Makefile
run-make/pretty-print-with-dep-file/Makefile

View File

@ -1,9 +0,0 @@
# ignore-cross-compile
include ../tools.mk
all:
$(RUSTC) bar.rs --crate-type=dylib --crate-type=rlib -C prefer-dynamic
$(RUSTC) foo.rs -C prefer-dynamic
$(call RUN,foo)
rm $(TMPDIR)/*bar*
$(call FAIL,foo)

View File

@ -0,0 +1,16 @@
//@ 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;
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();
// This time the command should fail.
run_fail("foo");
}