3 # rust-lang/rust#70924: Test that if we add rust-src component in between two
4 # incremental compiles, the compiler does not ICE on the second.
6 # This test uses `ln -s` rather than copying to save testing time, but its
7 # usage doesn't work on windows. So ignore windows.
11 SYSROOT:=$(shell $(RUSTC) --print sysroot)
12 FAKEROOT=$(TMPDIR)/fakeroot
15 # Make a local copy of the sysroot; then remove the rust-src part of it, if
16 # present, for the *first* build. Then put in a facsimile of the rust-src
17 # component for the second build, in order to expose the ICE from issue #70924.
19 # Note that it is much easier to just do `cp -a $(SYSROOT)/* $(FAKEROOT)` as a
20 # first step, but I am concerned that would be too expensive in a unit test
21 # compared to making symbolic links.
23 # Anyway, the pattern you'll see here is: For every prefix in
24 # root/lib/rustlib/src, link all of prefix parent content, then remove the
25 # prefix, then loop on the next prefix. This way, we basically create a copy of
26 # the context around root/lib/rustlib/src, and can freely add/remove the src
30 ln -s $(SYSROOT)/* $(FAKEROOT)
33 ln -s $(SYSROOT)/lib/* $(FAKEROOT)/lib
34 rm -f $(FAKEROOT)/lib/rustlib
35 mkdir $(FAKEROOT)/lib/rustlib
36 ln -s $(SYSROOT)/lib/rustlib/* $(FAKEROOT)/lib/rustlib
37 rm -f $(FAKEROOT)/lib/rustlib/src
38 mkdir $(FAKEROOT)/lib/rustlib/src
39 ln -s $(SYSROOT)/lib/rustlib/src/* $(FAKEROOT)/lib/rustlib/src
40 rm -f $(FAKEROOT)/lib/rustlib/src/rust
41 $(RUSTC) --sysroot $(FAKEROOT) -C incremental=$(INCR) main.rs
42 mkdir -p $(FAKEROOT)/lib/rustlib/src/rust/src/libstd
43 touch $(FAKEROOT)/lib/rustlib/src/rust/src/libstd/lib.rs
44 $(RUSTC) --sysroot $(FAKEROOT) -C incremental=$(INCR) main.rs