Skip to content

Commit

Permalink
Auto merge of #126484 - Oneirical:test-in-peace, r=jieyouxu,kobzol
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bors committed Jul 16, 2024
2 parents 16b5690 + cbc62cb commit 032be6f
Show file tree
Hide file tree
Showing 10 changed files with 83 additions and 50 deletions.
4 changes: 0 additions & 4 deletions src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ run-make/interdependent-c-libraries/Makefile
run-make/issue-107094/Makefile
run-make/issue-14698/Makefile
run-make/issue-15460/Makefile
run-make/issue-18943/Makefile
run-make/issue-22131/Makefile
run-make/issue-25581/Makefile
run-make/issue-26006/Makefile
Expand Down Expand Up @@ -80,13 +79,11 @@ run-make/macos-fat-archive/Makefile
run-make/manual-link/Makefile
run-make/min-global-align/Makefile
run-make/missing-crate-dependency/Makefile
run-make/mixing-libs/Makefile
run-make/native-link-modifier-bundle/Makefile
run-make/native-link-modifier-whole-archive/Makefile
run-make/no-alloc-shim/Makefile
run-make/no-builtins-attribute/Makefile
run-make/no-duplicate-libs/Makefile
run-make/obey-crate-type-flag/Makefile
run-make/panic-abort-eh_frame/Makefile
run-make/pass-non-c-like-enum-to-c/Makefile
run-make/pdb-buildinfo-cl-cmd/Makefile
Expand Down Expand Up @@ -123,7 +120,6 @@ run-make/static-dylib-by-default/Makefile
run-make/static-extern-type/Makefile
run-make/staticlib-blank-lib/Makefile
run-make/staticlib-dylib-linkage/Makefile
run-make/std-core-cycle/Makefile
run-make/symbol-mangling-hashed/Makefile
run-make/symbol-visibility/Makefile
run-make/sysroot-crates-are-unstable/Makefile
Expand Down
7 changes: 0 additions & 7 deletions tests/run-make/issue-18943/Makefile

This file was deleted.

File renamed without changes.
14 changes: 14 additions & 0 deletions tests/run-make/lib-trait-for-trait-no-ice/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Inside a library, implementing a trait for another trait
// with a lifetime used to cause an internal compiler error (ICE).
// This test checks that this bug does not make a resurgence -
// first by ensuring successful compilation, then verifying that
// the lib crate-type flag was actually followed.
// See https://github.com/rust-lang/rust/issues/18943

use run_make_support::{rust_lib_name, rustc};
use std::path::Path;

fn main() {
rustc().input("foo.rs").crate_type("lib").run();
assert!(Path::new(&rust_lib_name("foo")).exists());
}
8 changes: 0 additions & 8 deletions tests/run-make/mixing-libs/Makefile

This file was deleted.

21 changes: 21 additions & 0 deletions tests/run-make/mixing-libs/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Having multiple upstream crates available in different formats
// should result in failed compilation. This test causes multiple
// libraries to exist simultaneously as rust libs and dynamic libs,
// causing prog.rs to fail compilation.
// See https://github.com/rust-lang/rust/issues/10434

//@ ignore-cross-compile

use run_make_support::{dynamic_lib_name, fs_wrapper, rustc};

fn main() {
rustc().input("rlib.rs").crate_type("rlib").crate_type("dylib").run();

// Not putting `-C prefer-dynamic` here allows for static linking of librlib.rlib.
rustc().input("dylib.rs").run();

// librlib's dynamic version needs to be removed here to prevent prog.rs from fetching
// the wrong one.
fs_wrapper::remove_file(dynamic_lib_name("rlib"));
rustc().input("prog.rs").run_fail();
}
14 changes: 0 additions & 14 deletions tests/run-make/obey-crate-type-flag/Makefile

This file was deleted.

21 changes: 21 additions & 0 deletions tests/run-make/obey-crate-type-flag/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// test.rs should produce both an rlib and a dylib
// by default. When the crate_type flag is passed and
// forced to dylib, no rlibs should be produced.
// See https://github.com/rust-lang/rust/issues/11573

//@ ignore-cross-compile

use run_make_support::{
cwd, dynamic_lib_name, fs_wrapper, has_extension, rust_lib_name, rustc, shallow_find_files,
};
use std::path::Path;

fn main() {
rustc().input("test.rs").run();
assert!(Path::new(&dynamic_lib_name("test")).exists());
assert!(Path::new(&rust_lib_name("test")).exists());

fs_wrapper::remove_file(rust_lib_name("test"));
rustc().crate_type("dylib").input("test.rs").run();
assert!(shallow_find_files(cwd(), |path| { has_extension(path, "rlib") }).is_empty());
}
17 changes: 0 additions & 17 deletions tests/run-make/std-core-cycle/Makefile

This file was deleted.

27 changes: 27 additions & 0 deletions tests/run-make/std-core-cycle/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// In some cases, linking libraries with GNU used to fail due to how
// `std` and `core` possess a circular dependency with one another, and
// how the linker could not go back through its symbol processing to resolve
// the circular link. #49316 fixed this, and this test reproduces a minimal
// version of one such linking attempt which used to fail.
// See https://github.com/rust-lang/rust/issues/18807

//@ ignore-cross-compile

use run_make_support::{is_darwin, is_windows, rustc};

fn main() {
rustc().input("bar.rs").run();

let mut rustc_foo = rustc();
rustc_foo.input("foo.rs");
let mut rustc_foo_panic = rustc();
rustc_foo_panic.input("foo.rs").panic("abort");

if !is_darwin() && !is_windows() {
rustc_foo.arg("-Clink-args=-Wl,--no-undefined");
rustc_foo_panic.arg("-Clink-args=-Wl,--no-undefined");
}

rustc_foo.run();
rustc_foo_panic.run();
}

0 comments on commit 032be6f

Please sign in to comment.