Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit fb99d59

Browse files
authoredJul 19, 2024
Unrolled build for rust-lang#127928
Rollup merge of rust-lang#127928 - Oneirical:anatesthetic-sleep, r=Kobzol Migrate `lto-smoke-c` and `link-path-order` `run-make` tests to rmake Part of rust-lang#121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).
2 parents 8c3a94a + 7303132 commit fb99d59

File tree

5 files changed

+53
-33
lines changed

5 files changed

+53
-33
lines changed
 

‎src/tools/tidy/src/allowed_run_make_makefiles.txt

-2
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,11 @@ run-make/libtest-junit/Makefile
5656
run-make/libtest-thread-limit/Makefile
5757
run-make/link-cfg/Makefile
5858
run-make/link-framework/Makefile
59-
run-make/link-path-order/Makefile
6059
run-make/linkage-attr-on-static/Makefile
6160
run-make/long-linker-command-lines-cmd-exe/Makefile
6261
run-make/long-linker-command-lines/Makefile
6362
run-make/lto-linkage-used-attr/Makefile
6463
run-make/lto-no-link-whole-rlib/Makefile
65-
run-make/lto-smoke-c/Makefile
6664
run-make/macos-deployment-target/Makefile
6765
run-make/macos-fat-archive/Makefile
6866
run-make/manual-link/Makefile

‎tests/run-make/link-path-order/Makefile

-19
This file was deleted.
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// The order in which "library search path" `-L` arguments are given to the command line rustc
2+
// is important. These arguments must match the order of the linker's arguments. In this test,
3+
// fetching the Wrong library before the Correct one causes a function to return 0 instead of the
4+
// expected 1, causing a runtime panic, as expected.
5+
// See https://github.com/rust-lang/rust/pull/16904
6+
7+
//@ ignore-cross-compile
8+
// Reason: the compiled binary is executed
9+
10+
use run_make_support::{build_native_static_lib, path, rfs, run, run_fail, rustc, static_lib_name};
11+
12+
fn main() {
13+
build_native_static_lib("correct");
14+
build_native_static_lib("wrong");
15+
rfs::create_dir("correct");
16+
rfs::create_dir("wrong");
17+
rfs::rename(static_lib_name("correct"), path("correct").join(static_lib_name("foo")));
18+
rfs::rename(static_lib_name("wrong"), path("wrong").join(static_lib_name("foo")));
19+
rustc()
20+
.input("main.rs")
21+
.output("should_succeed")
22+
.library_search_path("correct")
23+
.library_search_path("wrong")
24+
.run();
25+
run("should_succeed");
26+
rustc()
27+
.input("main.rs")
28+
.output("should_fail")
29+
.library_search_path("wrong")
30+
.library_search_path("correct")
31+
.run();
32+
run_fail("should_fail");
33+
}

‎tests/run-make/lto-smoke-c/Makefile

-12
This file was deleted.

‎tests/run-make/lto-smoke-c/rmake.rs

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// LLVM's link-time-optimization (LTO) is a useful feature added to Rust in response
2+
// to #10741. This test uses this feature with `-C lto` alongside a native C library,
3+
// and checks that compilation and execution is successful.
4+
// See https://github.com/rust-lang/rust/issues/10741
5+
6+
//@ ignore-cross-compile
7+
// Reason: the compiled binary is executed
8+
9+
use run_make_support::{cc, extra_c_flags, extra_cxx_flags, run, rustc, static_lib_name};
10+
11+
fn main() {
12+
rustc().input("foo.rs").arg("-Clto").run();
13+
cc().input("bar.c")
14+
.arg(static_lib_name("foo"))
15+
.out_exe("bar")
16+
.args(extra_c_flags())
17+
.args(extra_cxx_flags())
18+
.run();
19+
run("bar");
20+
}

0 commit comments

Comments
 (0)
Failed to load comments.