Skip to content

Commit 232c5b6

Browse files
committed
rewrite link-path-order to rmake
1 parent 741cf91 commit 232c5b6

File tree

3 files changed

+33
-20
lines changed

3 files changed

+33
-20
lines changed

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ 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

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, 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"), format!("correct/{}", static_lib_name("foo")));
18+
rfs::rename(static_lib_name("wrong"), format!("wrong/{}", 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+
}

0 commit comments

Comments
 (0)