about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOneirical <manchot@videotron.ca>2024-05-28 15:54:09 -0400
committerOneirical <manchot@videotron.ca>2024-06-04 15:27:13 -0400
commit59e2074c79aaea17ed1b4e16081983e5f03c6bd2 (patch)
tree5b3843f9f283c69dc81bfd9389f299a58ada50d4
parentd553d5ba2d77feb67fde6649c03e8d1c486eb278 (diff)
downloadrust-59e2074c79aaea17ed1b4e16081983e5f03c6bd2.tar.gz
rust-59e2074c79aaea17ed1b4e16081983e5f03c6bd2.zip
rewrite suspicious-library in rmake
-rw-r--r--src/tools/compiletest/src/header.rs1
-rw-r--r--src/tools/tidy/src/allowed_run_make_makefiles.txt1
-rw-r--r--tests/run-make/incr-prev-body-beyond-eof/rmake.rs31
-rw-r--r--tests/run-make/resolve-rename/rmake.rs3
-rw-r--r--tests/run-make/suspicious-library/Makefile8
-rw-r--r--tests/run-make/suspicious-library/rmake.rs14
6 files changed, 30 insertions, 28 deletions
diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs
index c7c807d3e68..a8c2962f779 100644
--- a/src/tools/compiletest/src/header.rs
+++ b/src/tools/compiletest/src/header.rs
@@ -798,6 +798,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
     "ignore-none",
     "ignore-nto",
     "ignore-nvptx64",
+    "ignore-nvptx64-nvidia-cuda",
     "ignore-openbsd",
     "ignore-pass",
     "ignore-remote",
diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt
index 4e69d67057a..252ce2c6538 100644
--- a/src/tools/tidy/src/allowed_run_make_makefiles.txt
+++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt
@@ -246,7 +246,6 @@ run-make/static-pie/Makefile
 run-make/staticlib-blank-lib/Makefile
 run-make/staticlib-dylib-linkage/Makefile
 run-make/std-core-cycle/Makefile
-run-make/suspicious-library/Makefile
 run-make/symbol-mangling-hashed/Makefile
 run-make/symbol-visibility/Makefile
 run-make/symbols-include-type-name/Makefile
diff --git a/tests/run-make/incr-prev-body-beyond-eof/rmake.rs b/tests/run-make/incr-prev-body-beyond-eof/rmake.rs
index 43f137fea20..8aa3893727f 100644
--- a/tests/run-make/incr-prev-body-beyond-eof/rmake.rs
+++ b/tests/run-make/incr-prev-body-beyond-eof/rmake.rs
@@ -7,26 +7,21 @@
 // was hashed by rustc in addition to the span length, and the fix still
 // works.
 
-// FIXME: Ignore flags temporarily disabled for the test.
-// ignore-none
-// ignore-nvptx64-nvidia-cuda
+//@ ignore-none
+// reason: no-std is not supported
 
-use run_make_support::{rustc, target, tmp_dir};
+//@ ignore-nvptx64-nvidia-cuda
+// FIXME: can't find crate for `std`
+
+use run_make_support::{rustc, tmp_dir};
 use std::fs;
 
 fn main() {
-    fs::create_dir(tmp_dir().join("src"));
-    fs::create_dir(tmp_dir().join("incr"));
-    fs::copy("a.rs", tmp_dir().join("main.rs"));
-    rustc()
-        .incremental(tmp_dir().join("incr"))
-        .input(tmp_dir().join("src/main.rs"))
-        .target(target())
-        .run();
-    fs::copy("b.rs", tmp_dir().join("main.rs"));
-    rustc()
-        .incremental(tmp_dir().join("incr"))
-        .input(tmp_dir().join("src/main.rs"))
-        .target(target())
-        .run();
+    // FIXME(Oneirical): Use run_make_support::fs_wrapper here.
+    fs::create_dir(tmp_dir().join("src")).unwrap();
+    fs::create_dir(tmp_dir().join("incr")).unwrap();
+    fs::copy("a.rs", tmp_dir().join("src/main.rs")).unwrap();
+    rustc().incremental(tmp_dir().join("incr")).input(tmp_dir().join("src/main.rs")).run();
+    fs::copy("b.rs", tmp_dir().join("src/main.rs")).unwrap();
+    rustc().incremental(tmp_dir().join("incr")).input(tmp_dir().join("src/main.rs")).run();
 }
diff --git a/tests/run-make/resolve-rename/rmake.rs b/tests/run-make/resolve-rename/rmake.rs
index 7539d367758..8c6e3c24714 100644
--- a/tests/run-make/resolve-rename/rmake.rs
+++ b/tests/run-make/resolve-rename/rmake.rs
@@ -10,6 +10,7 @@ use std::fs;
 fn main() {
     rustc().extra_filename("-hash").input("foo.rs").run();
     rustc().input("bar.rs").run();
-    fs::rename(tmp_dir().join("libfoo-hash.rlib"), tmp_dir().join("libfoo-another-hash.rlib"));
+    fs::rename(tmp_dir().join("libfoo-hash.rlib"), tmp_dir().join("libfoo-another-hash.rlib"))
+        .unwrap();
     rustc().input("baz.rs").run();
 }
diff --git a/tests/run-make/suspicious-library/Makefile b/tests/run-make/suspicious-library/Makefile
deleted file mode 100644
index 3b5ab3c53a5..00000000000
--- a/tests/run-make/suspicious-library/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-# ignore-cross-compile
-include ../tools.mk
-
-all:
-	$(RUSTC) foo.rs -C prefer-dynamic
-	touch $(call DYLIB,foo-something-special)
-	touch $(call DYLIB,foo-something-special2)
-	$(RUSTC) bar.rs
diff --git a/tests/run-make/suspicious-library/rmake.rs b/tests/run-make/suspicious-library/rmake.rs
new file mode 100644
index 00000000000..9e91de70bfc
--- /dev/null
+++ b/tests/run-make/suspicious-library/rmake.rs
@@ -0,0 +1,14 @@
+// This test creates some fake dynamic libraries with nothing inside,
+// and checks if rustc avoids them and successfully compiles as a result.
+
+//@ ignore-cross-compile
+
+use run_make_support::{dynamic_lib, rustc};
+use std::fs::File;
+
+fn main() {
+    rustc().input("foo.rs").arg("-Cprefer-dynamic").run();
+    File::create(dynamic_lib("foo-something-special")).unwrap();
+    File::create(dynamic_lib("foo-something-special2")).unwrap();
+    rustc().input("bar.rs").run();
+}