From 631cd5845e8de329d0e227aaa707d7ea228b8f8f Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:20:29 +0200 Subject: Merging upstream version 1.70.0+dfsg1. Signed-off-by: Daniel Baumann --- tests/run-make/compiler-lookup-paths/Makefile | 41 +++++++++++++++++++++++++++ tests/run-make/compiler-lookup-paths/a.rs | 1 + tests/run-make/compiler-lookup-paths/b.rs | 2 ++ tests/run-make/compiler-lookup-paths/c.rs | 2 ++ tests/run-make/compiler-lookup-paths/d.rs | 4 +++ tests/run-make/compiler-lookup-paths/e.rs | 2 ++ tests/run-make/compiler-lookup-paths/e2.rs | 4 +++ tests/run-make/compiler-lookup-paths/f.rs | 2 ++ tests/run-make/compiler-lookup-paths/native.c | 1 + 9 files changed, 59 insertions(+) create mode 100644 tests/run-make/compiler-lookup-paths/Makefile create mode 100644 tests/run-make/compiler-lookup-paths/a.rs create mode 100644 tests/run-make/compiler-lookup-paths/b.rs create mode 100644 tests/run-make/compiler-lookup-paths/c.rs create mode 100644 tests/run-make/compiler-lookup-paths/d.rs create mode 100644 tests/run-make/compiler-lookup-paths/e.rs create mode 100644 tests/run-make/compiler-lookup-paths/e2.rs create mode 100644 tests/run-make/compiler-lookup-paths/f.rs create mode 100644 tests/run-make/compiler-lookup-paths/native.c (limited to 'tests/run-make/compiler-lookup-paths') diff --git a/tests/run-make/compiler-lookup-paths/Makefile b/tests/run-make/compiler-lookup-paths/Makefile new file mode 100644 index 000000000..310d6772c --- /dev/null +++ b/tests/run-make/compiler-lookup-paths/Makefile @@ -0,0 +1,41 @@ +include ../tools.mk + +# ignore-wasm32 (need a C compiler) +# ignore-wasm64 (need a C compiler) + +all: $(TMPDIR)/libnative.a + mkdir -p $(TMPDIR)/crate + mkdir -p $(TMPDIR)/native + mv $(TMPDIR)/libnative.a $(TMPDIR)/native + $(RUSTC) a.rs + mv $(TMPDIR)/liba.rlib $(TMPDIR)/crate + $(RUSTC) b.rs -L native=$(TMPDIR)/crate && exit 1 || exit 0 + $(RUSTC) b.rs -L dependency=$(TMPDIR)/crate && exit 1 || exit 0 + $(RUSTC) b.rs -L crate=$(TMPDIR)/crate + $(RUSTC) b.rs -L all=$(TMPDIR)/crate + $(RUSTC) c.rs -L native=$(TMPDIR)/crate && exit 1 || exit 0 + $(RUSTC) c.rs -L crate=$(TMPDIR)/crate && exit 1 || exit 0 + $(RUSTC) c.rs -L dependency=$(TMPDIR)/crate + $(RUSTC) c.rs -L all=$(TMPDIR)/crate + $(RUSTC) d.rs -L dependency=$(TMPDIR)/native && exit 1 || exit 0 + $(RUSTC) d.rs -L crate=$(TMPDIR)/native && exit 1 || exit 0 + $(RUSTC) d.rs -L native=$(TMPDIR)/native + $(RUSTC) d.rs -L all=$(TMPDIR)/native + # Deduplication tests: + # Same hash, no errors. + mkdir -p $(TMPDIR)/e1 + mkdir -p $(TMPDIR)/e2 + $(RUSTC) e.rs -o $(TMPDIR)/e1/libe.rlib + $(RUSTC) e.rs -o $(TMPDIR)/e2/libe.rlib + $(RUSTC) f.rs -L $(TMPDIR)/e1 -L $(TMPDIR)/e2 + $(RUSTC) f.rs -L crate=$(TMPDIR)/e1 -L $(TMPDIR)/e2 + $(RUSTC) f.rs -L crate=$(TMPDIR)/e1 -L crate=$(TMPDIR)/e2 + # Different hash, errors. + $(RUSTC) e2.rs -o $(TMPDIR)/e2/libe.rlib + $(RUSTC) f.rs -L $(TMPDIR)/e1 -L $(TMPDIR)/e2 && exit 1 || exit 0 + $(RUSTC) f.rs -L crate=$(TMPDIR)/e1 -L $(TMPDIR)/e2 && exit 1 || exit 0 + $(RUSTC) f.rs -L crate=$(TMPDIR)/e1 -L crate=$(TMPDIR)/e2 && exit 1 || exit 0 + # Native/dependency paths don't cause errors. + $(RUSTC) f.rs -L native=$(TMPDIR)/e1 -L $(TMPDIR)/e2 + $(RUSTC) f.rs -L dependency=$(TMPDIR)/e1 -L $(TMPDIR)/e2 + $(RUSTC) f.rs -L dependency=$(TMPDIR)/e1 -L crate=$(TMPDIR)/e2 diff --git a/tests/run-make/compiler-lookup-paths/a.rs b/tests/run-make/compiler-lookup-paths/a.rs new file mode 100644 index 000000000..83be6e807 --- /dev/null +++ b/tests/run-make/compiler-lookup-paths/a.rs @@ -0,0 +1 @@ +#![crate_type = "lib"] diff --git a/tests/run-make/compiler-lookup-paths/b.rs b/tests/run-make/compiler-lookup-paths/b.rs new file mode 100644 index 000000000..1be6cbc91 --- /dev/null +++ b/tests/run-make/compiler-lookup-paths/b.rs @@ -0,0 +1,2 @@ +#![crate_type = "lib"] +extern crate a; diff --git a/tests/run-make/compiler-lookup-paths/c.rs b/tests/run-make/compiler-lookup-paths/c.rs new file mode 100644 index 000000000..4c7ce01b6 --- /dev/null +++ b/tests/run-make/compiler-lookup-paths/c.rs @@ -0,0 +1,2 @@ +#![crate_type = "lib"] +extern crate b; diff --git a/tests/run-make/compiler-lookup-paths/d.rs b/tests/run-make/compiler-lookup-paths/d.rs new file mode 100644 index 000000000..6cd9916b6 --- /dev/null +++ b/tests/run-make/compiler-lookup-paths/d.rs @@ -0,0 +1,4 @@ +#![crate_type = "rlib"] + +#[link(name = "native", kind = "static")] +extern "C" {} diff --git a/tests/run-make/compiler-lookup-paths/e.rs b/tests/run-make/compiler-lookup-paths/e.rs new file mode 100644 index 000000000..18eb60aca --- /dev/null +++ b/tests/run-make/compiler-lookup-paths/e.rs @@ -0,0 +1,2 @@ +#![crate_name = "e"] +#![crate_type = "rlib"] diff --git a/tests/run-make/compiler-lookup-paths/e2.rs b/tests/run-make/compiler-lookup-paths/e2.rs new file mode 100644 index 000000000..cbf08b98e --- /dev/null +++ b/tests/run-make/compiler-lookup-paths/e2.rs @@ -0,0 +1,4 @@ +#![crate_name = "e"] +#![crate_type = "rlib"] + +pub fn f() {} diff --git a/tests/run-make/compiler-lookup-paths/f.rs b/tests/run-make/compiler-lookup-paths/f.rs new file mode 100644 index 000000000..483deaaea --- /dev/null +++ b/tests/run-make/compiler-lookup-paths/f.rs @@ -0,0 +1,2 @@ +#![crate_type = "rlib"] +extern crate e; diff --git a/tests/run-make/compiler-lookup-paths/native.c b/tests/run-make/compiler-lookup-paths/native.c new file mode 100644 index 000000000..d11c69f81 --- /dev/null +++ b/tests/run-make/compiler-lookup-paths/native.c @@ -0,0 +1 @@ +// intentionally empty -- cgit v1.2.3