Skip to content

Commit 032be6f

Browse files
committed
Auto merge of #126484 - Oneirical:test-in-peace, r=jieyouxu,kobzol
Migrate `std-core-cycle`, `obey-crate-type-flag`, `mixing-libs` and `issue-18943` `run-make` tests to `rmake.rs` Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html). try-job: x86_64-apple-1 try-job: x86_64-msvc try-job: aarch64-gnu
2 parents 16b5690 + cbc62cb commit 032be6f

File tree

10 files changed

+83
-50
lines changed

10 files changed

+83
-50
lines changed

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

-4
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ run-make/interdependent-c-libraries/Makefile
4646
run-make/issue-107094/Makefile
4747
run-make/issue-14698/Makefile
4848
run-make/issue-15460/Makefile
49-
run-make/issue-18943/Makefile
5049
run-make/issue-22131/Makefile
5150
run-make/issue-25581/Makefile
5251
run-make/issue-26006/Makefile
@@ -80,13 +79,11 @@ run-make/macos-fat-archive/Makefile
8079
run-make/manual-link/Makefile
8180
run-make/min-global-align/Makefile
8281
run-make/missing-crate-dependency/Makefile
83-
run-make/mixing-libs/Makefile
8482
run-make/native-link-modifier-bundle/Makefile
8583
run-make/native-link-modifier-whole-archive/Makefile
8684
run-make/no-alloc-shim/Makefile
8785
run-make/no-builtins-attribute/Makefile
8886
run-make/no-duplicate-libs/Makefile
89-
run-make/obey-crate-type-flag/Makefile
9087
run-make/panic-abort-eh_frame/Makefile
9188
run-make/pass-non-c-like-enum-to-c/Makefile
9289
run-make/pdb-buildinfo-cl-cmd/Makefile
@@ -123,7 +120,6 @@ run-make/static-dylib-by-default/Makefile
123120
run-make/static-extern-type/Makefile
124121
run-make/staticlib-blank-lib/Makefile
125122
run-make/staticlib-dylib-linkage/Makefile
126-
run-make/std-core-cycle/Makefile
127123
run-make/symbol-mangling-hashed/Makefile
128124
run-make/symbol-visibility/Makefile
129125
run-make/sysroot-crates-are-unstable/Makefile

Diff for: tests/run-make/issue-18943/Makefile

-7
This file was deleted.
File renamed without changes.

Diff for: tests/run-make/lib-trait-for-trait-no-ice/rmake.rs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Inside a library, implementing a trait for another trait
2+
// with a lifetime used to cause an internal compiler error (ICE).
3+
// This test checks that this bug does not make a resurgence -
4+
// first by ensuring successful compilation, then verifying that
5+
// the lib crate-type flag was actually followed.
6+
// See https://github.com/rust-lang/rust/issues/18943
7+
8+
use run_make_support::{rust_lib_name, rustc};
9+
use std::path::Path;
10+
11+
fn main() {
12+
rustc().input("foo.rs").crate_type("lib").run();
13+
assert!(Path::new(&rust_lib_name("foo")).exists());
14+
}

Diff for: tests/run-make/mixing-libs/Makefile

-8
This file was deleted.

Diff for: tests/run-make/mixing-libs/rmake.rs

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Having multiple upstream crates available in different formats
2+
// should result in failed compilation. This test causes multiple
3+
// libraries to exist simultaneously as rust libs and dynamic libs,
4+
// causing prog.rs to fail compilation.
5+
// See https://github.com/rust-lang/rust/issues/10434
6+
7+
//@ ignore-cross-compile
8+
9+
use run_make_support::{dynamic_lib_name, fs_wrapper, rustc};
10+
11+
fn main() {
12+
rustc().input("rlib.rs").crate_type("rlib").crate_type("dylib").run();
13+
14+
// Not putting `-C prefer-dynamic` here allows for static linking of librlib.rlib.
15+
rustc().input("dylib.rs").run();
16+
17+
// librlib's dynamic version needs to be removed here to prevent prog.rs from fetching
18+
// the wrong one.
19+
fs_wrapper::remove_file(dynamic_lib_name("rlib"));
20+
rustc().input("prog.rs").run_fail();
21+
}

Diff for: tests/run-make/obey-crate-type-flag/Makefile

-14
This file was deleted.

Diff for: tests/run-make/obey-crate-type-flag/rmake.rs

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// test.rs should produce both an rlib and a dylib
2+
// by default. When the crate_type flag is passed and
3+
// forced to dylib, no rlibs should be produced.
4+
// See https://github.com/rust-lang/rust/issues/11573
5+
6+
//@ ignore-cross-compile
7+
8+
use run_make_support::{
9+
cwd, dynamic_lib_name, fs_wrapper, has_extension, rust_lib_name, rustc, shallow_find_files,
10+
};
11+
use std::path::Path;
12+
13+
fn main() {
14+
rustc().input("test.rs").run();
15+
assert!(Path::new(&dynamic_lib_name("test")).exists());
16+
assert!(Path::new(&rust_lib_name("test")).exists());
17+
18+
fs_wrapper::remove_file(rust_lib_name("test"));
19+
rustc().crate_type("dylib").input("test.rs").run();
20+
assert!(shallow_find_files(cwd(), |path| { has_extension(path, "rlib") }).is_empty());
21+
}

Diff for: tests/run-make/std-core-cycle/Makefile

-17
This file was deleted.

Diff for: tests/run-make/std-core-cycle/rmake.rs

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// In some cases, linking libraries with GNU used to fail due to how
2+
// `std` and `core` possess a circular dependency with one another, and
3+
// how the linker could not go back through its symbol processing to resolve
4+
// the circular link. #49316 fixed this, and this test reproduces a minimal
5+
// version of one such linking attempt which used to fail.
6+
// See https://github.com/rust-lang/rust/issues/18807
7+
8+
//@ ignore-cross-compile
9+
10+
use run_make_support::{is_darwin, is_windows, rustc};
11+
12+
fn main() {
13+
rustc().input("bar.rs").run();
14+
15+
let mut rustc_foo = rustc();
16+
rustc_foo.input("foo.rs");
17+
let mut rustc_foo_panic = rustc();
18+
rustc_foo_panic.input("foo.rs").panic("abort");
19+
20+
if !is_darwin() && !is_windows() {
21+
rustc_foo.arg("-Clink-args=-Wl,--no-undefined");
22+
rustc_foo_panic.arg("-Clink-args=-Wl,--no-undefined");
23+
}
24+
25+
rustc_foo.run();
26+
rustc_foo_panic.run();
27+
}

0 commit comments

Comments
 (0)