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