Rollup merge of #126898 - GuillaumeGomez:migrate-run-make-link-framework, r=Kobzol

Migrate `run-make/link-framework` to `rmake.rs`

Part of https://github.com/rust-lang/rust/issues/121876.

r? ``@Kobzol``

try-job: x86_64-apple-1
This commit is contained in:
Matthias Krüger 2024-07-23 19:42:35 +02:00 committed by GitHub
commit f1a29ee226
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 38 additions and 24 deletions

View File

@ -39,7 +39,6 @@ run-make/libtest-json/Makefile
run-make/libtest-junit/Makefile
run-make/libtest-thread-limit/Makefile
run-make/link-cfg/Makefile
run-make/link-framework/Makefile
run-make/long-linker-command-lines-cmd-exe/Makefile
run-make/long-linker-command-lines/Makefile
run-make/lto-linkage-used-attr/Makefile

View File

@ -1,23 +0,0 @@
# only-apple
#
# Check that linking to a framework actually makes it to the linker.
include ../tools.mk
all:
$(RUSTC) dep-link-framework.rs
$(RUSTC) dep-link-weak-framework.rs
$(RUSTC) empty.rs
otool -L $(TMPDIR)/no-link | $(CGREP) -v CoreFoundation
$(RUSTC) link-framework.rs
otool -L $(TMPDIR)/link-framework | $(CGREP) CoreFoundation | $(CGREP) -v weak
$(RUSTC) link-weak-framework.rs
otool -L $(TMPDIR)/link-weak-framework | $(CGREP) CoreFoundation | $(CGREP) weak
# When linking the framework both normally, and weakly, the weak linking takes preference
$(RUSTC) link-both.rs
otool -L $(TMPDIR)/link-both | $(CGREP) CoreFoundation | $(CGREP) weak

View File

@ -0,0 +1,38 @@
// Check that linking to a framework actually makes it to the linker.
//@ only-apple
use run_make_support::{cmd, rustc};
fn main() {
rustc().input("dep-link-framework.rs").run();
rustc().input("dep-link-weak-framework.rs").run();
rustc().input("empty.rs").run();
cmd("otool").arg("-L").arg("no-link").run_fail().assert_stdout_not_contains("CoreFoundation");
rustc().input("link-framework.rs").run();
cmd("otool")
.arg("-L")
.arg("link-framework")
.run()
.assert_stdout_contains("CoreFoundation")
.assert_stdout_not_contains("weak");
rustc().input("link-weak-framework.rs").run();
cmd("otool")
.arg("-L")
.arg("link-weak-framework")
.run()
.assert_stdout_contains("CoreFoundation")
.assert_stdout_contains("weak");
// When linking the framework both normally, and weakly, the weak linking takes preference.
rustc().input("link-both.rs").run();
cmd("otool")
.arg("-L")
.arg("link-both")
.run()
.assert_stdout_contains("CoreFoundation")
.assert_stdout_contains("weak");
}