Skip to content

Commit f30e9c9

Browse files
committed
ci: split x86_64-gnu-tools job
1 parent 7c10378 commit f30e9c9

File tree

4 files changed

+125
-56
lines changed

4 files changed

+125
-56
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
FROM ghcr.io/rust-lang/ubuntu:22.04
2+
3+
ARG DEBIAN_FRONTEND=noninteractive
4+
RUN apt-get update && apt-get install -y --no-install-recommends \
5+
g++ \
6+
make \
7+
ninja-build \
8+
file \
9+
curl \
10+
ca-certificates \
11+
python3 \
12+
git \
13+
cmake \
14+
libssl-dev \
15+
sudo \
16+
xz-utils \
17+
tidy \
18+
\
19+
libc6 \
20+
wget \
21+
# libgccjit dependencies
22+
flex \
23+
libmpfr-dev \
24+
libgmp-dev \
25+
libmpc3 \
26+
libmpc-dev \
27+
&& rm -rf /var/lib/apt/lists/*
28+
29+
COPY scripts/sccache.sh /scripts/
30+
RUN sh /scripts/sccache.sh
31+
32+
# Fix rustc_codegen_gcc lto issues.
33+
ENV GCC_EXEC_PREFIX="/usr/lib/gcc/"
34+
35+
COPY host-x86_64/x86_64-gnu-miri/check-miri.sh /tmp/
36+
37+
ENV RUST_CONFIGURE_ARGS \
38+
--build=x86_64-unknown-linux-gnu \
39+
--enable-new-symbol-mangling
40+
41+
ENV HOST_TARGET x86_64-unknown-linux-gnu
42+
43+
# FIXME(#133381): currently rustc alt builds do *not* have rustc debug
44+
# assertions enabled! Therefore, we cannot force download CI rustc.
45+
#ENV FORCE_CI_RUSTC 1
46+
47+
COPY scripts/shared.sh /scripts/
48+
49+
# For now, we need to use `--unsafe-perm=true` to go around an issue when npm tries
50+
# to create a new folder. For reference:
51+
# https://github.com/puppeteer/puppeteer/issues/375
52+
#
53+
# We also specify the version in case we need to update it to go around cache limitations.
54+
#
55+
# The `browser-ui-test.version` file is also used by bootstrap to emit warnings in case
56+
# the local version of the package is different than the one used by the CI.
57+
ENV SCRIPT /tmp/check-miri.sh ../x.py
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/bin/sh
2+
# ignore-tidy-linelength
3+
4+
set -eu
5+
set -x # so one can see where we are in the script
6+
7+
X_PY="$1"
8+
9+
# Testing Miri is a bit complicated.
10+
# We set the GC interval to the shortest possible value (0 would be off) to increase the chance
11+
# that bugs which only surface when the GC runs at a specific time are more likely to cause CI to fail.
12+
# This significantly increases the runtime of our test suite, or we'd do this in PR CI too.
13+
if [ -z "${PR_CI_JOB:-}" ]; then
14+
MIRIFLAGS=-Zmiri-provenance-gc=1 python3 "$X_PY" test --stage 2 src/tools/miri src/tools/miri/cargo-miri
15+
else
16+
python3 "$X_PY" test --stage 2 src/tools/miri src/tools/miri/cargo-miri
17+
fi
18+
# We re-run the test suite for a chance to find bugs in the intrinsic fallback bodies and in MIR
19+
# optimizations. This can miss UB, so we only run the "pass" tests. We need to enable debug
20+
# assertions as `-O` disables them but some tests rely on them. We also set a cfg flag so tests can
21+
# adjust their expectations if needed. This can change the output of the tests so we ignore that,
22+
# we only ensure that all assertions still pass.
23+
MIRIFLAGS="-Zmiri-force-intrinsic-fallback --cfg force_intrinsic_fallback -O -Zmir-opt-level=4 -Cdebug-assertions=yes" \
24+
MIRI_SKIP_UI_CHECKS=1 \
25+
python3 "$X_PY" test --stage 2 src/tools/miri -- tests/pass tests/panic
26+
# We natively run this script on x86_64-unknown-linux-gnu and x86_64-pc-windows-msvc.
27+
# Also cover some other targets via cross-testing, in particular all tier 1 targets.
28+
case $HOST_TARGET in
29+
x86_64-unknown-linux-gnu)
30+
# Only this branch runs in PR CI.
31+
# Fully test all main OSes, and all main architectures.
32+
python3 "$X_PY" test --stage 2 src/tools/miri src/tools/miri/cargo-miri --target aarch64-apple-darwin
33+
python3 "$X_PY" test --stage 2 src/tools/miri src/tools/miri/cargo-miri --target i686-pc-windows-msvc
34+
# Only run "pass" tests for the remaining targets, which is quite a bit faster.
35+
python3 "$X_PY" test --stage 2 src/tools/miri --target x86_64-pc-windows-gnu --test-args pass
36+
python3 "$X_PY" test --stage 2 src/tools/miri --target i686-unknown-linux-gnu --test-args pass
37+
python3 "$X_PY" test --stage 2 src/tools/miri --target aarch64-unknown-linux-gnu --test-args pass
38+
python3 "$X_PY" test --stage 2 src/tools/miri --target s390x-unknown-linux-gnu --test-args pass
39+
;;
40+
x86_64-pc-windows-msvc)
41+
# Strangely, Linux targets do not work here. cargo always says
42+
# "error: cannot produce cdylib for ... as the target ... does not support these crate types".
43+
# Only run "pass" tests, which is quite a bit faster.
44+
#FIXME: Re-enable this once CI issues are fixed
45+
# See <https://github.com/rust-lang/rust/issues/127883>
46+
# For now, these tests are moved to `x86_64-msvc-ext2` in `src/ci/github-actions/jobs.yml`.
47+
#python3 "$X_PY" test --stage 2 src/tools/miri --target x86_64-apple-darwin --test-args pass
48+
;;
49+
*)
50+
echo "FATAL: unexpected host $HOST_TARGET"
51+
exit 1
52+
;;
53+
esac
54+
# Also smoke-test `x.py miri`. This doesn't run any actual tests (that would take too long),
55+
# but it ensures that the crates build properly when tested with Miri.
56+
57+
#FIXME: Re-enable this for msvc once CI issues are fixed
58+
if [ "$HOST_TARGET" != "x86_64-pc-windows-msvc" ]; then
59+
python3 "$X_PY" miri --stage 2 library/core --test-args notest
60+
python3 "$X_PY" miri --stage 2 library/alloc --test-args notest
61+
python3 "$X_PY" miri --stage 2 library/std --test-args notest
62+
fi

src/ci/docker/host-x86_64/x86_64-gnu-tools/checktools.sh

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -30,58 +30,3 @@ cat /tmp/toolstate/toolstates.json
3030
python3 "$X_PY" test --stage 2 check-tools
3131
python3 "$X_PY" test --stage 2 src/tools/clippy
3232
python3 "$X_PY" test --stage 2 src/tools/rustfmt
33-
34-
# Testing Miri is a bit more complicated.
35-
# We set the GC interval to the shortest possible value (0 would be off) to increase the chance
36-
# that bugs which only surface when the GC runs at a specific time are more likely to cause CI to fail.
37-
# This significantly increases the runtime of our test suite, or we'd do this in PR CI too.
38-
if [ -z "${PR_CI_JOB:-}" ]; then
39-
MIRIFLAGS=-Zmiri-provenance-gc=1 python3 "$X_PY" test --stage 2 src/tools/miri src/tools/miri/cargo-miri
40-
else
41-
python3 "$X_PY" test --stage 2 src/tools/miri src/tools/miri/cargo-miri
42-
fi
43-
# We re-run the test suite for a chance to find bugs in the intrinsic fallback bodies and in MIR
44-
# optimizations. This can miss UB, so we only run the "pass" tests. We need to enable debug
45-
# assertions as `-O` disables them but some tests rely on them. We also set a cfg flag so tests can
46-
# adjust their expectations if needed. This can change the output of the tests so we ignore that,
47-
# we only ensure that all assertions still pass.
48-
MIRIFLAGS="-Zmiri-force-intrinsic-fallback --cfg force_intrinsic_fallback -O -Zmir-opt-level=4 -Cdebug-assertions=yes" \
49-
MIRI_SKIP_UI_CHECKS=1 \
50-
python3 "$X_PY" test --stage 2 src/tools/miri -- tests/pass tests/panic
51-
# We natively run this script on x86_64-unknown-linux-gnu and x86_64-pc-windows-msvc.
52-
# Also cover some other targets via cross-testing, in particular all tier 1 targets.
53-
case $HOST_TARGET in
54-
x86_64-unknown-linux-gnu)
55-
# Only this branch runs in PR CI.
56-
# Fully test all main OSes, and all main architectures.
57-
python3 "$X_PY" test --stage 2 src/tools/miri src/tools/miri/cargo-miri --target aarch64-apple-darwin
58-
python3 "$X_PY" test --stage 2 src/tools/miri src/tools/miri/cargo-miri --target i686-pc-windows-msvc
59-
# Only run "pass" tests for the remaining targets, which is quite a bit faster.
60-
python3 "$X_PY" test --stage 2 src/tools/miri --target x86_64-pc-windows-gnu --test-args pass
61-
python3 "$X_PY" test --stage 2 src/tools/miri --target i686-unknown-linux-gnu --test-args pass
62-
python3 "$X_PY" test --stage 2 src/tools/miri --target aarch64-unknown-linux-gnu --test-args pass
63-
python3 "$X_PY" test --stage 2 src/tools/miri --target s390x-unknown-linux-gnu --test-args pass
64-
;;
65-
x86_64-pc-windows-msvc)
66-
# Strangely, Linux targets do not work here. cargo always says
67-
# "error: cannot produce cdylib for ... as the target ... does not support these crate types".
68-
# Only run "pass" tests, which is quite a bit faster.
69-
#FIXME: Re-enable this once CI issues are fixed
70-
# See <https://github.com/rust-lang/rust/issues/127883>
71-
# For now, these tests are moved to `x86_64-msvc-ext2` in `src/ci/github-actions/jobs.yml`.
72-
#python3 "$X_PY" test --stage 2 src/tools/miri --target x86_64-apple-darwin --test-args pass
73-
;;
74-
*)
75-
echo "FATAL: unexpected host $HOST_TARGET"
76-
exit 1
77-
;;
78-
esac
79-
# Also smoke-test `x.py miri`. This doesn't run any actual tests (that would take too long),
80-
# but it ensures that the crates build properly when tested with Miri.
81-
82-
#FIXME: Re-enable this for msvc once CI issues are fixed
83-
if [ "$HOST_TARGET" != "x86_64-pc-windows-msvc" ]; then
84-
python3 "$X_PY" miri --stage 2 library/core --test-args notest
85-
python3 "$X_PY" miri --stage 2 library/alloc --test-args notest
86-
python3 "$X_PY" miri --stage 2 library/std --test-args notest
87-
fi

src/ci/github-actions/jobs.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,9 @@ pr:
150150
DOCKER_SCRIPT: stage_2_test_set2.sh
151151
<<: *job-aarch64-linux
152152
- name: x86_64-gnu-tools
153-
<<: *job-linux-36c-codebuild
153+
<<: *job-linux-4c
154+
- name: x86_64-gnu-miri
155+
<<: *job-linux-4c
154156

155157
# Jobs that run when you perform a try build (@bors try)
156158
# These jobs automatically inherit envs.try, to avoid repeating
@@ -419,6 +421,9 @@ auto:
419421
DEPLOY_TOOLSTATES_JSON: toolstates-linux.json
420422
<<: *job-linux-4c
421423

424+
- name: x86_64-gnu-miri
425+
<<: *job-linux-4c
426+
422427
####################
423428
# macOS Builders #
424429
####################

0 commit comments

Comments
 (0)