about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOneirical <manchot@videotron.ca>2024-06-25 14:45:49 -0400
committerOneirical <manchot@videotron.ca>2024-06-25 14:45:49 -0400
commitfe2406bcef7d0c51a39537283c7c151c8a2da238 (patch)
tree4e0a032e89ec849b9aa5f62abcff6d726ceb6cd9
parent6ba0a84df9172ea01f3c3661b4d8364e5a79ba69 (diff)
downloadrust-fe2406bcef7d0c51a39537283c7c151c8a2da238.tar.gz
rust-fe2406bcef7d0c51a39537283c7c151c8a2da238.zip
rewrite invalid-so to rmake
-rw-r--r--src/tools/tidy/src/allowed_run_make_makefiles.txt1
-rw-r--r--tests/run-make/invalid-so/Makefile7
-rw-r--r--tests/run-make/invalid-so/rmake.rs17
3 files changed, 17 insertions, 8 deletions
diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt
index 7c882d3ce15..560fd5c586e 100644
--- a/src/tools/tidy/src/allowed_run_make_makefiles.txt
+++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt
@@ -55,7 +55,6 @@ run-make/incr-foreign-head-span/Makefile
 run-make/interdependent-c-libraries/Makefile
 run-make/intrinsic-unreachable/Makefile
 run-make/invalid-library/Makefile
-run-make/invalid-so/Makefile
 run-make/issue-107094/Makefile
 run-make/issue-109934-lto-debuginfo/Makefile
 run-make/issue-14698/Makefile
diff --git a/tests/run-make/invalid-so/Makefile b/tests/run-make/invalid-so/Makefile
deleted file mode 100644
index e36c7040bc6..00000000000
--- a/tests/run-make/invalid-so/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-include ../tools.mk
-
-DYLIB_NAME := $(shell echo | $(RUSTC) --crate-name foo --crate-type dylib --print file-names -)
-
-all:
-	echo >> $(TMPDIR)/$(DYLIB_NAME)
-	$(RUSTC) --crate-type lib --extern foo=$(TMPDIR)/$(DYLIB_NAME) bar.rs 2>&1 | $(CGREP) 'invalid metadata files for crate `foo`'
diff --git a/tests/run-make/invalid-so/rmake.rs b/tests/run-make/invalid-so/rmake.rs
new file mode 100644
index 00000000000..5cfda05334e
--- /dev/null
+++ b/tests/run-make/invalid-so/rmake.rs
@@ -0,0 +1,17 @@
+// When a fake library was given to the compiler, it would
+// result in an obscure and unhelpful error message. This test
+// creates a false "foo" dylib, and checks that the standard error
+// explains that the file exists, but that its metadata is incorrect.
+// See https://github.com/rust-lang/rust/pull/88368
+
+use run_make_support::{dynamic_lib_name, fs_wrapper, rustc};
+
+fn main() {
+    fs_wrapper::create_file(dynamic_lib_name("foo"));
+    rustc()
+        .crate_type("lib")
+        .extern_("foo", dynamic_lib_name("foo"))
+        .input("bar.rs")
+        .run_fail()
+        .assert_stderr_contains("invalid metadata files for crate `foo`");
+}