about summary refs log tree commit diff
path: root/tests/run-make/c-dynamic-dylib/rmake.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/run-make/c-dynamic-dylib/rmake.rs')
-rw-r--r--tests/run-make/c-dynamic-dylib/rmake.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/run-make/c-dynamic-dylib/rmake.rs b/tests/run-make/c-dynamic-dylib/rmake.rs
new file mode 100644
index 00000000000..65b5e02abf0
--- /dev/null
+++ b/tests/run-make/c-dynamic-dylib/rmake.rs
@@ -0,0 +1,17 @@
+// This test checks that dynamic Rust linking with C does not encounter any errors in both
+// compilation and execution, with dynamic dependencies given preference over static.
+// See https://github.com/rust-lang/rust/issues/10434
+
+//@ ignore-cross-compile
+// Reason: the compiled binary is executed
+
+use run_make_support::{build_native_dynamic_lib, dynamic_lib_name, rfs, run, run_fail, rustc};
+
+fn main() {
+    build_native_dynamic_lib("cfoo");
+    rustc().input("foo.rs").arg("-Cprefer-dynamic").run();
+    rustc().input("bar.rs").run();
+    run("bar");
+    rfs::remove_file(dynamic_lib_name("cfoo"));
+    run_fail("bar");
+}