Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate std-core-cycle, obey-crate-type-flag, mixing-libs and issue-18943 run-make tests to rmake.rs #126484

Merged
merged 5 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -52,7 +52,6 @@ run-make/issue-107094/Makefile
run-make/issue-109934-lto-debuginfo/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 @@ -91,13 +90,11 @@ run-make/manual-link/Makefile
run-make/metadata-dep-info/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-linker-flags-flavor/Makefile
run-make/pass-linker-flags-from-dep/Makefile
Expand Down Expand Up @@ -142,7 +139,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/symbols-include-type-name/Makefile
Expand Down
7 changes: 0 additions & 7 deletions tests/run-make/issue-18943/Makefile

This file was deleted.

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();
}
Loading