rewrite pass-linker-flags to rmake
This commit is contained in:
parent
e2cf31a614
commit
f11ab15e9a
@ -108,7 +108,6 @@ run-make/output-type-permutations/Makefile
|
||||
run-make/panic-abort-eh_frame/Makefile
|
||||
run-make/pass-linker-flags-flavor/Makefile
|
||||
run-make/pass-linker-flags-from-dep/Makefile
|
||||
run-make/pass-linker-flags/Makefile
|
||||
run-make/pass-non-c-like-enum-to-c/Makefile
|
||||
run-make/pdb-buildinfo-cl-cmd/Makefile
|
||||
run-make/pgo-gen-lto/Makefile
|
||||
|
@ -1,5 +0,0 @@
|
||||
include ../tools.mk
|
||||
|
||||
all:
|
||||
$(RUSTC) empty.rs -Z unstable-options -l static=l1 -l link-arg=a1 -l static=l2 -l link-arg=a2 -l dylib=d1 -l link-arg=a3 --print link-args | $(CGREP) -e 'l1.*a1.*l2.*a2.*d1.*a3'
|
||||
$(RUSTC) attribute.rs --print link-args | $(CGREP) -e 'l1.*a1.*l2.*a2.*d1.*a3'
|
27
tests/run-make/pass-linker-flags/rmake.rs
Normal file
27
tests/run-make/pass-linker-flags/rmake.rs
Normal file
@ -0,0 +1,27 @@
|
||||
// This test checks the proper function of `-l link-arg=NAME`, which, unlike
|
||||
// -C link-arg, is supposed to guarantee that the order relative to other -l
|
||||
// options will be respected. In this test, compilation fails (because none of the
|
||||
// link arguments like `a1` exist), but it is still checked if the output contains the
|
||||
// link arguments in the exact order they were passed in. `attribute.rs` is a variant
|
||||
// of the test where the flags are defined in the rust file itself.
|
||||
// See https://github.com/rust-lang/rust/issues/99427
|
||||
|
||||
use run_make_support::{regex, rustc};
|
||||
|
||||
fn main() {
|
||||
let out = rustc()
|
||||
.input("empty.rs")
|
||||
.arg("-Zunstable-options")
|
||||
.args(&["-l", "static=l1"])
|
||||
.arg("-llink-arg=a1")
|
||||
.arg("-lstatic=l2")
|
||||
.arg("-llink-arg=a2")
|
||||
.arg("-ldylib=d1")
|
||||
.arg("-llink-arg=a3")
|
||||
.print("link-args")
|
||||
.run_unchecked()
|
||||
.stdout_utf8();
|
||||
let out2 = rustc().input("attribute.rs").print("link-args").run_unchecked().stdout_utf8();
|
||||
let re = regex::Regex::new("l1.*a1.*l2.*a2.*d1.*a3").unwrap();
|
||||
assert!(re.is_match(&out) && re.is_match(&out2));
|
||||
}
|
Loading…
Reference in New Issue
Block a user