Skip to content

Commit

Permalink
Add test for deduplicate native lib in linking
Browse files Browse the repository at this point in the history
  • Loading branch information
12101111 committed May 22, 2021
1 parent 004614c commit 8e42fa5
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/test/run-make-fulldeps/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"'
7 changes: 7 additions & 0 deletions src/test/run-make-fulldeps/link-dedup/depa.rs
@@ -0,0 +1,7 @@
#![crate_type = "rlib"]

#[link(name = "testa")]
extern "C" {}

#[link(name = "testa")]
extern "C" {}
8 changes: 8 additions & 0 deletions src/test/run-make-fulldeps/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" {}
4 changes: 4 additions & 0 deletions src/test/run-make-fulldeps/link-dedup/depc.rs
@@ -0,0 +1,4 @@
#![crate_type = "rlib"]

#[link(name = "testa")]
extern "C" {}
5 changes: 5 additions & 0 deletions src/test/run-make-fulldeps/link-dedup/empty.rs
@@ -0,0 +1,5 @@
extern crate depa;
extern crate depb;
extern crate depc;

fn main() {}

0 comments on commit 8e42fa5

Please sign in to comment.