about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/test/run-make/many-crates-but-no-match/Makefile34
-rw-r--r--src/test/run-make/many-crates-but-no-match/crateA1.rs14
-rw-r--r--src/test/run-make/many-crates-but-no-match/crateA2.rs14
-rw-r--r--src/test/run-make/many-crates-but-no-match/crateA3.rs14
-rw-r--r--src/test/run-make/many-crates-but-no-match/crateB.rs11
-rw-r--r--src/test/run-make/many-crates-but-no-match/crateC.rs13
6 files changed, 100 insertions, 0 deletions
diff --git a/src/test/run-make/many-crates-but-no-match/Makefile b/src/test/run-make/many-crates-but-no-match/Makefile
new file mode 100644
index 00000000000..4d80c09c26b
--- /dev/null
+++ b/src/test/run-make/many-crates-but-no-match/Makefile
@@ -0,0 +1,34 @@
+-include ../tools.mk
+
+# Modelled after compile-fail/changing-crates test, but this one puts
+# more than one (mismatching) candidate crate into the search path,
+# which did not appear directly expressible in compile-fail/aux-build
+# infrastructure.
+#
+# Note that we move the built libraries into target direcrtories rather than
+# use the `--out-dir` option because the `../tools.mk` file already bakes a
+# use of `--out-dir` into the definition of $(RUSTC).
+
+A1=$(TMPDIR)/a1
+A2=$(TMPDIR)/a2
+A3=$(TMPDIR)/a3
+
+# A hack to match distinct lines of output from a single run.
+LOG=$(TMPDIR)/log.txt
+
+all: 
+	mkdir -p $(A1) $(A2) $(A3)
+	$(RUSTC) --crate-type=rlib crateA1.rs
+	mv $(TMPDIR)/$(call RLIB_GLOB,crateA) $(A1)
+	$(RUSTC) --crate-type=rlib -L$(A1) crateB.rs
+	$(RUSTC) --crate-type=rlib crateA2.rs
+	mv $(TMPDIR)/$(call RLIB_GLOB,crateA) $(A2)
+	$(RUSTC) --crate-type=rlib crateA3.rs
+	mv $(TMPDIR)/$(call RLIB_GLOB,crateA) $(A3)
+	# Ensure crateC fails to compile since A1 is "missing" and A2/A3 hashes do not match
+	$(RUSTC) -L$(A2) -L$(A3) crateC.rs >$(LOG) 2>&1 || true
+	grep "error: found possibly newer version of crate \`crateA\` which \`crateB\` depends on" $(LOG)
+	grep "note: perhaps this crate needs to be recompiled?" $(LOG)
+	grep "note: crate \`crateA\` path #1:" $(LOG)
+	grep "note: crate \`crateA\` path #2:" $(LOG)
+	grep "note: crate \`crateB\` path #1:" $(LOG)
diff --git a/src/test/run-make/many-crates-but-no-match/crateA1.rs b/src/test/run-make/many-crates-but-no-match/crateA1.rs
new file mode 100644
index 00000000000..0c88cf4745a
--- /dev/null
+++ b/src/test/run-make/many-crates-but-no-match/crateA1.rs
@@ -0,0 +1,14 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![crate_id="crateA"]
+
+// Base crate
+pub fn func<T>() {}
diff --git a/src/test/run-make/many-crates-but-no-match/crateA2.rs b/src/test/run-make/many-crates-but-no-match/crateA2.rs
new file mode 100644
index 00000000000..e3fb50e13d0
--- /dev/null
+++ b/src/test/run-make/many-crates-but-no-match/crateA2.rs
@@ -0,0 +1,14 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![crate_id="crateA"]
+
+// Base crate
+pub fn func<T>() { println!("hello"); }
diff --git a/src/test/run-make/many-crates-but-no-match/crateA3.rs b/src/test/run-make/many-crates-but-no-match/crateA3.rs
new file mode 100644
index 00000000000..ad9d458be24
--- /dev/null
+++ b/src/test/run-make/many-crates-but-no-match/crateA3.rs
@@ -0,0 +1,14 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![crate_id="crateA"]
+
+// Base crate
+pub fn foo<T>() { println!("world!"); }
diff --git a/src/test/run-make/many-crates-but-no-match/crateB.rs b/src/test/run-make/many-crates-but-no-match/crateB.rs
new file mode 100644
index 00000000000..bf55017c646
--- /dev/null
+++ b/src/test/run-make/many-crates-but-no-match/crateB.rs
@@ -0,0 +1,11 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+extern crate crateA;
diff --git a/src/test/run-make/many-crates-but-no-match/crateC.rs b/src/test/run-make/many-crates-but-no-match/crateC.rs
new file mode 100644
index 00000000000..174d9382b76
--- /dev/null
+++ b/src/test/run-make/many-crates-but-no-match/crateC.rs
@@ -0,0 +1,13 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+extern crate crateB;
+
+fn main() {}