From 45146978e8d593d5ec713f54140407d64f620800 Mon Sep 17 00:00:00 2001 From: Jeremy Fitzhardinge Date: Mon, 21 Jun 2021 17:10:46 -0700 Subject: [PATCH] Add test showing different KIND parameters change hash --- src/test/run-make/emit-path-unhashed/Makefile | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/test/run-make/emit-path-unhashed/Makefile b/src/test/run-make/emit-path-unhashed/Makefile index bd04b3aa423..b6b2d8af648 100644 --- a/src/test/run-make/emit-path-unhashed/Makefile +++ b/src/test/run-make/emit-path-unhashed/Makefile @@ -3,14 +3,20 @@ OUT=$(TMPDIR)/emit # --emit KIND=PATH should not affect crate hash vs --emit KIND -all: $(OUT)/a/libfoo.rlib $(OUT)/b/libfoo.rlib $(TMPDIR)/libfoo.rlib +all: $(OUT)/a/libfoo.rlib $(OUT)/b/libfoo.rlib $(OUT)/c/libfoo.rlib \ + $(TMPDIR)/libfoo.rlib $(RUSTC) -Zls $(TMPDIR)/libfoo.rlib > $(TMPDIR)/base.txt $(RUSTC) -Zls $(OUT)/a/libfoo.rlib > $(TMPDIR)/a.txt $(RUSTC) -Zls $(OUT)/b/libfoo.rlib > $(TMPDIR)/b.txt + $(RUSTC) -Zls $(OUT)/c/libfoo.rlib > $(TMPDIR)/c.txt diff $(TMPDIR)/base.txt $(TMPDIR)/a.txt diff $(TMPDIR)/base.txt $(TMPDIR)/b.txt + # Different KIND parameters do affect hash. + # diff exits 1 on difference, 2 on trouble + diff $(TMPDIR)/base.txt $(TMPDIR)/c.txt ; test "$$?" -eq 1 + # Default output name $(TMPDIR)/libfoo.rlib: foo.rs $(RUSTC) --emit link foo.rs @@ -24,3 +30,8 @@ $(OUT)/a/libfoo.rlib: foo.rs $(OUT)/b/libfoo.rlib: foo.rs mkdir -p $(OUT)/b $(RUSTC) --emit link=$@ foo.rs + +# Output multiple kinds +$(OUT)/c/libfoo.rlib: foo.rs + mkdir -p $(OUT)/c + $(RUSTC) --emit link=$@,metadata foo.rs