Skip to content

Commit 142028e

Browse files
authored
Rollup merge of rust-lang#80839 - tblah:riscv64linux_links, r=sanxiyn
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 rust-lang#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 rust-lang#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 107896c + db14627 commit 142028e

File tree

5 files changed

+27
-12
lines changed

5 files changed

+27
-12
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-9/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,6 @@
1-
include ../../run-make-fulldeps/tools.mk
1+
# ignore-none no-std is not supported
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+
include ../../run-make-fulldeps/tools.mk
54

65
# Tests that we don't ICE during incremental compilation after modifying a
76
# function span such that its previous end line exceeds the number of lines
@@ -14,6 +13,6 @@ all:
1413
mkdir $(SRC)
1514
mkdir $(INCR)
1615
cp a.rs $(SRC)/main.rs
17-
$(RUSTC) -C incremental=$(INCR) $(SRC)/main.rs
16+
$(RUSTC) -C incremental=$(INCR) $(SRC)/main.rs --target $(TARGET)
1817
cp b.rs $(SRC)/main.rs
19-
$(RUSTC) -C incremental=$(INCR) $(SRC)/main.rs
18+
$(RUSTC) -C incremental=$(INCR) $(SRC)/main.rs --target $(TARGET)
+5-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
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-none no-std is not supported
24

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)
5+
include ../../run-make-fulldeps/tools.mk
56

67
all: foo
78
$(call RUN,foo)
89

910
foo: foo.rs $(call NATIVE_STATICLIB,foo)
10-
$(RUSTC) $< -lfoo $(EXTRARSCXXFLAGS)
11+
$(RUSTC) $< -lfoo $(EXTRARSCXXFLAGS) --target $(TARGET)
1112

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

0 commit comments

Comments
 (0)