about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOneirical <manchot@videotron.ca>2024-07-12 15:16:53 -0400
committerOneirical <manchot@videotron.ca>2024-07-19 12:27:47 -0400
commit1a4fba5eb089d0c5413ed615c6e276eb76969535 (patch)
tree428a15efe8d17fb89525f29a6a91d4c1a5b77a62
parent1ae1ab8215c3ba2c9c0066d1aa13a033f0f94d5e (diff)
downloadrust-1a4fba5eb089d0c5413ed615c6e276eb76969535.tar.gz
rust-1a4fba5eb089d0c5413ed615c6e276eb76969535.zip
rewrite c-static-rlib to rmake
-rw-r--r--src/tools/tidy/src/allowed_run_make_makefiles.txt1
-rw-r--r--tests/run-make/c-static-rlib/Makefile12
-rw-r--r--tests/run-make/c-static-rlib/rmake.rs19
3 files changed, 19 insertions, 13 deletions
diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt
index 4b5ab3b063f..0defdb37363 100644
--- a/src/tools/tidy/src/allowed_run_make_makefiles.txt
+++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt
@@ -1,7 +1,6 @@
 run-make/branch-protection-check-IBT/Makefile
 run-make/c-dynamic-dylib/Makefile
 run-make/c-dynamic-rlib/Makefile
-run-make/c-static-rlib/Makefile
 run-make/c-unwind-abi-catch-lib-panic/Makefile
 run-make/c-unwind-abi-catch-panic/Makefile
 run-make/cat-and-grep-sanity-check/Makefile
diff --git a/tests/run-make/c-static-rlib/Makefile b/tests/run-make/c-static-rlib/Makefile
deleted file mode 100644
index 298e432cdb8..00000000000
--- a/tests/run-make/c-static-rlib/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-# This test checks that static Rust linking with C does not encounter any errors, with static dependencies given preference over dynamic. (This is the default behaviour.)
-# See https://github.com/rust-lang/rust/issues/10434
-
-# ignore-cross-compile
-include ../tools.mk
-
-all: $(call NATIVE_STATICLIB,cfoo)
-	$(RUSTC) foo.rs
-	$(RUSTC) bar.rs
-	$(call REMOVE_RLIBS,foo)
-	rm $(call NATIVE_STATICLIB,cfoo)
-	$(call RUN,bar)
diff --git a/tests/run-make/c-static-rlib/rmake.rs b/tests/run-make/c-static-rlib/rmake.rs
new file mode 100644
index 00000000000..3d582dca98e
--- /dev/null
+++ b/tests/run-make/c-static-rlib/rmake.rs
@@ -0,0 +1,19 @@
+// This test checks that static Rust linking with C does not encounter any errors,
+// with static dependencies given preference over dynamic. (This is the default behaviour.)
+// See https://github.com/rust-lang/rust/issues/10434
+
+//@ ignore-cross-compile
+// Reason: the compiled binary is executed
+
+use run_make_support::{
+    build_native_static_lib, fs_wrapper, run, rust_lib_name, rustc, static_lib_name,
+};
+
+fn main() {
+    build_native_static_lib("cfoo");
+    rustc().input("foo.rs").run();
+    rustc().input("bar.rs").run();
+    fs_wrapper::remove_file(rust_lib_name("foo"));
+    fs_wrapper::remove_file(static_lib_name("cfoo"));
+    run("bar");
+}