about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2024-06-12 10:52:44 +0200
committerGuillaume Gomez <guillaume.gomez@huawei.com>2024-06-12 11:38:56 +0200
commitf2cce98149b78e2880e2e81e03c2cc94ff5a29a5 (patch)
treee746ee18c45e1ba33c20a7c6b543eca7b65ba1b5
parent76c73827dcd0b363e60b22c3cef64bde4171bf17 (diff)
downloadrust-f2cce98149b78e2880e2e81e03c2cc94ff5a29a5.tar.gz
rust-f2cce98149b78e2880e2e81e03c2cc94ff5a29a5.zip
Migrate `run-make/prefer-rlib` to `rmake.rs`
-rw-r--r--src/tools/tidy/src/allowed_run_make_makefiles.txt1
-rw-r--r--tests/run-make/prefer-rlib/Makefile9
-rw-r--r--tests/run-make/prefer-rlib/rmake.rs16
3 files changed, 16 insertions, 10 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-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..1d336a07903
--- /dev/null
+++ b/tests/run-make/prefer-rlib/rmake.rs
@@ -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");
+}