about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOneirical <manchot@videotron.ca>2024-06-26 15:14:13 -0400
committerOneirical <manchot@videotron.ca>2024-06-28 16:44:50 -0400
commit11ac258a5f5af5fe00cc68a598414a48661a28ce (patch)
tree31fe46c1983e4403a9b52844f62f45f205a33b3f
parent16df91b97ad1df021ccd2203c974f416aae7e76b (diff)
downloadrust-11ac258a5f5af5fe00cc68a598414a48661a28ce.tar.gz
rust-11ac258a5f5af5fe00cc68a598414a48661a28ce.zip
rewrite silly-file-names to rmake
-rw-r--r--src/tools/tidy/src/allowed_run_make_makefiles.txt1
-rw-r--r--tests/run-make/silly-file-names/Makefile12
-rw-r--r--tests/run-make/silly-file-names/rmake.rs24
3 files changed, 24 insertions, 13 deletions
diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt
index 463edb461e8..b23a6cb85c0 100644
--- a/src/tools/tidy/src/allowed_run_make_makefiles.txt
+++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt
@@ -162,7 +162,6 @@ run-make/sepcomp-cci-copies/Makefile
 run-make/sepcomp-inlining/Makefile
 run-make/sepcomp-separate/Makefile
 run-make/share-generics-dylib/Makefile
-run-make/silly-file-names/Makefile
 run-make/simd-ffi/Makefile
 run-make/split-debuginfo/Makefile
 run-make/stable-symbol-names/Makefile
diff --git a/tests/run-make/silly-file-names/Makefile b/tests/run-make/silly-file-names/Makefile
deleted file mode 100644
index e51266c0880..00000000000
--- a/tests/run-make/silly-file-names/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-# ignore-cross-compile we need to execute the binary
-# ignore-windows we create files with < and > in their names
-
-include ../tools.mk
-
-all:
-	echo '"comes from a file with a name that begins with <"' > "$(TMPDIR)/<leading-lt"
-	echo '"comes from a file with a name that ends with >"' > "$(TMPDIR)/trailing-gt>"
-	cp silly-file-names.rs "$(TMPDIR)/silly-file-names.rs"
-	$(RUSTC) "$(TMPDIR)/silly-file-names.rs" -o "$(TMPDIR)/silly-file-names"
-	"$(TMPDIR)/silly-file-names" > "$(TMPDIR)/silly-file-names.run.stdout"
-	$(RUSTC_TEST_OP) "$(TMPDIR)/silly-file-names.run.stdout" silly-file-names.run.stdout
diff --git a/tests/run-make/silly-file-names/rmake.rs b/tests/run-make/silly-file-names/rmake.rs
new file mode 100644
index 00000000000..9df116146fe
--- /dev/null
+++ b/tests/run-make/silly-file-names/rmake.rs
@@ -0,0 +1,24 @@
+// There used to be assert! checks in the compiler to error on encountering
+// files starting or ending with < or > respectively, as a preventive measure
+// against "fake" files like <anon>. However, this was not truly required,
+// as rustc has other checks to verify the veracity of a file. This test includes
+// some files with < and > in their names and prints out their output to stdout,
+// expecting no errors.
+// See https://github.com/rust-lang/rust/issues/73419
+
+//@ ignore-cross-compile
+// Reason: the compiled binary is executed
+//@ ignore-windows
+// Reason: Windows refuses files with < and > in their names
+
+use run_make_support::{diff, fs_wrapper, run, rustc};
+
+fn main() {
+    fs_wrapper::create_file("<leading-lt");
+    fs_wrapper::write("<leading-lt", r#""comes from a file with a name that begins with <""#);
+    fs_wrapper::create_file("trailing-gt>");
+    fs_wrapper::write("trailing-gt>", r#""comes from a file with a name that ends with >""#);
+    rustc().input("silly-file-names.rs").output("silly-file-names").run();
+    let out = run("silly-file-names").stdout_utf8();
+    diff().expected_file("silly-file-names.run.stdout").actual_text("actual-stdout", out).run();
+}