about summary refs log tree commit diff
path: root/tests/run-make
diff options
context:
space:
mode:
authorOneirical <manchot@videotron.ca>2024-06-14 16:45:52 -0400
committerOneirical <manchot@videotron.ca>2024-06-14 16:45:52 -0400
commit5f2b47fcb6aa06985686dc8dc23e33d96e430a12 (patch)
tree9caf5968add65ea05fdf9ac0e9fabe0141811c63 /tests/run-make
parent8ece5ce31958bd1acadfc2ac7fccc7ce25176b8d (diff)
downloadrust-5f2b47fcb6aa06985686dc8dc23e33d96e430a12.tar.gz
rust-5f2b47fcb6aa06985686dc8dc23e33d96e430a12.zip
rewrite native-link-modifier-verbatim-rustc to rmake
Diffstat (limited to 'tests/run-make')
-rw-r--r--tests/run-make/native-link-modifier-verbatim-rustc/Makefile12
-rw-r--r--tests/run-make/native-link-modifier-verbatim-rustc/rmake.rs44
2 files changed, 44 insertions, 12 deletions
diff --git a/tests/run-make/native-link-modifier-verbatim-rustc/Makefile b/tests/run-make/native-link-modifier-verbatim-rustc/Makefile
deleted file mode 100644
index dfd6ec50fc0..00000000000
--- a/tests/run-make/native-link-modifier-verbatim-rustc/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-include ../tools.mk
-
-all:
-	# Verbatim allows specify precise name.
-	$(RUSTC) upstream_native_dep.rs --crate-type=staticlib -o $(TMPDIR)/upstream_some_strange_name.ext
-	$(RUSTC) rust_dep.rs -l static:+verbatim=upstream_some_strange_name.ext --crate-type rlib
-
-	# With verbatim any other name cannot be used (upstream).
-	$(RUSTC) upstream_native_dep.rs --crate-type=staticlib -o $(TMPDIR)/libupstream_native_dep.a
-	$(RUSTC) upstream_native_dep.rs --crate-type=staticlib -o $(TMPDIR)/upstream_native_dep.a
-	$(RUSTC) upstream_native_dep.rs --crate-type=staticlib -o $(TMPDIR)/upstream_native_dep.lib
-	$(RUSTC) rust_dep.rs -l static:+verbatim=upstream_native_dep --crate-type rlib 2>&1 | $(CGREP) "upstream_native_dep"
diff --git a/tests/run-make/native-link-modifier-verbatim-rustc/rmake.rs b/tests/run-make/native-link-modifier-verbatim-rustc/rmake.rs
new file mode 100644
index 00000000000..58c7fef232c
--- /dev/null
+++ b/tests/run-make/native-link-modifier-verbatim-rustc/rmake.rs
@@ -0,0 +1,44 @@
+// `verbatim` is a native link modifier that forces rustc to only accept libraries with
+// a specified name. This test checks that this modifier works as intended.
+// See https://github.com/rust-lang/rust/issues/99425
+
+use run_make_support::rustc;
+
+fn main() {
+    // Verbatim allows for the specification of a precise name - in this case, the unconventional ".ext" extension.
+    rustc()
+        .input("upstream_native_dep.rs")
+        .crate_type("staticlib")
+        .output("upstream_some_strange_name.ext")
+        .run();
+    rustc()
+        .input("rust_dep.rs")
+        .crate_type("rlib")
+        .arg("-lstatic:+verbatim=upstream_some_strange_name.ext")
+        .run();
+
+    // This section voluntarily avoids using static_lib_name helpers to be verbatim.
+    // With verbatim, even these common library names are refused - it wants upstream_native_dep without
+    // any file extensions.
+    rustc()
+        .input("upstream_native_dep.rs")
+        .crate_type("staticlib")
+        .output("libupstream_native_dep.a")
+        .run();
+    rustc()
+        .input("upstream_native_dep.rs")
+        .crate_type("staticlib")
+        .output("upstream_native_dep.a")
+        .run();
+    rustc()
+        .input("upstream_native_dep.rs")
+        .crate_type("staticlib")
+        .output("upstream_native_dep.lib")
+        .run();
+    rustc()
+        .input("rust_dep.rs")
+        .crate_type("rlib")
+        .arg("-lstatic:+verbatim=upstream_native_dep")
+        .run_fail()
+        .assert_stderr_contains("upstream_native_dep");
+}