about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2024-06-24 11:57:52 +0200
committerGuillaume Gomez <guillaume.gomez@huawei.com>2024-07-22 23:21:59 +0200
commite8e6111f869e834bf224c9c01fdf430cbd7da924 (patch)
treede37085e189f19cbffa5c420a2901c6c5f2ef2a4
parentae7b1c191695f351e69ef7ad32c0897048bba73e (diff)
downloadrust-e8e6111f869e834bf224c9c01fdf430cbd7da924.tar.gz
rust-e8e6111f869e834bf224c9c01fdf430cbd7da924.zip
Migrate `run-make/link-framework` to `rmake.rs`
-rw-r--r--src/tools/tidy/src/allowed_run_make_makefiles.txt1
-rw-r--r--tests/run-make/link-framework/Makefile23
-rw-r--r--tests/run-make/link-framework/rmake.rs38
3 files changed, 38 insertions, 24 deletions
diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt
index 1cb52ea91f9..acda41a0cdf 100644
--- a/src/tools/tidy/src/allowed_run_make_makefiles.txt
+++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt
@@ -46,7 +46,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
diff --git a/tests/run-make/link-framework/Makefile b/tests/run-make/link-framework/Makefile
deleted file mode 100644
index 96d832ad4a8..00000000000
--- a/tests/run-make/link-framework/Makefile
+++ /dev/null
@@ -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
diff --git a/tests/run-make/link-framework/rmake.rs b/tests/run-make/link-framework/rmake.rs
new file mode 100644
index 00000000000..e5df93b181a
--- /dev/null
+++ b/tests/run-make/link-framework/rmake.rs
@@ -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");
+}