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 lto-smoke-c and link-path-order run-make tests to rmake #127928

Merged
merged 2 commits into from
Jul 19, 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
2 changes: 0 additions & 2 deletions src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,11 @@ run-make/libtest-junit/Makefile
run-make/libtest-thread-limit/Makefile
run-make/link-cfg/Makefile
run-make/link-framework/Makefile
run-make/link-path-order/Makefile
run-make/linkage-attr-on-static/Makefile
run-make/long-linker-command-lines-cmd-exe/Makefile
run-make/long-linker-command-lines/Makefile
run-make/lto-linkage-used-attr/Makefile
run-make/lto-no-link-whole-rlib/Makefile
run-make/lto-smoke-c/Makefile
run-make/macos-deployment-target/Makefile
run-make/macos-fat-archive/Makefile
run-make/manual-link/Makefile
Expand Down
19 changes: 0 additions & 19 deletions tests/run-make/link-path-order/Makefile

This file was deleted.

33 changes: 33 additions & 0 deletions tests/run-make/link-path-order/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// The order in which "library search path" `-L` arguments are given to the command line rustc
// is important. These arguments must match the order of the linker's arguments. In this test,
// fetching the Wrong library before the Correct one causes a function to return 0 instead of the
// expected 1, causing a runtime panic, as expected.
// See https://github.com/rust-lang/rust/pull/16904

//@ ignore-cross-compile
// Reason: the compiled binary is executed

use run_make_support::{build_native_static_lib, path, rfs, run, run_fail, rustc, static_lib_name};

fn main() {
build_native_static_lib("correct");
build_native_static_lib("wrong");
rfs::create_dir("correct");
rfs::create_dir("wrong");
rfs::rename(static_lib_name("correct"), path("correct").join(static_lib_name("foo")));
rfs::rename(static_lib_name("wrong"), path("wrong").join(static_lib_name("foo")));
rustc()
.input("main.rs")
.output("should_succeed")
.library_search_path("correct")
.library_search_path("wrong")
.run();
run("should_succeed");
rustc()
.input("main.rs")
.output("should_fail")
.library_search_path("wrong")
.library_search_path("correct")
.run();
run_fail("should_fail");
}
12 changes: 0 additions & 12 deletions tests/run-make/lto-smoke-c/Makefile

This file was deleted.

20 changes: 20 additions & 0 deletions tests/run-make/lto-smoke-c/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// LLVM's link-time-optimization (LTO) is a useful feature added to Rust in response
// to #10741. This test uses this feature with `-C lto` alongside a native C library,
// and checks that compilation and execution is successful.
// See https://github.com/rust-lang/rust/issues/10741

//@ ignore-cross-compile
// Reason: the compiled binary is executed

use run_make_support::{cc, extra_c_flags, extra_cxx_flags, run, rustc, static_lib_name};

fn main() {
rustc().input("foo.rs").arg("-Clto").run();
cc().input("bar.c")
.arg(static_lib_name("foo"))
.out_exe("bar")
.args(extra_c_flags())
.args(extra_cxx_flags())
.run();
run("bar");
}
Loading