about summary refs log tree commit diff
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2024-06-11 14:16:45 +0100
committerGitHub <noreply@github.com>2024-06-11 14:16:45 +0100
commitdea5237c0e8c8c08f3041bfdb81bf23541d41ecb (patch)
tree09c47a7c543033c5831c76a0042ff34d058b70f2
parent6a207f4ff28b76147514cfd6acea86db3d148e42 (diff)
parente8b04cc95fe1412e2ef369397a60f0667e99880f (diff)
downloadrust-dea5237c0e8c8c08f3041bfdb81bf23541d41ecb.tar.gz
rust-dea5237c0e8c8c08f3041bfdb81bf23541d41ecb.zip
Rollup merge of #126186 - GuillaumeGomez:migrate-run-make-multiple-emits, r=jieyouxu
Migrate `run-make/multiple-emits` to `rmake.rs`

Part of https://github.com/rust-lang/rust/issues/121876.

r? `@jieyouxu`
-rw-r--r--src/tools/run-make-support/src/lib.rs5
-rw-r--r--src/tools/tidy/src/allowed_run_make_makefiles.txt1
-rw-r--r--tests/run-make/multiple-emits/Makefile7
-rw-r--r--tests/run-make/multiple-emits/rmake.rs13
4 files changed, 18 insertions, 8 deletions
diff --git a/src/tools/run-make-support/src/lib.rs b/src/tools/run-make-support/src/lib.rs
index cea1313e29d..960f4bcd254 100644
--- a/src/tools/run-make-support/src/lib.rs
+++ b/src/tools/run-make-support/src/lib.rs
@@ -76,6 +76,11 @@ pub fn htmldocck() -> Command {
     python
 }
 
+/// Returns the path for a local test file.
+pub fn path<P: AsRef<Path>>(p: P) -> PathBuf {
+    cwd().join(p.as_ref())
+}
+
 /// Path to the root rust-lang/rust source checkout.
 pub fn source_root() -> PathBuf {
     env_var("SOURCE_ROOT").into()
diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt
index babf1abbe64..b07e012a1b8 100644
--- a/src/tools/tidy/src/allowed_run_make_makefiles.txt
+++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt
@@ -144,7 +144,6 @@ run-make/mismatching-target-triples/Makefile
 run-make/missing-crate-dependency/Makefile
 run-make/mixing-libs/Makefile
 run-make/msvc-opt-minsize/Makefile
-run-make/multiple-emits/Makefile
 run-make/native-link-modifier-bundle/Makefile
 run-make/native-link-modifier-verbatim-linker/Makefile
 run-make/native-link-modifier-verbatim-rustc/Makefile
diff --git a/tests/run-make/multiple-emits/Makefile b/tests/run-make/multiple-emits/Makefile
deleted file mode 100644
index d1f29764485..00000000000
--- a/tests/run-make/multiple-emits/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-include ../tools.mk
-
-all:
-	$(RUSTC) foo.rs --emit=asm,llvm-ir -o $(TMPDIR)/out 2>&1
-	rm $(TMPDIR)/out.ll $(TMPDIR)/out.s
-	$(RUSTC) foo.rs --emit=asm,llvm-ir -o $(TMPDIR)/out2.ext 2>&1
-	rm $(TMPDIR)/out2.ll $(TMPDIR)/out2.s
diff --git a/tests/run-make/multiple-emits/rmake.rs b/tests/run-make/multiple-emits/rmake.rs
new file mode 100644
index 00000000000..67c0ebb9864
--- /dev/null
+++ b/tests/run-make/multiple-emits/rmake.rs
@@ -0,0 +1,13 @@
+use run_make_support::{cwd, path, rustc};
+
+fn main() {
+    rustc().input("foo.rs").emit("asm,llvm-ir").output("out").run();
+
+    assert!(path("out.ll").is_file());
+    assert!(path("out.s").is_file());
+
+    rustc().input("foo.rs").emit("asm,llvm-ir").output("out2.ext").run();
+
+    assert!(path("out2.ll").is_file());
+    assert!(path("out2.s").is_file());
+}