Skip to content

Commit 553204d

Browse files
committed
Rewrite link-arg in rmake.rs
1 parent 9b584a6 commit 553204d

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ run-make/libtest-json/Makefile
109109
run-make/libtest-junit/Makefile
110110
run-make/libtest-padding/Makefile
111111
run-make/libtest-thread-limit/Makefile
112-
run-make/link-arg/Makefile
113112
run-make/link-args-order/Makefile
114113
run-make/link-cfg/Makefile
115114
run-make/link-dedup/Makefile

tests/run-make/link-arg/Makefile

-5
This file was deleted.

tests/run-make/link-arg/rmake.rs

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// In 2016, the rustc flag "-C link-arg" was introduced - it can be repeatedly used
2+
// to add single arguments to the linker. This test passes 2 arguments to the linker using it,
3+
// then checks that the compiler's output contains the arguments passed to it.
4+
// This ensures that the compiler successfully parses this flag.
5+
// See https://github.com/rust-lang/rust/pull/36574
6+
7+
use run_make_support::rustc;
8+
9+
fn main() {
10+
let output = String::from_utf8(
11+
rustc()
12+
.input("empty.rs")
13+
.link_arg("-lfoo")
14+
.link_arg("-lbar")
15+
.print("link-args")
16+
.command_output()
17+
.stdout,
18+
)
19+
.unwrap();
20+
assert!(
21+
output.contains("lfoo") || output.contains("lbar"),
22+
"The output did not contain the expected \"lfoo\" or \"lbar\" strings."
23+
);
24+
}

0 commit comments

Comments
 (0)