Migrate `run-make/prefer-rlib` to `rmake.rs`

This commit is contained in:
Guillaume Gomez 2024-06-12 10:52:44 +02:00
parent 76c73827dc
commit f2cce98149
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-rlib/Makefile
run-make/pretty-print-to-file/Makefile
run-make/pretty-print-with-dep-file/Makefile
run-make/print-calling-conventions/Makefile

View File

@ -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)

View File

@ -0,0 +1,16 @@
// 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, path, run, rust_lib_name, rustc};
use std::fs::remove_file;
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();
remove_file(rust_lib_name("bar")).unwrap();
remove_file(dynamic_lib_name("bar")).unwrap();
run("foo");
}