about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2024-06-01 10:29:45 +0200
committerGuillaume Gomez <guillaume.gomez@huawei.com>2024-06-01 10:29:45 +0200
commit190a96f9d347363ac9e3d3ac3d3821cf35e3b0a9 (patch)
treefe332ebbb7cd88961e6d7dba2e41ec7c5f9b94aa
parentdcc9a8f2831a9afd2896e3fe2cc020bb2bf949bd (diff)
downloadrust-190a96f9d347363ac9e3d3ac3d3821cf35e3b0a9.tar.gz
rust-190a96f9d347363ac9e3d3ac3d3821cf35e3b0a9.zip
Migrate `run-make/emit-named-files` to `rmake.rs`
-rw-r--r--src/tools/tidy/src/allowed_run_make_makefiles.txt1
-rw-r--r--tests/run-make/emit-named-files/Makefile33
-rw-r--r--tests/run-make/emit-named-files/rmake.rs25
3 files changed, 25 insertions, 34 deletions
diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt
index 009200aca15..95fc30cb775 100644
--- a/src/tools/tidy/src/allowed_run_make_makefiles.txt
+++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt
@@ -38,7 +38,6 @@ run-make/dump-ice-to-disk/Makefile
 run-make/dump-mono-stats/Makefile
 run-make/duplicate-output-flavors/Makefile
 run-make/dylib-chain/Makefile
-run-make/emit-named-files/Makefile
 run-make/emit-path-unhashed/Makefile
 run-make/emit-shared-files/Makefile
 run-make/emit-stack-sizes/Makefile
diff --git a/tests/run-make/emit-named-files/Makefile b/tests/run-make/emit-named-files/Makefile
deleted file mode 100644
index 2b97b841fc0..00000000000
--- a/tests/run-make/emit-named-files/Makefile
+++ /dev/null
@@ -1,33 +0,0 @@
-include ../tools.mk
-
-OUT=$(TMPDIR)/emit
-
-all: asm llvm-bc llvm-ir obj metadata link dep-info mir
-
-asm: $(OUT)
-	$(RUSTC) --emit asm=$(OUT)/libfoo.s foo.rs
-	test -f $(OUT)/libfoo.s
-llvm-bc: $(OUT)
-	$(RUSTC) --emit llvm-bc=$(OUT)/libfoo.bc foo.rs
-	test -f $(OUT)/libfoo.bc
-llvm-ir: $(OUT)
-	$(RUSTC) --emit llvm-ir=$(OUT)/libfoo.ll foo.rs
-	test -f $(OUT)/libfoo.ll
-obj: $(OUT)
-	$(RUSTC) --emit obj=$(OUT)/libfoo.o foo.rs
-	test -f $(OUT)/libfoo.o
-metadata: $(OUT)
-	$(RUSTC) --emit metadata=$(OUT)/libfoo.rmeta foo.rs
-	test -f $(OUT)/libfoo.rmeta
-link: $(OUT)
-	$(RUSTC) --emit link=$(OUT)/libfoo.rlib foo.rs
-	test -f $(OUT)/libfoo.rlib
-dep-info: $(OUT)
-	$(RUSTC) --emit dep-info=$(OUT)/libfoo.d foo.rs
-	test -f $(OUT)/libfoo.d
-mir: $(OUT)
-	$(RUSTC) --emit mir=$(OUT)/libfoo.mir foo.rs
-	test -f $(OUT)/libfoo.mir
-
-$(OUT):
-	mkdir -p $(OUT)
diff --git a/tests/run-make/emit-named-files/rmake.rs b/tests/run-make/emit-named-files/rmake.rs
new file mode 100644
index 00000000000..068f9796d0e
--- /dev/null
+++ b/tests/run-make/emit-named-files/rmake.rs
@@ -0,0 +1,25 @@
+use std::fs::create_dir;
+use std::path::Path;
+
+use run_make_support::{rustc, tmp_dir};
+
+fn emit_and_check(out_dir: &Path, out_file: &str, format: &str) {
+    let out_file = out_dir.join(out_file);
+    rustc().input("foo.rs").emit(&format!("{format}={}", out_file.display())).run();
+    assert!(out_file.is_file());
+}
+
+fn main() {
+    let out_dir = tmp_dir().join("emit");
+
+    create_dir(&out_dir).unwrap();
+
+    emit_and_check(&out_dir, "libfoo.s", "asm");
+    emit_and_check(&out_dir, "libfoo.bc", "llvm-bc");
+    emit_and_check(&out_dir, "libfoo.ll", "llvm-ir");
+    emit_and_check(&out_dir, "libfoo.o", "obj");
+    emit_and_check(&out_dir, "libfoo.rmeta", "metadata");
+    emit_and_check(&out_dir, "libfoo.rlib", "link");
+    emit_and_check(&out_dir, "libfoo.d", "dep-info");
+    emit_and_check(&out_dir, "libfoo.mir", "mir");
+}