about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorOneirical <manchot@videotron.ca>2024-06-27 10:20:49 -0400
committerOneirical <manchot@videotron.ca>2024-07-02 11:37:58 -0400
commit86bd3498b2c5a6a40f3db62c48a22f81d7713950 (patch)
tree9c7d145e5cfb6336535ae6140eb1e1697e795c64 /tests
parent371845b630a86f86233c4a031971f9737a2092ff (diff)
downloadrust-86bd3498b2c5a6a40f3db62c48a22f81d7713950.tar.gz
rust-86bd3498b2c5a6a40f3db62c48a22f81d7713950.zip
rewrite rlib-chain to rmake
Diffstat (limited to 'tests')
-rw-r--r--tests/run-make/dylib-chain/rmake.rs5
-rw-r--r--tests/run-make/rlib-chain/Makefile11
-rw-r--r--tests/run-make/rlib-chain/rmake.rs23
3 files changed, 26 insertions, 13 deletions
diff --git a/tests/run-make/dylib-chain/rmake.rs b/tests/run-make/dylib-chain/rmake.rs
index 1d27191806f..a96cc350875 100644
--- a/tests/run-make/dylib-chain/rmake.rs
+++ b/tests/run-make/dylib-chain/rmake.rs
@@ -1,7 +1,8 @@
 // In this test, m4 depends on m3, which depends on m2, which depends on m1.
 // Even though dependencies are chained like this and there is no direct mention
-// of m1 or m2 in m4.rs, compilation and execution should still succeed. Naturally,
-// removing those dependencies should cause execution to fail.
+// of m1 or m2 in m4.rs, compilation and execution should still succeed. Unlike the
+// rlib-chain test, dynamic libraries contain upstream dependencies, and breaking
+// the chain by removing the dylibs causes execution to fail.
 // See https://github.com/rust-lang/rust/issues/10434
 
 //@ ignore-cross-compile
diff --git a/tests/run-make/rlib-chain/Makefile b/tests/run-make/rlib-chain/Makefile
deleted file mode 100644
index 7a1f887fa52..00000000000
--- a/tests/run-make/rlib-chain/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# ignore-cross-compile
-include ../tools.mk
-
-all:
-	$(RUSTC) m1.rs
-	$(RUSTC) m2.rs
-	$(RUSTC) m3.rs
-	$(RUSTC) m4.rs
-	$(call RUN,m4)
-	rm $(TMPDIR)/*lib
-	$(call RUN,m4)
diff --git a/tests/run-make/rlib-chain/rmake.rs b/tests/run-make/rlib-chain/rmake.rs
new file mode 100644
index 00000000000..0947262bf62
--- /dev/null
+++ b/tests/run-make/rlib-chain/rmake.rs
@@ -0,0 +1,23 @@
+// In this test, m4 depends on m3, which depends on m2, which depends on m1.
+// Even though dependencies are chained like this and there is no direct mention
+// of m1 or m2 in m4.rs, compilation and execution should still succeed. Unlike
+// the dylib-chain test, rlibs do not contain upstream dependencies, and removing
+// the libraries still allows m4 to successfully execute.
+// See https://github.com/rust-lang/rust/issues/10434
+
+//@ ignore-cross-compile
+// Reason: the compiled binary is executed
+
+use run_make_support::{fs_wrapper, run, rust_lib_name, rustc};
+
+fn main() {
+    rustc().input("m1.rs").run();
+    rustc().input("m2.rs").run();
+    rustc().input("m3.rs").run();
+    rustc().input("m4.rs").run();
+    run("m4");
+    fs_wrapper::remove_file(rust_lib_name("m1"));
+    fs_wrapper::remove_file(rust_lib_name("m2"));
+    fs_wrapper::remove_file(rust_lib_name("m3"));
+    run("m4");
+}