about summary refs log tree commit diff
path: root/tests/run-make/c-dynamic-rlib
diff options
context:
space:
mode:
authorOneirical <manchot@videotron.ca>2024-07-17 12:07:28 -0400
committerOneirical <manchot@videotron.ca>2024-07-22 11:15:09 -0400
commit63286d80a1822df32c2f18fb7968a1368d8da8d6 (patch)
treeeb28fefd089c15f8b9543e165813cb74f9a3fbe8 /tests/run-make/c-dynamic-rlib
parentef07fe1b2811836ee4b5b30e94c74061bc66d06c (diff)
downloadrust-63286d80a1822df32c2f18fb7968a1368d8da8d6.tar.gz
rust-63286d80a1822df32c2f18fb7968a1368d8da8d6.zip
rewrite c-dynamic-rlib to rmake
Diffstat (limited to 'tests/run-make/c-dynamic-rlib')
-rw-r--r--tests/run-make/c-dynamic-rlib/Makefile19
-rw-r--r--tests/run-make/c-dynamic-rlib/rmake.rs22
2 files changed, 22 insertions, 19 deletions
diff --git a/tests/run-make/c-dynamic-rlib/Makefile b/tests/run-make/c-dynamic-rlib/Makefile
deleted file mode 100644
index 7b05e3d91a0..00000000000
--- a/tests/run-make/c-dynamic-rlib/Makefile
+++ /dev/null
@@ -1,19 +0,0 @@
-# This test checks that dynamic 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
-
-# ignore-apple
-#
-# This hits an assertion in the linker on older versions of osx apparently
-
-# This overrides the LD_LIBRARY_PATH for RUN
-TARGET_RPATH_DIR:=$(TARGET_RPATH_DIR):$(TMPDIR)
-
-all: $(call DYLIB,cfoo)
-	$(RUSTC) foo.rs
-	$(RUSTC) bar.rs
-	$(call RUN,bar)
-	$(call REMOVE_DYLIBS,cfoo)
-	$(call FAIL,bar)
diff --git a/tests/run-make/c-dynamic-rlib/rmake.rs b/tests/run-make/c-dynamic-rlib/rmake.rs
new file mode 100644
index 00000000000..c48b1edee9e
--- /dev/null
+++ b/tests/run-make/c-dynamic-rlib/rmake.rs
@@ -0,0 +1,22 @@
+// This test checks that dynamic Rust linking with C does not encounter any errors in both
+// compilation and execution, 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
+
+//FIXME(Oneirical): test on apple because older versions of osx are failing apparently
+
+use run_make_support::{
+    build_native_dynamic_lib, dynamic_lib_name, fs_wrapper, run, run_fail, rustc,
+};
+
+fn main() {
+    build_native_dynamic_lib("cfoo");
+    rustc().input("foo.rs").run();
+    rustc().input("bar.rs").run();
+    run("bar");
+    fs_wrapper::remove_file(dynamic_lib_name("cfoo"));
+    run_fail("bar");
+}