summaryrefslogtreecommitdiffstats
path: root/tests/run-make/emit-to-stdout/Makefile
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
commitdc0db358abe19481e475e10c32149b53370f1a1c (patch)
treeab8ce99c4b255ce46f99ef402c27916055b899ee /tests/run-make/emit-to-stdout/Makefile
parentReleasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff)
downloadrustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz
rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--tests/run-make/emit-to-stdout/Makefile51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/run-make/emit-to-stdout/Makefile b/tests/run-make/emit-to-stdout/Makefile
new file mode 100644
index 000000000..80e9b6a4d
--- /dev/null
+++ b/tests/run-make/emit-to-stdout/Makefile
@@ -0,0 +1,51 @@
+include ../tools.mk
+
+SRC=test.rs
+OUT=$(TMPDIR)/out
+
+all: asm llvm-ir dep-info mir llvm-bc obj metadata link multiple-types multiple-types-option-o
+
+asm: $(OUT)
+ $(RUSTC) --emit asm=$(OUT)/$@ $(SRC)
+ $(RUSTC) --emit asm=- $(SRC) | diff - $(OUT)/$@
+llvm-ir: $(OUT)
+ $(RUSTC) --emit llvm-ir=$(OUT)/$@ $(SRC)
+ $(RUSTC) --emit llvm-ir=- $(SRC) | diff - $(OUT)/$@
+dep-info: $(OUT)
+ $(RUSTC) -Z dep-info-omit-d-target=yes --emit dep-info=$(OUT)/$@ $(SRC)
+ $(RUSTC) --emit dep-info=- $(SRC) | diff - $(OUT)/$@
+mir: $(OUT)
+ $(RUSTC) --emit mir=$(OUT)/$@ $(SRC)
+ $(RUSTC) --emit mir=- $(SRC) | diff - $(OUT)/$@
+
+llvm-bc: $(OUT)
+ $(RUSTC) --emit llvm-bc=- $(SRC) 1>/dev/ptmx 2>$(OUT)/$@ || true
+ diff $(OUT)/$@ emit-llvm-bc.stderr
+obj: $(OUT)
+ $(RUSTC) --emit obj=- $(SRC) 1>/dev/ptmx 2>$(OUT)/$@ || true
+ diff $(OUT)/$@ emit-obj.stderr
+
+# For metadata output, a temporary directory will be created to hold the temporary
+# metadata file. But when output is stdout, the temporary directory will be located
+# in the same place as $(SRC), which is mounted as read-only in the tests. Thus as
+# a workaround, $(SRC) is copied to the test output directory $(OUT) and we compile
+# it there.
+metadata: $(OUT)
+ cp $(SRC) $(OUT)
+ (cd $(OUT); $(RUSTC) --emit metadata=- $(SRC) 1>/dev/ptmx 2>$(OUT)/$@ || true)
+ diff $(OUT)/$@ emit-metadata.stderr
+
+link: $(OUT)
+ $(RUSTC) --emit link=- $(SRC) 1>/dev/ptmx 2>$(OUT)/$@ || true
+ diff $(OUT)/$@ emit-link.stderr
+
+multiple-types: $(OUT)
+ $(RUSTC) --emit asm=- --emit llvm-ir=- --emit dep-info=- --emit mir=- $(SRC) 2>$(OUT)/$@ || true
+ diff $(OUT)/$@ emit-multiple-types.stderr
+
+multiple-types-option-o: $(OUT)
+ $(RUSTC) -o - --emit asm,llvm-ir,dep-info,mir $(SRC) 2>$(OUT)/$@ || true
+ diff $(OUT)/$@ emit-multiple-types.stderr
+
+$(OUT):
+ mkdir -p $(OUT)