From a143d6d4674169f12402fae56a1fa4053436754c Mon Sep 17 00:00:00 2001 From: Tom Eccles Date: Sat, 9 Jan 2021 22:54:21 +0000 Subject: [PATCH 1/7] run-make: Specify --target to rustc Resolves #78911 The target's linker was used but rustc wasn't told to build for that target (instead defaulting to the host). This led to the host instead of the target getting tested and to the linker getting inappropriate arguments. --- src/test/run-make/incr-prev-body-beyond-eof/Makefile | 7 ++----- src/test/run-make/issue-36710/Makefile | 5 +---- .../run-make/issue-83112-incr-test-moved-file/Makefile | 7 ++----- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/test/run-make/incr-prev-body-beyond-eof/Makefile b/src/test/run-make/incr-prev-body-beyond-eof/Makefile index 49a7ee5f900fd..ae447e1bd9cda 100644 --- a/src/test/run-make/incr-prev-body-beyond-eof/Makefile +++ b/src/test/run-make/incr-prev-body-beyond-eof/Makefile @@ -1,8 +1,5 @@ include ../../run-make-fulldeps/tools.mk -# FIXME https://github.com/rust-lang/rust/issues/78911 -# ignore-32bit wrong/no cross compiler and sometimes we pass wrong gcc args (-m64) - # Tests that we don't ICE during incremental compilation after modifying a # function span such that its previous end line exceeds the number of lines # in the new file, but its start line/column and length remain the same. @@ -14,6 +11,6 @@ all: mkdir $(SRC) mkdir $(INCR) cp a.rs $(SRC)/main.rs - $(RUSTC) -C incremental=$(INCR) $(SRC)/main.rs + $(RUSTC) -C incremental=$(INCR) $(SRC)/main.rs --target $(TARGET) cp b.rs $(SRC)/main.rs - $(RUSTC) -C incremental=$(INCR) $(SRC)/main.rs + $(RUSTC) -C incremental=$(INCR) $(SRC)/main.rs --target $(TARGET) diff --git a/src/test/run-make/issue-36710/Makefile b/src/test/run-make/issue-36710/Makefile index b0e8451ff5d01..3d93b2f696129 100644 --- a/src/test/run-make/issue-36710/Makefile +++ b/src/test/run-make/issue-36710/Makefile @@ -1,13 +1,10 @@ include ../../run-make-fulldeps/tools.mk -# FIXME https://github.com/rust-lang/rust/issues/78911 -# ignore-32bit wrong/no cross compiler and sometimes we pass wrong gcc args (-m64) - all: foo $(call RUN,foo) foo: foo.rs $(call NATIVE_STATICLIB,foo) - $(RUSTC) $< -lfoo $(EXTRARSCXXFLAGS) + $(RUSTC) $< -lfoo $(EXTRARSCXXFLAGS) --target $(TARGET) $(TMPDIR)/libfoo.o: foo.cpp $(call COMPILE_OBJ_CXX,$@,$<) diff --git a/src/test/run-make/issue-83112-incr-test-moved-file/Makefile b/src/test/run-make/issue-83112-incr-test-moved-file/Makefile index 76ecaba0f6a0b..c89eebf374501 100644 --- a/src/test/run-make/issue-83112-incr-test-moved-file/Makefile +++ b/src/test/run-make/issue-83112-incr-test-moved-file/Makefile @@ -1,8 +1,5 @@ include ../../run-make-fulldeps/tools.mk -# FIXME https://github.com/rust-lang/rust/issues/78911 -# ignore-32bit wrong/no cross compiler and sometimes we pass wrong gcc args (-m64) - # Regression test for issue #83112 # The generated test harness code contains spans with a dummy location, # but a non-dummy SyntaxContext. Previously, the incremental cache was encoding @@ -20,6 +17,6 @@ all: mkdir $(SRC)/mydir mkdir $(INCR) cp main.rs $(SRC)/main.rs - $(RUSTC) --test -C incremental=$(INCR) $(SRC)/main.rs + $(RUSTC) --test -C incremental=$(INCR) $(SRC)/main.rs --target $(TARGET) mv $(SRC)/main.rs $(SRC)/mydir/main.rs - $(RUSTC) --test -C incremental=$(INCR) $(SRC)/mydir/main.rs + $(RUSTC) --test -C incremental=$(INCR) $(SRC)/mydir/main.rs --target $(TARGET) From d9dc5d83e239fa0e411d99264b0462e8e94b350a Mon Sep 17 00:00:00 2001 From: Tom Eccles Date: Mon, 11 Jan 2021 18:24:54 +0000 Subject: [PATCH 2/7] run-make: skip issue-36710 on riscv64 and armhf The test assumes it can run target binaries on the host. This not true for riscv64 CI (or for other platforms using remote-test-server). --- src/test/run-make/issue-36710/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/test/run-make/issue-36710/Makefile b/src/test/run-make/issue-36710/Makefile index 3d93b2f696129..fbb3ec97d5508 100644 --- a/src/test/run-make/issue-36710/Makefile +++ b/src/test/run-make/issue-36710/Makefile @@ -1,3 +1,7 @@ +# ignore-riscv64 $(call RUN,foo) expects to run the target executable natively +# so it won't work with remote-test-server +# ignore-arm Another build using remote-test-server + include ../../run-make-fulldeps/tools.mk all: foo From 8b40dd1f50db8ed3086ada80d42f9d834723ed58 Mon Sep 17 00:00:00 2001 From: Tom Eccles Date: Sat, 20 Feb 2021 19:31:28 +0000 Subject: [PATCH 3/7] ci: docker: riscv64gc: specify host explicitly --- src/ci/docker/host-x86_64/disabled/riscv64gc-linux/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ci/docker/host-x86_64/disabled/riscv64gc-linux/Dockerfile b/src/ci/docker/host-x86_64/disabled/riscv64gc-linux/Dockerfile index f3f52ed61d133..4377608700b0c 100644 --- a/src/ci/docker/host-x86_64/disabled/riscv64gc-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/disabled/riscv64gc-linux/Dockerfile @@ -98,6 +98,6 @@ COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh ENV RUST_CONFIGURE_ARGS --qemu-riscv64-rootfs=/tmp/rootfs -ENV SCRIPT python3 ../x.py --stage 2 test --target riscv64gc-unknown-linux-gnu +ENV SCRIPT python3 ../x.py --stage 2 test --host='' --target riscv64gc-unknown-linux-gnu ENV NO_CHANGE_USER=1 From b2a97ff415ca950e49448c3ad766246cf3a48443 Mon Sep 17 00:00:00 2001 From: Tom Eccles Date: Sun, 21 Feb 2021 11:19:50 +0000 Subject: [PATCH 4/7] bootstrap: don't run linkcheck when crosscompiling When we cross compile, some things (and their documentation) are built for the host (e.g. rustc), while others (and their documentation) are built for the target. This generated documentation will have broken links between documentation for different platforms e.g. between rustc and cargo. --- src/bootstrap/test.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 86d940cd733da..248c8a5f82b88 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -122,7 +122,21 @@ impl Step for Linkcheck { fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { let builder = run.builder; - run.path("src/tools/linkchecker").default_condition(builder.config.docs) + let run = run.path("src/tools/linkchecker"); + let hosts = &builder.hosts; + let targets = &builder.targets; + + // if we have different hosts and targets, some things may be built for + // the host (e.g. rustc) and others for the target (e.g. std). The + // documentation built for each will contain broken links to + // docs built for the other platform (e.g. rustc linking to cargo) + if (hosts != targets) && !hosts.is_empty() && !targets.is_empty() { + panic!( + "Linkcheck currently does not support builds with different hosts and targets. +You can skip linkcheck with --exclude src/tools/linkchecker" + ); + } + run.default_condition(builder.config.docs) } fn make_run(run: RunConfig<'_>) { From 980961e33052c3f838db3879bd9e0f284252bb2f Mon Sep 17 00:00:00 2001 From: Tom Eccles Date: Sun, 21 Feb 2021 19:32:16 +0000 Subject: [PATCH 5/7] ci: docker: x86_64: specify host explicitly --- src/ci/docker/host-x86_64/x86_64-gnu-llvm-10/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-10/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-10/Dockerfile index 0d32a9ec5eb84..c34198708c462 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-10/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-10/Dockerfile @@ -46,6 +46,7 @@ ENV SCRIPT python2.7 ../x.py --stage 2 test --exclude src/tools/tidy && \ # This is intended to make sure that both `--pass=check` continues to # work. # - python2.7 ../x.py --stage 2 test src/test/ui --pass=check --target=i686-unknown-linux-gnu && \ + python2.7 ../x.py --stage 2 test src/test/ui --pass=check \ + --host='' --target=i686-unknown-linux-gnu && \ # Run tidy at the very end, after all the other tests. python2.7 ../x.py --stage 2 test src/tools/tidy From e7505fb7454d946fd307b57e4cb0d45f8e50fdba Mon Sep 17 00:00:00 2001 From: Tom Eccles Date: Mon, 15 Mar 2021 18:00:14 +0000 Subject: [PATCH 6/7] test: run-make: flag tests which won't work in no-std environments --- src/test/run-make/incr-prev-body-beyond-eof/Makefile | 2 ++ src/test/run-make/issue-36710/Makefile | 1 + src/test/run-make/issue-83112-incr-test-moved-file/Makefile | 2 ++ 3 files changed, 5 insertions(+) diff --git a/src/test/run-make/incr-prev-body-beyond-eof/Makefile b/src/test/run-make/incr-prev-body-beyond-eof/Makefile index ae447e1bd9cda..c57ce9c53e7a0 100644 --- a/src/test/run-make/incr-prev-body-beyond-eof/Makefile +++ b/src/test/run-make/incr-prev-body-beyond-eof/Makefile @@ -1,3 +1,5 @@ +# ignore-none no-std is not supported + include ../../run-make-fulldeps/tools.mk # Tests that we don't ICE during incremental compilation after modifying a diff --git a/src/test/run-make/issue-36710/Makefile b/src/test/run-make/issue-36710/Makefile index fbb3ec97d5508..7014b763ae350 100644 --- a/src/test/run-make/issue-36710/Makefile +++ b/src/test/run-make/issue-36710/Makefile @@ -1,6 +1,7 @@ # ignore-riscv64 $(call RUN,foo) expects to run the target executable natively # so it won't work with remote-test-server # ignore-arm Another build using remote-test-server +# ignore-none no-std is not supported include ../../run-make-fulldeps/tools.mk diff --git a/src/test/run-make/issue-83112-incr-test-moved-file/Makefile b/src/test/run-make/issue-83112-incr-test-moved-file/Makefile index c89eebf374501..30bb259ef6db8 100644 --- a/src/test/run-make/issue-83112-incr-test-moved-file/Makefile +++ b/src/test/run-make/issue-83112-incr-test-moved-file/Makefile @@ -1,5 +1,7 @@ include ../../run-make-fulldeps/tools.mk +# ignore-none no-std is not supported + # Regression test for issue #83112 # The generated test harness code contains spans with a dummy location, # but a non-dummy SyntaxContext. Previously, the incremental cache was encoding From 1fa48cf181f1fe7e1aba133be199804c652fe55c Mon Sep 17 00:00:00 2001 From: Tom Eccles Date: Tue, 16 Mar 2021 18:22:21 +0000 Subject: [PATCH 7/7] test: run-make: skip tests on unsupported platforms The tests issue-36710 and incr-prev-body-beyond-eof were changed in a previous commit so that the correct target was passed to rustc (previously rustc was building for the host not for the specific target). Since that change it turns out that these platforms never worked (they only appeared to work because rustc was actually building for the host architecture). The wasm architectures fall over trying to build the C++ file in issue-36710. They look for clang (which isn't installed in the test-various docker container). If clang is installed, they can't find a wasm c++ standard library to link to. nvtptx64-nvidia-cuda fails in rustc saying it can't find std. The rust platforms support page says that std is supported on cuda so this is surprising. dist-i586-gnu-i586-i686-musl can't find the C++ compiler. There is only a musl-gcc and no musl-g++ in /musl-i586/bin/. The Docker image probably needs tweaking. --- src/test/run-make/incr-prev-body-beyond-eof/Makefile | 1 + src/test/run-make/issue-36710/Makefile | 5 +++++ src/test/run-make/issue-83112-incr-test-moved-file/Makefile | 1 + 3 files changed, 7 insertions(+) diff --git a/src/test/run-make/incr-prev-body-beyond-eof/Makefile b/src/test/run-make/incr-prev-body-beyond-eof/Makefile index c57ce9c53e7a0..24eea3acaeacd 100644 --- a/src/test/run-make/incr-prev-body-beyond-eof/Makefile +++ b/src/test/run-make/incr-prev-body-beyond-eof/Makefile @@ -1,4 +1,5 @@ # ignore-none no-std is not supported +# ignore-nvptx64-nvidia-cuda FIXME: can't find crate for `std` include ../../run-make-fulldeps/tools.mk diff --git a/src/test/run-make/issue-36710/Makefile b/src/test/run-make/issue-36710/Makefile index 7014b763ae350..b5270ad2ba9d4 100644 --- a/src/test/run-make/issue-36710/Makefile +++ b/src/test/run-make/issue-36710/Makefile @@ -2,6 +2,11 @@ # so it won't work with remote-test-server # ignore-arm Another build using remote-test-server # ignore-none no-std is not supported +# ignore-wasm32 FIXME: don't attempt to compile C++ to WASM +# ignore-wasm64 FIXME: don't attempt to compile C++ to WASM +# ignore-nvptx64-nvidia-cuda FIXME: can't find crate for `std` +# ignore-musl FIXME: this makefile needs teaching how to use a musl toolchain +# (see dist-i586-gnu-i586-i686-musl Dockerfile) include ../../run-make-fulldeps/tools.mk diff --git a/src/test/run-make/issue-83112-incr-test-moved-file/Makefile b/src/test/run-make/issue-83112-incr-test-moved-file/Makefile index 30bb259ef6db8..2f796e5b2fc07 100644 --- a/src/test/run-make/issue-83112-incr-test-moved-file/Makefile +++ b/src/test/run-make/issue-83112-incr-test-moved-file/Makefile @@ -1,6 +1,7 @@ include ../../run-make-fulldeps/tools.mk # ignore-none no-std is not supported +# ignore-nvptx64-nvidia-cuda FIXME: can't find crate for 'std' # Regression test for issue #83112 # The generated test harness code contains spans with a dummy location,