Skip to content

Commit 2917eda

Browse files
committed
Auto merge of #80839 - tblah:riscv64linux_links, r=Mark-Simulacrum
Riscv64linux Test fixes Get tests passing again using the riscv64gc-unknown-linux-gnu docker image. Test with ``` src/ci/docker/run.sh riscv64gc-linux ``` ## linkcheck Linkcheck tests that interdocument links in the documentation are correct. Some interdocument links go between rustc and tools (such as rustdoc and cargo). When cross compiling, rustc is built for the host while some tools are built for the target. This goes for the documentation too. Because of this, links in the rustc documentation reffering to cargo or rustdoc documentation look broken. This issue is worked around by disabling linkcheck for cross compilation builds. ## run-make tests #78911 seems to happen because `--target` was not passed to `rustc`, but the target linker was specified, causing the target linker to be called with options intended for the host. Resolves #78911 In a separate issue, `issue-36710` was trying to run a binary built for the target on the host system. This will not work for any platform using `remote-test-server`/`client` (such as riscv64). I don't know of a way of skipping those platforms specifically, so I set this test to skip only on riscv64 for now.
2 parents 7750402 + 1fa48cf commit 2917eda

File tree

6 files changed

+38
-16
lines changed

6 files changed

+38
-16
lines changed

src/bootstrap/test.rs

+15-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,21 @@ impl Step for Linkcheck {
122122

123123
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
124124
let builder = run.builder;
125-
run.path("src/tools/linkchecker").default_condition(builder.config.docs)
125+
let run = run.path("src/tools/linkchecker");
126+
let hosts = &builder.hosts;
127+
let targets = &builder.targets;
128+
129+
// if we have different hosts and targets, some things may be built for
130+
// the host (e.g. rustc) and others for the target (e.g. std). The
131+
// documentation built for each will contain broken links to
132+
// docs built for the other platform (e.g. rustc linking to cargo)
133+
if (hosts != targets) && !hosts.is_empty() && !targets.is_empty() {
134+
panic!(
135+
"Linkcheck currently does not support builds with different hosts and targets.
136+
You can skip linkcheck with --exclude src/tools/linkchecker"
137+
);
138+
}
139+
run.default_condition(builder.config.docs)
126140
}
127141

128142
fn make_run(run: RunConfig<'_>) {

src/ci/docker/host-x86_64/disabled/riscv64gc-linux/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,6 @@ COPY scripts/sccache.sh /scripts/
9898
RUN sh /scripts/sccache.sh
9999

100100
ENV RUST_CONFIGURE_ARGS --qemu-riscv64-rootfs=/tmp/rootfs
101-
ENV SCRIPT python3 ../x.py --stage 2 test --target riscv64gc-unknown-linux-gnu
101+
ENV SCRIPT python3 ../x.py --stage 2 test --host='' --target riscv64gc-unknown-linux-gnu
102102

103103
ENV NO_CHANGE_USER=1

src/ci/docker/host-x86_64/x86_64-gnu-llvm-10/Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ ENV SCRIPT python2.7 ../x.py --stage 2 test --exclude src/tools/tidy && \
4646
# This is intended to make sure that both `--pass=check` continues to
4747
# work.
4848
#
49-
python2.7 ../x.py --stage 2 test src/test/ui --pass=check --target=i686-unknown-linux-gnu && \
49+
python2.7 ../x.py --stage 2 test src/test/ui --pass=check \
50+
--host='' --target=i686-unknown-linux-gnu && \
5051
# Run tidy at the very end, after all the other tests.
5152
python2.7 ../x.py --stage 2 test src/tools/tidy
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
include ../../run-make-fulldeps/tools.mk
1+
# ignore-none no-std is not supported
2+
# ignore-nvptx64-nvidia-cuda FIXME: can't find crate for `std`
23

3-
# FIXME https://github.com/rust-lang/rust/issues/78911
4-
# ignore-32bit wrong/no cross compiler and sometimes we pass wrong gcc args (-m64)
4+
include ../../run-make-fulldeps/tools.mk
55

66
# Tests that we don't ICE during incremental compilation after modifying a
77
# function span such that its previous end line exceeds the number of lines
@@ -14,6 +14,6 @@ all:
1414
mkdir $(SRC)
1515
mkdir $(INCR)
1616
cp a.rs $(SRC)/main.rs
17-
$(RUSTC) -C incremental=$(INCR) $(SRC)/main.rs
17+
$(RUSTC) -C incremental=$(INCR) $(SRC)/main.rs --target $(TARGET)
1818
cp b.rs $(SRC)/main.rs
19-
$(RUSTC) -C incremental=$(INCR) $(SRC)/main.rs
19+
$(RUSTC) -C incremental=$(INCR) $(SRC)/main.rs --target $(TARGET)
+11-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1-
include ../../run-make-fulldeps/tools.mk
1+
# ignore-riscv64 $(call RUN,foo) expects to run the target executable natively
2+
# so it won't work with remote-test-server
3+
# ignore-arm Another build using remote-test-server
4+
# ignore-none no-std is not supported
5+
# ignore-wasm32 FIXME: don't attempt to compile C++ to WASM
6+
# ignore-wasm64 FIXME: don't attempt to compile C++ to WASM
7+
# ignore-nvptx64-nvidia-cuda FIXME: can't find crate for `std`
8+
# ignore-musl FIXME: this makefile needs teaching how to use a musl toolchain
9+
# (see dist-i586-gnu-i586-i686-musl Dockerfile)
210

3-
# FIXME https://github.com/rust-lang/rust/issues/78911
4-
# ignore-32bit wrong/no cross compiler and sometimes we pass wrong gcc args (-m64)
11+
include ../../run-make-fulldeps/tools.mk
512

613
all: foo
714
$(call RUN,foo)
815

916
foo: foo.rs $(call NATIVE_STATICLIB,foo)
10-
$(RUSTC) $< -lfoo $(EXTRARSCXXFLAGS)
17+
$(RUSTC) $< -lfoo $(EXTRARSCXXFLAGS) --target $(TARGET)
1118

1219
$(TMPDIR)/libfoo.o: foo.cpp
1320
$(call COMPILE_OBJ_CXX,$@,$<)

src/test/run-make/issue-83112-incr-test-moved-file/Makefile

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
include ../../run-make-fulldeps/tools.mk
22

3-
# FIXME https://github.com/rust-lang/rust/issues/78911
4-
# ignore-32bit wrong/no cross compiler and sometimes we pass wrong gcc args (-m64)
3+
# ignore-none no-std is not supported
4+
# ignore-nvptx64-nvidia-cuda FIXME: can't find crate for 'std'
55

66
# Regression test for issue #83112
77
# The generated test harness code contains spans with a dummy location,
@@ -20,6 +20,6 @@ all:
2020
mkdir $(SRC)/mydir
2121
mkdir $(INCR)
2222
cp main.rs $(SRC)/main.rs
23-
$(RUSTC) --test -C incremental=$(INCR) $(SRC)/main.rs
23+
$(RUSTC) --test -C incremental=$(INCR) $(SRC)/main.rs --target $(TARGET)
2424
mv $(SRC)/main.rs $(SRC)/mydir/main.rs
25-
$(RUSTC) --test -C incremental=$(INCR) $(SRC)/mydir/main.rs
25+
$(RUSTC) --test -C incremental=$(INCR) $(SRC)/mydir/main.rs --target $(TARGET)

0 commit comments

Comments
 (0)