summaryrefslogtreecommitdiffstats
path: root/tests/run-make/link-dedup
diff options
context:
space:
mode:
Diffstat (limited to 'tests/run-make/link-dedup')
-rw-r--r--tests/run-make/link-dedup/Makefile12
-rw-r--r--tests/run-make/link-dedup/depa.rs10
-rw-r--r--tests/run-make/link-dedup/depb.rs8
-rw-r--r--tests/run-make/link-dedup/depc.rs4
-rw-r--r--tests/run-make/link-dedup/empty.rs5
5 files changed, 39 insertions, 0 deletions
diff --git a/tests/run-make/link-dedup/Makefile b/tests/run-make/link-dedup/Makefile
new file mode 100644
index 000000000..eff18ab48
--- /dev/null
+++ b/tests/run-make/link-dedup/Makefile
@@ -0,0 +1,12 @@
+# ignore-msvc
+
+include ../tools.mk
+
+all:
+ $(RUSTC) depa.rs
+ $(RUSTC) depb.rs
+ $(RUSTC) depc.rs
+ $(RUSTC) empty.rs --cfg bar 2>&1 | $(CGREP) '"-ltesta" "-ltestb" "-ltesta"'
+ $(RUSTC) empty.rs 2>&1 | $(CGREP) '"-ltesta"'
+ $(RUSTC) empty.rs 2>&1 | $(CGREP) -v '"-ltestb"'
+ $(RUSTC) empty.rs 2>&1 | $(CGREP) -v '"-ltesta" "-ltesta" "-ltesta"'
diff --git a/tests/run-make/link-dedup/depa.rs b/tests/run-make/link-dedup/depa.rs
new file mode 100644
index 000000000..19178c5bd
--- /dev/null
+++ b/tests/run-make/link-dedup/depa.rs
@@ -0,0 +1,10 @@
+#![crate_type = "rlib"]
+
+#[link(name = "testa")]
+extern "C" {}
+
+#[link(name = "testa")]
+extern "C" {}
+
+#[link(name = "testa")]
+extern "C" {}
diff --git a/tests/run-make/link-dedup/depb.rs b/tests/run-make/link-dedup/depb.rs
new file mode 100644
index 000000000..b1be21fe0
--- /dev/null
+++ b/tests/run-make/link-dedup/depb.rs
@@ -0,0 +1,8 @@
+#![feature(link_cfg)]
+#![crate_type = "rlib"]
+
+#[link(name = "testb", cfg(foo))]
+extern "C" {}
+
+#[link(name = "testb", cfg(bar))]
+extern "C" {}
diff --git a/tests/run-make/link-dedup/depc.rs b/tests/run-make/link-dedup/depc.rs
new file mode 100644
index 000000000..8dcb3dee5
--- /dev/null
+++ b/tests/run-make/link-dedup/depc.rs
@@ -0,0 +1,4 @@
+#![crate_type = "rlib"]
+
+#[link(name = "testa")]
+extern "C" {}
diff --git a/tests/run-make/link-dedup/empty.rs b/tests/run-make/link-dedup/empty.rs
new file mode 100644
index 000000000..e00ae18f4
--- /dev/null
+++ b/tests/run-make/link-dedup/empty.rs
@@ -0,0 +1,5 @@
+extern crate depa;
+extern crate depb;
+extern crate depc;
+
+fn main() {}