Skip to content

Commit 54be9ad

Browse files
committed
Auto merge of #128102 - Oneirical:real-testate, r=Kobzol
Migrate `extern-diff-internal-name`, `extern-multiple-copies` and `extern-multiple-copies2` `run-make` tests to rmake Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html). Please try: try-job: test-various
2 parents 28e684b + 421619d commit 54be9ad

File tree

7 files changed

+52
-29
lines changed

7 files changed

+52
-29
lines changed

Diff for: src/tools/tidy/src/allowed_run_make_makefiles.txt

-3
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,8 @@ run-make/dep-info/Makefile
1313
run-make/dump-ice-to-disk/Makefile
1414
run-make/emit-to-stdout/Makefile
1515
run-make/export-executable-symbols/Makefile
16-
run-make/extern-diff-internal-name/Makefile
1716
run-make/extern-flag-disambiguates/Makefile
1817
run-make/extern-fn-reachable/Makefile
19-
run-make/extern-multiple-copies/Makefile
20-
run-make/extern-multiple-copies2/Makefile
2118
run-make/fmt-write-bloat/Makefile
2219
run-make/foreign-double-unwind/Makefile
2320
run-make/foreign-exceptions/Makefile

Diff for: tests/run-make/extern-diff-internal-name/Makefile

-6
This file was deleted.

Diff for: tests/run-make/extern-diff-internal-name/rmake.rs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// In the following scenario:
2+
// 1. The crate foo, is referenced multiple times
3+
// 2. --extern foo=./path/to/libbar.rlib is specified to rustc
4+
// 3. The internal crate name of libbar.rlib is not foo
5+
// Compilation fails with the "multiple crate versions" error message.
6+
// As this was fixed in #17189, this regression test ensures this bug does not
7+
// make a resurgence.
8+
// See https://github.com/rust-lang/rust/pull/17189
9+
10+
use run_make_support::{rust_lib_name, rustc};
11+
12+
fn main() {
13+
rustc().input("lib.rs").run();
14+
rustc().input("test.rs").extern_("foo", rust_lib_name("bar")).run();
15+
}

Diff for: tests/run-make/extern-multiple-copies/Makefile

-9
This file was deleted.

Diff for: tests/run-make/extern-multiple-copies/rmake.rs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// In this test, the rust library foo1 exists in two different locations, but only one
2+
// is required by the --extern flag. This test checks that the copy is ignored (as --extern
3+
// demands fetching only the original instance of foo1) and that no error is emitted, resulting
4+
// in successful compilation.
5+
// https://github.com/rust-lang/rust/pull/29961
6+
7+
use run_make_support::{path, rfs, rust_lib_name, rustc};
8+
9+
fn main() {
10+
rustc().input("foo1.rs").run();
11+
rustc().input("foo2.rs").run();
12+
rfs::create_dir("foo");
13+
rfs::copy(rust_lib_name("foo1"), path("foo").join(rust_lib_name("foo1")));
14+
rustc().input("bar.rs").extern_("foo1", rust_lib_name("foo1")).library_search_path("foo").run();
15+
}

Diff for: tests/run-make/extern-multiple-copies2/Makefile

-11
This file was deleted.

Diff for: tests/run-make/extern-multiple-copies2/rmake.rs

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Almost identical to `extern-multiple-copies`, but with a variation in the --extern calls
2+
// and the addition of #[macro_use] in the rust code files, which used to break --extern
3+
// until #33625.
4+
// In this test, the rust library foo1 exists in two different locations, but only one
5+
// is required by the --extern flag. This test checks that the copy is ignored (as --extern
6+
// demands fetching only the original instance of foo1) and that no error is emitted, resulting
7+
// in successful compilation.
8+
// https://github.com/rust-lang/rust/issues/33762
9+
10+
use run_make_support::{path, rfs, rust_lib_name, rustc};
11+
12+
fn main() {
13+
rustc().input("foo1.rs").run();
14+
rustc().input("foo2.rs").run();
15+
rfs::create_dir("foo");
16+
rfs::copy(rust_lib_name("foo1"), path("foo").join(rust_lib_name("foo1")));
17+
rustc()
18+
.input("bar.rs")
19+
.extern_("foo1", path("foo").join(rust_lib_name("foo1")))
20+
.extern_("foo2", rust_lib_name("foo2"))
21+
.run();
22+
}

0 commit comments

Comments
 (0)