Skip to content

Commit

Permalink
Auto merge of #80839 - tblah:riscv64linux_links, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bors committed Mar 29, 2021
2 parents 7750402 + 1fa48cf commit 2917eda
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 16 deletions.
16 changes: 15 additions & 1 deletion src/bootstrap/test.rs
Expand Up @@ -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<'_>) {
Expand Down
Expand Up @@ -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
3 changes: 2 additions & 1 deletion src/ci/docker/host-x86_64/x86_64-gnu-llvm-10/Dockerfile
Expand Up @@ -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
10 changes: 5 additions & 5 deletions src/test/run-make/incr-prev-body-beyond-eof/Makefile
@@ -1,7 +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`

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

# 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
Expand All @@ -14,6 +14,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)
15 changes: 11 additions & 4 deletions src/test/run-make/issue-36710/Makefile
@@ -1,13 +1,20 @@
include ../../run-make-fulldeps/tools.mk
# 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
# 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)

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

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,$@,$<)
8 changes: 4 additions & 4 deletions src/test/run-make/issue-83112-incr-test-moved-file/Makefile
@@ -1,7 +1,7 @@
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)
# 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,
Expand All @@ -20,6 +20,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)

0 comments on commit 2917eda

Please sign in to comment.