fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
5.1 KiB140 linesraw
1# ignore-cross-compile
2include ../tools.mk
3
4# ignore-musl
5# Objects are reproducible but their path is not.
6
7all:  \
8	smoke \
9	debug \
10	opt \
11	link_paths \
12	remap_paths \
13	different_source_dirs_rlib \
14	remap_cwd_rlib \
15	remap_cwd_to_empty \
16	extern_flags
17
18# TODO: Builds of `bin` crate types are not deterministic with debuginfo=2 on
19# Windows.
20# See: https://github.com/rust-lang/rust/pull/87320#issuecomment-920105533
21# Issue: https://github.com/rust-lang/rust/issues/88982
22#
23#	different_source_dirs_bin \
24#	remap_cwd_bin \
25
26smoke:
27	rm -rf $(TMPDIR) && mkdir $(TMPDIR)
28	$(RUSTC) linker.rs -O
29	$(RUSTC) reproducible-build-aux.rs
30	$(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker)
31	$(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker)
32	diff -u "$(TMPDIR)/linker-arguments1" "$(TMPDIR)/linker-arguments2"
33
34debug:
35	rm -rf $(TMPDIR) && mkdir $(TMPDIR)
36	$(RUSTC) linker.rs -O
37	$(RUSTC) reproducible-build-aux.rs -g
38	$(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) -g
39	$(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) -g
40	diff -u "$(TMPDIR)/linker-arguments1" "$(TMPDIR)/linker-arguments2"
41
42opt:
43	rm -rf $(TMPDIR) && mkdir $(TMPDIR)
44	$(RUSTC) linker.rs -O
45	$(RUSTC) reproducible-build-aux.rs -O
46	$(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) -O
47	$(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) -O
48	diff -u "$(TMPDIR)/linker-arguments1" "$(TMPDIR)/linker-arguments2"
49
50link_paths:
51	rm -rf $(TMPDIR) && mkdir $(TMPDIR)
52	$(RUSTC) reproducible-build-aux.rs
53	$(RUSTC) reproducible-build.rs --crate-type rlib -L /b
54	cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfoo.rlib
55	$(RUSTC) reproducible-build.rs --crate-type rlib -L /a
56	cmp "$(TMPDIR)/libreproducible_build.rlib" "$(TMPDIR)/libfoo.rlib" || exit 1
57
58remap_paths:
59	rm -rf $(TMPDIR) && mkdir $(TMPDIR)
60	$(RUSTC) reproducible-build-aux.rs
61	$(RUSTC) reproducible-build.rs --crate-type rlib --remap-path-prefix=/a=/c
62	cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfoo.rlib
63	$(RUSTC) reproducible-build.rs --crate-type rlib --remap-path-prefix=/b=/c
64	cmp "$(TMPDIR)/libreproducible_build.rlib" "$(TMPDIR)/libfoo.rlib" || exit 1
65
66different_source_dirs_bin:
67	rm -rf $(TMPDIR) && mkdir $(TMPDIR)
68	$(RUSTC) reproducible-build-aux.rs
69	mkdir $(TMPDIR)/test
70	cp reproducible-build.rs $(TMPDIR)/test
71	$(RUSTC) reproducible-build.rs --crate-type bin --remap-path-prefix=$$PWD=/b
72	cp $(TMPDIR)/reproducible-build $(TMPDIR)/foo
73	(cd $(TMPDIR)/test && $(RUSTC) reproducible-build.rs \
74		--remap-path-prefix=$(TMPDIR)/test=/b \
75		--crate-type bin)
76	cmp "$(TMPDIR)/reproducible-build" "$(TMPDIR)/foo" || exit 1
77
78different_source_dirs_rlib:
79	rm -rf $(TMPDIR) && mkdir $(TMPDIR)
80	$(RUSTC) reproducible-build-aux.rs
81	mkdir $(TMPDIR)/test
82	cp reproducible-build.rs $(TMPDIR)/test
83	$(RUSTC) reproducible-build.rs --crate-type rlib --remap-path-prefix=$$PWD=/b
84	cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfoo.rlib
85	(cd $(TMPDIR)/test && $(RUSTC) reproducible-build.rs \
86		--remap-path-prefix=$(TMPDIR)/test=/b \
87		--crate-type rlib)
88	cmp "$(TMPDIR)/libreproducible_build.rlib" "$(TMPDIR)/libfoo.rlib" || exit 1
89
90remap_cwd_bin:
91	rm -rf $(TMPDIR) && mkdir $(TMPDIR)
92	$(RUSTC) reproducible-build-aux.rs
93	mkdir $(TMPDIR)/test
94	cp reproducible-build.rs $(TMPDIR)/test
95	$(RUSTC) reproducible-build.rs --crate-type bin -C debuginfo=2 \
96	  -Z remap-cwd-prefix=.
97	cp $(TMPDIR)/reproducible-build $(TMPDIR)/first
98	(cd $(TMPDIR)/test && \
99	 $(RUSTC) reproducible-build.rs --crate-type bin -C debuginfo=2 \
100	   -Z remap-cwd-prefix=.)
101	cmp "$(TMPDIR)/first" "$(TMPDIR)/reproducible-build" || exit 1
102
103remap_cwd_rlib:
104	rm -rf $(TMPDIR) && mkdir $(TMPDIR)
105	$(RUSTC) reproducible-build-aux.rs
106	mkdir $(TMPDIR)/test
107	cp reproducible-build.rs $(TMPDIR)/test
108	$(RUSTC) reproducible-build.rs --crate-type rlib -C debuginfo=2 \
109	  -Z remap-cwd-prefix=.
110	cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfirst.rlib
111	(cd $(TMPDIR)/test && \
112	 $(RUSTC) reproducible-build.rs --crate-type rlib -C debuginfo=2 \
113	   -Z remap-cwd-prefix=.)
114	cmp "$(TMPDIR)/libfirst.rlib" "$(TMPDIR)/libreproducible_build.rlib" || exit 1
115
116remap_cwd_to_empty:
117	rm -rf $(TMPDIR) && mkdir $(TMPDIR)
118	$(RUSTC) reproducible-build-aux.rs
119	mkdir $(TMPDIR)/test
120	cp reproducible-build.rs $(TMPDIR)/test
121	$(RUSTC) reproducible-build.rs --crate-type rlib -C debuginfo=2 \
122	  -Z remap-cwd-prefix=
123	cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfirst.rlib
124	(cd $(TMPDIR)/test && \
125	 $(RUSTC) reproducible-build.rs --crate-type rlib -C debuginfo=2 \
126	   -Z remap-cwd-prefix=)
127	cmp "$(TMPDIR)/libfirst.rlib" "$(TMPDIR)/libreproducible_build.rlib" || exit 1
128
129extern_flags:
130	rm -rf $(TMPDIR) && mkdir $(TMPDIR)
131	$(RUSTC) reproducible-build-aux.rs
132	$(RUSTC) reproducible-build.rs \
133		--extern reproducible_build_aux=$(TMPDIR)/libreproducible_build_aux.rlib \
134		--crate-type rlib
135	cp $(TMPDIR)/libreproducible_build_aux.rlib $(TMPDIR)/libbar.rlib
136	cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfoo.rlib
137	$(RUSTC) reproducible-build.rs \
138		--extern reproducible_build_aux=$(TMPDIR)/libbar.rlib \
139		--crate-type rlib
140	cmp "$(TMPDIR)/libreproducible_build.rlib" "$(TMPDIR)/libfoo.rlib" || exit 1