From 577b5f387f03fbcfc44103f5ecd6470fc9d6395a Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Tue, 10 Dec 2024 13:14:44 +0100 Subject: [PATCH 01/21] CI: use free runners for x86_64-gnu-llvm jobs --- .../host-x86_64/x86_64-gnu-llvm-18/Dockerfile | 3 +- .../host-x86_64/x86_64-gnu-llvm-19/Dockerfile | 2 +- src/ci/docker/scripts/x86_64-gnu-llvm.sh | 3 -- src/ci/github-actions/jobs.yml | 34 ++++++++++++++++--- 4 files changed, 33 insertions(+), 9 deletions(-) diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile index 487da58015222..7df32f18fdb36 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile @@ -60,4 +60,5 @@ COPY host-x86_64/dist-x86_64-linux/build-gccjit.sh /scripts/ RUN /scripts/build-gccjit.sh /scripts COPY scripts/x86_64-gnu-llvm.sh /tmp/script.sh -ENV SCRIPT /tmp/script.sh +ARG SCRIPT_ARG +ENV SCRIPT="/tmp/script.sh && ${SCRIPT_ARG}" diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile index 4991908fe7734..2901daacd539f 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile @@ -60,4 +60,4 @@ COPY host-x86_64/dist-x86_64-linux/build-gccjit.sh /scripts/ RUN /scripts/build-gccjit.sh /scripts COPY scripts/x86_64-gnu-llvm.sh /tmp/script.sh -ENV SCRIPT /tmp/script.sh +ENV SCRIPT="/tmp/script.sh && ${SCRIPT_ARG}" diff --git a/src/ci/docker/scripts/x86_64-gnu-llvm.sh b/src/ci/docker/scripts/x86_64-gnu-llvm.sh index dea38b6fd2a4a..22ab93c376492 100755 --- a/src/ci/docker/scripts/x86_64-gnu-llvm.sh +++ b/src/ci/docker/scripts/x86_64-gnu-llvm.sh @@ -39,9 +39,6 @@ if [[ -z "${PR_CI_JOB}" ]]; then library/std library/alloc library/core fi -# NOTE: intentionally uses all of `x.py`, `x`, and `x.ps1` to make sure they all work on Linux. -../x.py --stage 2 test --skip src/tools/tidy - # Run the `mir-opt` tests again but this time for a 32-bit target. # This enforces that tests using `// EMIT_MIR_FOR_EACH_BIT_WIDTH` have # both 32-bit and 64-bit outputs updated by the PR author, before diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml index 959a9580e6003..4ce2c6872e7b8 100644 --- a/src/ci/github-actions/jobs.yml +++ b/src/ci/github-actions/jobs.yml @@ -117,6 +117,7 @@ pr: ENABLE_GCC_CODEGEN: "1" # We are adding (temporarily) a dummy commit on the compiler READ_ONLY_SRC: "0" + DOCKER_SCRIPT: python3 ../x.py --stage 2 test --skip src/tools/tidy <<: *job-linux-16c - image: x86_64-gnu-tools <<: *job-linux-16c @@ -312,16 +313,41 @@ auto: - image: x86_64-gnu-distcheck <<: *job-linux-8c - - image: x86_64-gnu-llvm-19 + # The x86_64-gnu-llvm-19 job is split into multiple jobs to run tests in parallel. + # x86_64-gnu-llvm-19-1 skips tests that run in x86_64-gnu-llvm-19-2. + - image: x86_64-gnu-llvm-19-1 env: RUST_BACKTRACE: 1 - <<: *job-linux-8c + IMAGE: x86_64-gnu-llvm-19 + <<: *stage_2_test_set1 + <<: *job-linux-4c - - image: x86_64-gnu-llvm-18 + # Skip tests that run in x86_64-gnu-llvm-19-2 + - image: x86_64-gnu-llvm-19-2 + env: + RUST_BACKTRACE: 1 + IMAGE: x86_64-gnu-llvm-19 + <<: *stage_2_test_set2 + <<: *job-linux-4c + + # The x86_64-gnu-llvm-18 job is split into multiple jobs to run tests in parallel. + # x86_64-gnu-llvm-18-1 skips tests that run in x86_64-gnu-llvm-18-2. + - image: x86_64-gnu-llvm-18-1 env: RUST_BACKTRACE: 1 READ_ONLY_SRC: "0" - <<: *job-linux-8c + IMAGE: x86_64-gnu-llvm-18 + <<: *stage_2_test_set1 + <<: *job-linux-4c + + # Skip tests that run in x86_64-gnu-llvm-18-2 + - image: x86_64-gnu-llvm-18-2 + env: + RUST_BACKTRACE: 1 + READ_ONLY_SRC: "0" + IMAGE: x86_64-gnu-llvm-18 + <<: *stage_2_test_set2 + <<: *job-linux-4c - image: x86_64-gnu-nopt <<: *job-linux-4c From e67e9b448eed54be11cb2cff351d9dcbd1d10365 Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Tue, 10 Dec 2024 15:17:24 +0100 Subject: [PATCH 02/21] fix --- src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile index 2901daacd539f..e6e6f3e779b79 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile @@ -60,4 +60,5 @@ COPY host-x86_64/dist-x86_64-linux/build-gccjit.sh /scripts/ RUN /scripts/build-gccjit.sh /scripts COPY scripts/x86_64-gnu-llvm.sh /tmp/script.sh +ARG SCRIPT_ARG ENV SCRIPT="/tmp/script.sh && ${SCRIPT_ARG}" From 4f0e7816cd1a1132bd2de72d03a800eeb27bd15d Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Wed, 11 Dec 2024 10:29:59 +0100 Subject: [PATCH 03/21] split better --- .../host-x86_64/x86_64-gnu-llvm-18/Dockerfile | 4 +- .../host-x86_64/x86_64-gnu-llvm-19/Dockerfile | 4 +- src/ci/docker/scripts/x86_64-gnu-llvm1.sh | 36 +++++++++++ src/ci/docker/scripts/x86_64-gnu-llvm2.sh | 60 +++++++++++++++++++ src/ci/github-actions/jobs.yml | 10 ++-- 5 files changed, 105 insertions(+), 9 deletions(-) create mode 100755 src/ci/docker/scripts/x86_64-gnu-llvm1.sh create mode 100755 src/ci/docker/scripts/x86_64-gnu-llvm2.sh diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile index 7df32f18fdb36..3fe79c819fe64 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile @@ -59,6 +59,6 @@ COPY host-x86_64/dist-x86_64-linux/build-gccjit.sh /scripts/ RUN /scripts/build-gccjit.sh /scripts -COPY scripts/x86_64-gnu-llvm.sh /tmp/script.sh ARG SCRIPT_ARG -ENV SCRIPT="/tmp/script.sh && ${SCRIPT_ARG}" +COPY scripts/{SCRIPT_ARG} /tmp/script.sh +ENV SCRIPT="/tmp/script.sh" diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile index e6e6f3e779b79..d52adc89cabed 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile @@ -59,6 +59,6 @@ COPY host-x86_64/dist-x86_64-linux/build-gccjit.sh /scripts/ RUN /scripts/build-gccjit.sh /scripts -COPY scripts/x86_64-gnu-llvm.sh /tmp/script.sh ARG SCRIPT_ARG -ENV SCRIPT="/tmp/script.sh && ${SCRIPT_ARG}" +COPY scripts/{SCRIPT_ARG} /tmp/script.sh +ENV SCRIPT="/tmp/script.sh" diff --git a/src/ci/docker/scripts/x86_64-gnu-llvm1.sh b/src/ci/docker/scripts/x86_64-gnu-llvm1.sh new file mode 100755 index 0000000000000..7336b4ce37b66 --- /dev/null +++ b/src/ci/docker/scripts/x86_64-gnu-llvm1.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +set -ex + +if [ "$READ_ONLY_SRC" = "0" ]; then + # `core::builder::tests::ci_rustc_if_unchanged_logic` bootstrap test ensures that + # "download-rustc=if-unchanged" logic don't use CI rustc while there are changes on + # compiler and/or library. Here we are adding a dummy commit on compiler and running + # that test to make sure we never download CI rustc with a change on the compiler tree. + echo "" >> ../compiler/rustc/src/main.rs + git config --global user.email "dummy@dummy.com" + git config --global user.name "dummy" + git add ../compiler/rustc/src/main.rs + git commit -m "test commit for rust.download-rustc=if-unchanged logic" + DISABLE_CI_RUSTC_IF_INCOMPATIBLE=0 ../x.py test bootstrap \ + -- core::builder::tests::ci_rustc_if_unchanged_logic + # Revert the dummy commit + git reset --hard HEAD~1 +fi + +# Only run the stage 1 tests on merges, not on PR CI jobs. +if [[ -z "${PR_CI_JOB}" ]]; then + ../x.py --stage 1 test + --skip tests + --skip coverage-map + --skip coverage-run + --skip library + --skip tidyselftest +fi + +../x.py --stage 2 test + --skip tests + --skip coverage-map + --skip coverage-run + --skip library + --skip tidyselftest diff --git a/src/ci/docker/scripts/x86_64-gnu-llvm2.sh b/src/ci/docker/scripts/x86_64-gnu-llvm2.sh new file mode 100755 index 0000000000000..a0d31d8d7ae64 --- /dev/null +++ b/src/ci/docker/scripts/x86_64-gnu-llvm2.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +set -ex + +if [ "$READ_ONLY_SRC" = "0" ]; then + # `core::builder::tests::ci_rustc_if_unchanged_logic` bootstrap test ensures that + # "download-rustc=if-unchanged" logic don't use CI rustc while there are changes on + # compiler and/or library. Here we are adding a dummy commit on compiler and running + # that test to make sure we never download CI rustc with a change on the compiler tree. + echo "" >> ../compiler/rustc/src/main.rs + git config --global user.email "dummy@dummy.com" + git config --global user.name "dummy" + git add ../compiler/rustc/src/main.rs + git commit -m "test commit for rust.download-rustc=if-unchanged logic" + DISABLE_CI_RUSTC_IF_INCOMPATIBLE=0 ../x.py test bootstrap \ + -- core::builder::tests::ci_rustc_if_unchanged_logic + # Revert the dummy commit + git reset --hard HEAD~1 +fi + +# Only run the stage 1 tests on merges, not on PR CI jobs. +if [[ -z "${PR_CI_JOB}" ]]; then + ../x.py --stage 1 test + --skip compiler + --skip src + + # Run the `mir-opt` tests again but this time for a 32-bit target. + # This enforces that tests using `// EMIT_MIR_FOR_EACH_BIT_WIDTH` have + # both 32-bit and 64-bit outputs updated by the PR author, before + # the PR is approved and tested for merging. + # It will also detect tests lacking `// EMIT_MIR_FOR_EACH_BIT_WIDTH`, + # despite having different output on 32-bit vs 64-bit targets. + ../x.py --stage 1 test tests/mir-opt --host='' --target=i686-unknown-linux-gnu + + # Run `ui-fulldeps` in `--stage=1`, which actually uses the stage0 + # compiler, and is sensitive to the addition of new flags. + ../x.py --stage 1 test tests/ui-fulldeps + + # Rebuild the stdlib with the size optimizations enabled and run tests again. + RUSTFLAGS_NOT_BOOTSTRAP="--cfg feature=\"optimize_for_size\"" ../x.py --stage 1 test \ + library/std library/alloc library/core +fi + +../x.py --stage 2 test + --skip compiler + --skip src + +# Run the `mir-opt` tests again but this time for a 32-bit target. +# This enforces that tests using `// EMIT_MIR_FOR_EACH_BIT_WIDTH` have +# both 32-bit and 64-bit outputs updated by the PR author, before +# the PR is approved and tested for merging. +# It will also detect tests lacking `// EMIT_MIR_FOR_EACH_BIT_WIDTH`, +# despite having different output on 32-bit vs 64-bit targets. +../x --stage 2 test tests/mir-opt --host='' --target=i686-unknown-linux-gnu + +# Run the UI test suite again, but in `--pass=check` mode +# +# This is intended to make sure that both `--pass=check` continues to +# work. +../x.ps1 --stage 2 test tests/ui --pass=check --host='' --target=i686-unknown-linux-gnu diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml index 4ce2c6872e7b8..aafc13d2dff4a 100644 --- a/src/ci/github-actions/jobs.yml +++ b/src/ci/github-actions/jobs.yml @@ -117,7 +117,7 @@ pr: ENABLE_GCC_CODEGEN: "1" # We are adding (temporarily) a dummy commit on the compiler READ_ONLY_SRC: "0" - DOCKER_SCRIPT: python3 ../x.py --stage 2 test --skip src/tools/tidy + DOCKER_SCRIPT: x86_64-gnu-llvm.sh <<: *job-linux-16c - image: x86_64-gnu-tools <<: *job-linux-16c @@ -319,7 +319,7 @@ auto: env: RUST_BACKTRACE: 1 IMAGE: x86_64-gnu-llvm-19 - <<: *stage_2_test_set1 + DOCKER_SCRIPT: x86_64-gnu-llvm1.sh <<: *job-linux-4c # Skip tests that run in x86_64-gnu-llvm-19-2 @@ -327,7 +327,7 @@ auto: env: RUST_BACKTRACE: 1 IMAGE: x86_64-gnu-llvm-19 - <<: *stage_2_test_set2 + DOCKER_SCRIPT: x86_64-gnu-llvm2.sh <<: *job-linux-4c # The x86_64-gnu-llvm-18 job is split into multiple jobs to run tests in parallel. @@ -337,7 +337,7 @@ auto: RUST_BACKTRACE: 1 READ_ONLY_SRC: "0" IMAGE: x86_64-gnu-llvm-18 - <<: *stage_2_test_set1 + DOCKER_SCRIPT: x86_64-gnu-llvm1.sh <<: *job-linux-4c # Skip tests that run in x86_64-gnu-llvm-18-2 @@ -346,7 +346,7 @@ auto: RUST_BACKTRACE: 1 READ_ONLY_SRC: "0" IMAGE: x86_64-gnu-llvm-18 - <<: *stage_2_test_set2 + DOCKER_SCRIPT: x86_64-gnu-llvm2.sh <<: *job-linux-4c - image: x86_64-gnu-nopt From bb88d7a0f16d820538aae7b1113ebafe98cfbacb Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Wed, 11 Dec 2024 11:09:32 +0100 Subject: [PATCH 04/21] fix --- src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile | 2 +- src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile index 3fe79c819fe64..01daad9953572 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile @@ -60,5 +60,5 @@ COPY host-x86_64/dist-x86_64-linux/build-gccjit.sh /scripts/ RUN /scripts/build-gccjit.sh /scripts ARG SCRIPT_ARG -COPY scripts/{SCRIPT_ARG} /tmp/script.sh +COPY scripts/${SCRIPT_ARG} /tmp/script.sh ENV SCRIPT="/tmp/script.sh" diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile index d52adc89cabed..d37ccb5da9ed6 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile @@ -60,5 +60,5 @@ COPY host-x86_64/dist-x86_64-linux/build-gccjit.sh /scripts/ RUN /scripts/build-gccjit.sh /scripts ARG SCRIPT_ARG -COPY scripts/{SCRIPT_ARG} /tmp/script.sh +COPY scripts/${SCRIPT_ARG} /tmp/script.sh ENV SCRIPT="/tmp/script.sh" From 84ba41dcd81ad838b8aed6e1f183adf3bec66167 Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Wed, 11 Dec 2024 11:21:21 +0100 Subject: [PATCH 05/21] remove unnecessary change --- src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile | 2 +- src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile index 01daad9953572..6e7d58abb63a5 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile @@ -61,4 +61,4 @@ RUN /scripts/build-gccjit.sh /scripts ARG SCRIPT_ARG COPY scripts/${SCRIPT_ARG} /tmp/script.sh -ENV SCRIPT="/tmp/script.sh" +ENV SCRIPT= /tmp/script.sh diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile index d37ccb5da9ed6..77750c5c9894d 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile @@ -61,4 +61,4 @@ RUN /scripts/build-gccjit.sh /scripts ARG SCRIPT_ARG COPY scripts/${SCRIPT_ARG} /tmp/script.sh -ENV SCRIPT="/tmp/script.sh" +ENV SCRIPT= /tmp/script.sh From abd8352de7c36fec2ee11ff856bae96ab408b06c Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Wed, 11 Dec 2024 11:29:18 +0100 Subject: [PATCH 06/21] restore command --- src/ci/docker/scripts/x86_64-gnu-llvm.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ci/docker/scripts/x86_64-gnu-llvm.sh b/src/ci/docker/scripts/x86_64-gnu-llvm.sh index 22ab93c376492..dea38b6fd2a4a 100755 --- a/src/ci/docker/scripts/x86_64-gnu-llvm.sh +++ b/src/ci/docker/scripts/x86_64-gnu-llvm.sh @@ -39,6 +39,9 @@ if [[ -z "${PR_CI_JOB}" ]]; then library/std library/alloc library/core fi +# NOTE: intentionally uses all of `x.py`, `x`, and `x.ps1` to make sure they all work on Linux. +../x.py --stage 2 test --skip src/tools/tidy + # Run the `mir-opt` tests again but this time for a 32-bit target. # This enforces that tests using `// EMIT_MIR_FOR_EACH_BIT_WIDTH` have # both 32-bit and 64-bit outputs updated by the PR author, before From a8bc3cf38b3860e4965561e89604e3ca0f219cdf Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Wed, 11 Dec 2024 11:36:39 +0100 Subject: [PATCH 07/21] fix --- src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile | 2 +- src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile index 6e7d58abb63a5..a8727399a1580 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile @@ -61,4 +61,4 @@ RUN /scripts/build-gccjit.sh /scripts ARG SCRIPT_ARG COPY scripts/${SCRIPT_ARG} /tmp/script.sh -ENV SCRIPT= /tmp/script.sh +ENV SCRIPT /tmp/script.sh diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile index 77750c5c9894d..7639cc40dac6c 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile @@ -61,4 +61,4 @@ RUN /scripts/build-gccjit.sh /scripts ARG SCRIPT_ARG COPY scripts/${SCRIPT_ARG} /tmp/script.sh -ENV SCRIPT= /tmp/script.sh +ENV SCRIPT /tmp/script.sh From d74de1fdb11749463c4f876f10360cd47c537fea Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Wed, 11 Dec 2024 11:43:11 +0100 Subject: [PATCH 08/21] debug --- src/ci/docker/run.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ci/docker/run.sh b/src/ci/docker/run.sh index a0adf60b6b2c9..84c45790b3e3a 100755 --- a/src/ci/docker/run.sh +++ b/src/ci/docker/run.sh @@ -120,6 +120,7 @@ if [ -f "$docker_dir/$image/Dockerfile" ]; then # instead of the one defined in the Dockerfile. if [ -n "${DOCKER_SCRIPT+x}" ]; then build_args+=("--build-arg" "SCRIPT_ARG=${DOCKER_SCRIPT}") + echo "Using docker build arg SCRIPT_ARG=${DOCKER_SCRIPT}" fi # On non-CI jobs, we try to download a pre-built image from the rust-lang-ci From 754fb24313f4e4683a673ce73968c5ae240122f1 Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Wed, 11 Dec 2024 11:54:12 +0100 Subject: [PATCH 09/21] debug --- src/ci/scripts/run-build-from-ci.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ci/scripts/run-build-from-ci.sh b/src/ci/scripts/run-build-from-ci.sh index 55e75800d91c4..4ce6de8e857f7 100755 --- a/src/ci/scripts/run-build-from-ci.sh +++ b/src/ci/scripts/run-build-from-ci.sh @@ -17,7 +17,9 @@ echo "::add-matcher::src/ci/github-actions/problem_matchers.json" # the environment rustup self uninstall -y || true if [ -z "${IMAGE+x}" ]; then + echo "Running src/ci/run.sh" src/ci/run.sh else + echo "Running src/ci/docker/run.sh with image ${IMAGE}" src/ci/docker/run.sh "${IMAGE}" fi From 9ed728d19e019769ebde2ae9645e040fd7af2b72 Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Wed, 11 Dec 2024 12:31:13 +0100 Subject: [PATCH 10/21] debug --- src/ci/docker/run.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ci/docker/run.sh b/src/ci/docker/run.sh index 84c45790b3e3a..c07f04cd71439 100755 --- a/src/ci/docker/run.sh +++ b/src/ci/docker/run.sh @@ -121,6 +121,8 @@ if [ -f "$docker_dir/$image/Dockerfile" ]; then if [ -n "${DOCKER_SCRIPT+x}" ]; then build_args+=("--build-arg" "SCRIPT_ARG=${DOCKER_SCRIPT}") echo "Using docker build arg SCRIPT_ARG=${DOCKER_SCRIPT}" + else + echo "DOCKER_SCRIPT is not defined" fi # On non-CI jobs, we try to download a pre-built image from the rust-lang-ci From eec9bcf163935ea5b2cce0f6b4a917b835a81271 Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Wed, 11 Dec 2024 12:47:58 +0100 Subject: [PATCH 11/21] more debug --- src/ci/docker/run.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ci/docker/run.sh b/src/ci/docker/run.sh index c07f04cd71439..25a32ef15f3b7 100755 --- a/src/ci/docker/run.sh +++ b/src/ci/docker/run.sh @@ -38,7 +38,9 @@ root_dir="`dirname $src_dir`" source "$ci_dir/shared.sh" +echo "Checking is running in CI..." if isCI; then + echo "CI detected" objdir=$root_dir/obj else objdir=$root_dir/obj/$image @@ -53,6 +55,7 @@ fi CACHE_DOMAIN="${CACHE_DOMAIN:-ci-caches.rust-lang.org}" if [ -f "$docker_dir/$image/Dockerfile" ]; then + echo "Dockefile exists for $image" hash_key=/tmp/.docker-hash-key.txt rm -f "${hash_key}" echo $image >> $hash_key From fee220a900de1307021ebc4a3084c62ba10076c1 Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Wed, 11 Dec 2024 15:21:03 +0100 Subject: [PATCH 12/21] fix --- src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile | 6 ++++-- src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile index a8727399a1580..bcbf68a366279 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile @@ -60,5 +60,7 @@ COPY host-x86_64/dist-x86_64-linux/build-gccjit.sh /scripts/ RUN /scripts/build-gccjit.sh /scripts ARG SCRIPT_ARG -COPY scripts/${SCRIPT_ARG} /tmp/script.sh -ENV SCRIPT /tmp/script.sh +COPY scripts/x86_64-gnu-llvm.sh /tmp/x86_64-gnu-llvm.sh +COPY scripts/x86_64-gnu-llvm1.sh /tmp/x86_64-gnu-llvm1.sh +COPY scripts/x86_64-gnu-llvm2.sh /tmp/x86_64-gnu-llvm2.sh +ENV SCRIPT /tmp/${SCRIPT_ARG} diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile index 7639cc40dac6c..567277e9a5898 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile @@ -60,5 +60,7 @@ COPY host-x86_64/dist-x86_64-linux/build-gccjit.sh /scripts/ RUN /scripts/build-gccjit.sh /scripts ARG SCRIPT_ARG -COPY scripts/${SCRIPT_ARG} /tmp/script.sh -ENV SCRIPT /tmp/script.sh +COPY scripts/x86_64-gnu-llvm.sh /tmp/x86_64-gnu-llvm.sh +COPY scripts/x86_64-gnu-llvm1.sh /tmp/x86_64-gnu-llvm1.sh +COPY scripts/x86_64-gnu-llvm2.sh /tmp/x86_64-gnu-llvm2.sh +ENV SCRIPT /tmp/${SCRIPT_ARG} From 1f38572e57518fad3892dad7c0d0433ae71d6675 Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Wed, 11 Dec 2024 17:43:12 +0100 Subject: [PATCH 13/21] fix --- src/ci/docker/scripts/x86_64-gnu-llvm1.sh | 20 ++++++++++---------- src/ci/docker/scripts/x86_64-gnu-llvm2.sh | 8 ++++---- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/ci/docker/scripts/x86_64-gnu-llvm1.sh b/src/ci/docker/scripts/x86_64-gnu-llvm1.sh index 7336b4ce37b66..45759ce6a66bc 100755 --- a/src/ci/docker/scripts/x86_64-gnu-llvm1.sh +++ b/src/ci/docker/scripts/x86_64-gnu-llvm1.sh @@ -20,17 +20,17 @@ fi # Only run the stage 1 tests on merges, not on PR CI jobs. if [[ -z "${PR_CI_JOB}" ]]; then - ../x.py --stage 1 test - --skip tests - --skip coverage-map - --skip coverage-run - --skip library + ../x.py --stage 1 test \ + --skip tests \ + --skip coverage-map \ + --skip coverage-run \ + --skip library \ --skip tidyselftest fi -../x.py --stage 2 test - --skip tests - --skip coverage-map - --skip coverage-run - --skip library +../x.py --stage 2 test \ + --skip tests \ + --skip coverage-map \ + --skip coverage-run \ + --skip library \ --skip tidyselftest diff --git a/src/ci/docker/scripts/x86_64-gnu-llvm2.sh b/src/ci/docker/scripts/x86_64-gnu-llvm2.sh index a0d31d8d7ae64..3902b8559f661 100755 --- a/src/ci/docker/scripts/x86_64-gnu-llvm2.sh +++ b/src/ci/docker/scripts/x86_64-gnu-llvm2.sh @@ -20,8 +20,8 @@ fi # Only run the stage 1 tests on merges, not on PR CI jobs. if [[ -z "${PR_CI_JOB}" ]]; then - ../x.py --stage 1 test - --skip compiler + ../x.py --stage 1 test \ + --skip compiler \ --skip src # Run the `mir-opt` tests again but this time for a 32-bit target. @@ -41,8 +41,8 @@ if [[ -z "${PR_CI_JOB}" ]]; then library/std library/alloc library/core fi -../x.py --stage 2 test - --skip compiler +../x.py --stage 2 test \ + --skip compiler \ --skip src # Run the `mir-opt` tests again but this time for a 32-bit target. From 7ce2944ef976289aa7126f4a46db500e4b9b47c6 Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Thu, 12 Dec 2024 12:59:30 +0100 Subject: [PATCH 14/21] test stage 1 in separate job --- src/ci/docker/scripts/x86_64-gnu-llvm.sh | 21 ------------ src/ci/docker/scripts/x86_64-gnu-llvm1.sh | 10 ------ src/ci/docker/scripts/x86_64-gnu-llvm2.sh | 23 ------------- src/ci/docker/scripts/x86_64-gnu-llvm3.sh | 39 +++++++++++++++++++++++ src/ci/github-actions/jobs.yml | 25 ++++++++++++--- 5 files changed, 60 insertions(+), 58 deletions(-) create mode 100755 src/ci/docker/scripts/x86_64-gnu-llvm3.sh diff --git a/src/ci/docker/scripts/x86_64-gnu-llvm.sh b/src/ci/docker/scripts/x86_64-gnu-llvm.sh index dea38b6fd2a4a..9e9c209530447 100755 --- a/src/ci/docker/scripts/x86_64-gnu-llvm.sh +++ b/src/ci/docker/scripts/x86_64-gnu-llvm.sh @@ -18,27 +18,6 @@ if [ "$READ_ONLY_SRC" = "0" ]; then git reset --hard HEAD~1 fi -# Only run the stage 1 tests on merges, not on PR CI jobs. -if [[ -z "${PR_CI_JOB}" ]]; then - ../x.py --stage 1 test --skip src/tools/tidy - - # Run the `mir-opt` tests again but this time for a 32-bit target. - # This enforces that tests using `// EMIT_MIR_FOR_EACH_BIT_WIDTH` have - # both 32-bit and 64-bit outputs updated by the PR author, before - # the PR is approved and tested for merging. - # It will also detect tests lacking `// EMIT_MIR_FOR_EACH_BIT_WIDTH`, - # despite having different output on 32-bit vs 64-bit targets. - ../x.py --stage 1 test tests/mir-opt --host='' --target=i686-unknown-linux-gnu - - # Run `ui-fulldeps` in `--stage=1`, which actually uses the stage0 - # compiler, and is sensitive to the addition of new flags. - ../x.py --stage 1 test tests/ui-fulldeps - - # Rebuild the stdlib with the size optimizations enabled and run tests again. - RUSTFLAGS_NOT_BOOTSTRAP="--cfg feature=\"optimize_for_size\"" ../x.py --stage 1 test \ - library/std library/alloc library/core -fi - # NOTE: intentionally uses all of `x.py`, `x`, and `x.ps1` to make sure they all work on Linux. ../x.py --stage 2 test --skip src/tools/tidy diff --git a/src/ci/docker/scripts/x86_64-gnu-llvm1.sh b/src/ci/docker/scripts/x86_64-gnu-llvm1.sh index 45759ce6a66bc..aab8fcc1f5e88 100755 --- a/src/ci/docker/scripts/x86_64-gnu-llvm1.sh +++ b/src/ci/docker/scripts/x86_64-gnu-llvm1.sh @@ -18,16 +18,6 @@ if [ "$READ_ONLY_SRC" = "0" ]; then git reset --hard HEAD~1 fi -# Only run the stage 1 tests on merges, not on PR CI jobs. -if [[ -z "${PR_CI_JOB}" ]]; then - ../x.py --stage 1 test \ - --skip tests \ - --skip coverage-map \ - --skip coverage-run \ - --skip library \ - --skip tidyselftest -fi - ../x.py --stage 2 test \ --skip tests \ --skip coverage-map \ diff --git a/src/ci/docker/scripts/x86_64-gnu-llvm2.sh b/src/ci/docker/scripts/x86_64-gnu-llvm2.sh index 3902b8559f661..678b209677712 100755 --- a/src/ci/docker/scripts/x86_64-gnu-llvm2.sh +++ b/src/ci/docker/scripts/x86_64-gnu-llvm2.sh @@ -18,29 +18,6 @@ if [ "$READ_ONLY_SRC" = "0" ]; then git reset --hard HEAD~1 fi -# Only run the stage 1 tests on merges, not on PR CI jobs. -if [[ -z "${PR_CI_JOB}" ]]; then - ../x.py --stage 1 test \ - --skip compiler \ - --skip src - - # Run the `mir-opt` tests again but this time for a 32-bit target. - # This enforces that tests using `// EMIT_MIR_FOR_EACH_BIT_WIDTH` have - # both 32-bit and 64-bit outputs updated by the PR author, before - # the PR is approved and tested for merging. - # It will also detect tests lacking `// EMIT_MIR_FOR_EACH_BIT_WIDTH`, - # despite having different output on 32-bit vs 64-bit targets. - ../x.py --stage 1 test tests/mir-opt --host='' --target=i686-unknown-linux-gnu - - # Run `ui-fulldeps` in `--stage=1`, which actually uses the stage0 - # compiler, and is sensitive to the addition of new flags. - ../x.py --stage 1 test tests/ui-fulldeps - - # Rebuild the stdlib with the size optimizations enabled and run tests again. - RUSTFLAGS_NOT_BOOTSTRAP="--cfg feature=\"optimize_for_size\"" ../x.py --stage 1 test \ - library/std library/alloc library/core -fi - ../x.py --stage 2 test \ --skip compiler \ --skip src diff --git a/src/ci/docker/scripts/x86_64-gnu-llvm3.sh b/src/ci/docker/scripts/x86_64-gnu-llvm3.sh new file mode 100755 index 0000000000000..5a9ad7b7412e7 --- /dev/null +++ b/src/ci/docker/scripts/x86_64-gnu-llvm3.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +set -ex + +if [ "$READ_ONLY_SRC" = "0" ]; then + # `core::builder::tests::ci_rustc_if_unchanged_logic` bootstrap test ensures that + # "download-rustc=if-unchanged" logic don't use CI rustc while there are changes on + # compiler and/or library. Here we are adding a dummy commit on compiler and running + # that test to make sure we never download CI rustc with a change on the compiler tree. + echo "" >> ../compiler/rustc/src/main.rs + git config --global user.email "dummy@dummy.com" + git config --global user.name "dummy" + git add ../compiler/rustc/src/main.rs + git commit -m "test commit for rust.download-rustc=if-unchanged logic" + DISABLE_CI_RUSTC_IF_INCOMPATIBLE=0 ../x.py test bootstrap \ + -- core::builder::tests::ci_rustc_if_unchanged_logic + # Revert the dummy commit + git reset --hard HEAD~1 +fi + +##### Test stage 1 ##### + +../x.py --stage 1 test --skip src/tools/tidy + +# Run the `mir-opt` tests again but this time for a 32-bit target. +# This enforces that tests using `// EMIT_MIR_FOR_EACH_BIT_WIDTH` have +# both 32-bit and 64-bit outputs updated by the PR author, before +# the PR is approved and tested for merging. +# It will also detect tests lacking `// EMIT_MIR_FOR_EACH_BIT_WIDTH`, +# despite having different output on 32-bit vs 64-bit targets. +../x.py --stage 1 test tests/mir-opt --host='' --target=i686-unknown-linux-gnu + +# Run `ui-fulldeps` in `--stage=1`, which actually uses the stage0 +# compiler, and is sensitive to the addition of new flags. +../x.py --stage 1 test tests/ui-fulldeps + +# Rebuild the stdlib with the size optimizations enabled and run tests again. +RUSTFLAGS_NOT_BOOTSTRAP="--cfg feature=\"optimize_for_size\"" ../x.py --stage 1 test \ + library/std library/alloc library/core diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml index aafc13d2dff4a..5732a428f67d7 100644 --- a/src/ci/github-actions/jobs.yml +++ b/src/ci/github-actions/jobs.yml @@ -314,7 +314,7 @@ auto: <<: *job-linux-8c # The x86_64-gnu-llvm-19 job is split into multiple jobs to run tests in parallel. - # x86_64-gnu-llvm-19-1 skips tests that run in x86_64-gnu-llvm-19-2. + # x86_64-gnu-llvm-19-1 skips tests that run in x86_64-gnu-llvm-19-{2,3}. - image: x86_64-gnu-llvm-19-1 env: RUST_BACKTRACE: 1 @@ -322,7 +322,7 @@ auto: DOCKER_SCRIPT: x86_64-gnu-llvm1.sh <<: *job-linux-4c - # Skip tests that run in x86_64-gnu-llvm-19-2 + # Skip tests that run in x86_64-gnu-llvm-19-{1,3} - image: x86_64-gnu-llvm-19-2 env: RUST_BACKTRACE: 1 @@ -330,8 +330,16 @@ auto: DOCKER_SCRIPT: x86_64-gnu-llvm2.sh <<: *job-linux-4c + # Skip tests that run in x86_64-gnu-llvm-19-{1,2} + - image: x86_64-gnu-llvm-19-3 + env: + RUST_BACKTRACE: 1 + IMAGE: x86_64-gnu-llvm-19 + DOCKER_SCRIPT: x86_64-gnu-llvm3.sh + <<: *job-linux-4c + # The x86_64-gnu-llvm-18 job is split into multiple jobs to run tests in parallel. - # x86_64-gnu-llvm-18-1 skips tests that run in x86_64-gnu-llvm-18-2. + # x86_64-gnu-llvm-18-1 skips tests that run in x86_64-gnu-llvm-18-{2,3}. - image: x86_64-gnu-llvm-18-1 env: RUST_BACKTRACE: 1 @@ -340,7 +348,7 @@ auto: DOCKER_SCRIPT: x86_64-gnu-llvm1.sh <<: *job-linux-4c - # Skip tests that run in x86_64-gnu-llvm-18-2 + # Skip tests that run in x86_64-gnu-llvm-18-{1,3} - image: x86_64-gnu-llvm-18-2 env: RUST_BACKTRACE: 1 @@ -349,6 +357,15 @@ auto: DOCKER_SCRIPT: x86_64-gnu-llvm2.sh <<: *job-linux-4c + # Skip tests that run in x86_64-gnu-llvm-18-{1,2} + - image: x86_64-gnu-llvm-18-3 + env: + RUST_BACKTRACE: 1 + READ_ONLY_SRC: "0" + IMAGE: x86_64-gnu-llvm-18 + DOCKER_SCRIPT: x86_64-gnu-llvm3.sh + <<: *job-linux-4c + - image: x86_64-gnu-nopt <<: *job-linux-4c From aa0fd4621e3bb7a2cb4cf8c8d90c288bffdc520a Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Thu, 12 Dec 2024 14:49:59 +0100 Subject: [PATCH 15/21] copy script --- src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile | 1 + src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile | 1 + 2 files changed, 2 insertions(+) diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile index bcbf68a366279..403dd2fabbecf 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile @@ -63,4 +63,5 @@ ARG SCRIPT_ARG COPY scripts/x86_64-gnu-llvm.sh /tmp/x86_64-gnu-llvm.sh COPY scripts/x86_64-gnu-llvm1.sh /tmp/x86_64-gnu-llvm1.sh COPY scripts/x86_64-gnu-llvm2.sh /tmp/x86_64-gnu-llvm2.sh +COPY scripts/x86_64-gnu-llvm3.sh /tmp/x86_64-gnu-llvm3.sh ENV SCRIPT /tmp/${SCRIPT_ARG} diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile index 567277e9a5898..cd245bed940ab 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile @@ -63,4 +63,5 @@ ARG SCRIPT_ARG COPY scripts/x86_64-gnu-llvm.sh /tmp/x86_64-gnu-llvm.sh COPY scripts/x86_64-gnu-llvm1.sh /tmp/x86_64-gnu-llvm1.sh COPY scripts/x86_64-gnu-llvm2.sh /tmp/x86_64-gnu-llvm2.sh +COPY scripts/x86_64-gnu-llvm3.sh /tmp/x86_64-gnu-llvm3.sh ENV SCRIPT /tmp/${SCRIPT_ARG} From a1abbaab0db7143e24ca029e6894d85ebb868384 Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Thu, 12 Dec 2024 18:02:19 +0100 Subject: [PATCH 16/21] remove echo logs --- src/ci/docker/run.sh | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/ci/docker/run.sh b/src/ci/docker/run.sh index 25a32ef15f3b7..a0adf60b6b2c9 100755 --- a/src/ci/docker/run.sh +++ b/src/ci/docker/run.sh @@ -38,9 +38,7 @@ root_dir="`dirname $src_dir`" source "$ci_dir/shared.sh" -echo "Checking is running in CI..." if isCI; then - echo "CI detected" objdir=$root_dir/obj else objdir=$root_dir/obj/$image @@ -55,7 +53,6 @@ fi CACHE_DOMAIN="${CACHE_DOMAIN:-ci-caches.rust-lang.org}" if [ -f "$docker_dir/$image/Dockerfile" ]; then - echo "Dockefile exists for $image" hash_key=/tmp/.docker-hash-key.txt rm -f "${hash_key}" echo $image >> $hash_key @@ -123,9 +120,6 @@ if [ -f "$docker_dir/$image/Dockerfile" ]; then # instead of the one defined in the Dockerfile. if [ -n "${DOCKER_SCRIPT+x}" ]; then build_args+=("--build-arg" "SCRIPT_ARG=${DOCKER_SCRIPT}") - echo "Using docker build arg SCRIPT_ARG=${DOCKER_SCRIPT}" - else - echo "DOCKER_SCRIPT is not defined" fi # On non-CI jobs, we try to download a pre-built image from the rust-lang-ci From 2bf1cec41b457bae459d7f18168e147fb467d898 Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Thu, 12 Dec 2024 18:07:47 +0100 Subject: [PATCH 17/21] refactor --- src/ci/docker/scripts/add_dummy_commit.sh | 19 +++++++++++++++++++ src/ci/docker/scripts/x86_64-gnu-llvm.sh | 16 +--------------- src/ci/docker/scripts/x86_64-gnu-llvm1.sh | 16 +--------------- src/ci/docker/scripts/x86_64-gnu-llvm2.sh | 18 +++--------------- src/ci/docker/scripts/x86_64-gnu-llvm3.sh | 16 +--------------- 5 files changed, 25 insertions(+), 60 deletions(-) create mode 100755 src/ci/docker/scripts/add_dummy_commit.sh diff --git a/src/ci/docker/scripts/add_dummy_commit.sh b/src/ci/docker/scripts/add_dummy_commit.sh new file mode 100755 index 0000000000000..029e4ae141f8f --- /dev/null +++ b/src/ci/docker/scripts/add_dummy_commit.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +set -ex + +if [ "$READ_ONLY_SRC" = "0" ]; then + # `core::builder::tests::ci_rustc_if_unchanged_logic` bootstrap test ensures that + # "download-rustc=if-unchanged" logic don't use CI rustc while there are changes on + # compiler and/or library. Here we are adding a dummy commit on compiler and running + # that test to make sure we never download CI rustc with a change on the compiler tree. + echo "" >> ../compiler/rustc/src/main.rs + git config --global user.email "dummy@dummy.com" + git config --global user.name "dummy" + git add ../compiler/rustc/src/main.rs + git commit -m "test commit for rust.download-rustc=if-unchanged logic" + DISABLE_CI_RUSTC_IF_INCOMPATIBLE=0 ../x.py test bootstrap \ + -- core::builder::tests::ci_rustc_if_unchanged_logic + # Revert the dummy commit + git reset --hard HEAD~1 +fi diff --git a/src/ci/docker/scripts/x86_64-gnu-llvm.sh b/src/ci/docker/scripts/x86_64-gnu-llvm.sh index 9e9c209530447..fcf3b77d32121 100755 --- a/src/ci/docker/scripts/x86_64-gnu-llvm.sh +++ b/src/ci/docker/scripts/x86_64-gnu-llvm.sh @@ -2,21 +2,7 @@ set -ex -if [ "$READ_ONLY_SRC" = "0" ]; then - # `core::builder::tests::ci_rustc_if_unchanged_logic` bootstrap test ensures that - # "download-rustc=if-unchanged" logic don't use CI rustc while there are changes on - # compiler and/or library. Here we are adding a dummy commit on compiler and running - # that test to make sure we never download CI rustc with a change on the compiler tree. - echo "" >> ../compiler/rustc/src/main.rs - git config --global user.email "dummy@dummy.com" - git config --global user.name "dummy" - git add ../compiler/rustc/src/main.rs - git commit -m "test commit for rust.download-rustc=if-unchanged logic" - DISABLE_CI_RUSTC_IF_INCOMPATIBLE=0 ../x.py test bootstrap \ - -- core::builder::tests::ci_rustc_if_unchanged_logic - # Revert the dummy commit - git reset --hard HEAD~1 -fi +./add_dummy_commit.sh # NOTE: intentionally uses all of `x.py`, `x`, and `x.ps1` to make sure they all work on Linux. ../x.py --stage 2 test --skip src/tools/tidy diff --git a/src/ci/docker/scripts/x86_64-gnu-llvm1.sh b/src/ci/docker/scripts/x86_64-gnu-llvm1.sh index aab8fcc1f5e88..7e451a8578dd8 100755 --- a/src/ci/docker/scripts/x86_64-gnu-llvm1.sh +++ b/src/ci/docker/scripts/x86_64-gnu-llvm1.sh @@ -2,21 +2,7 @@ set -ex -if [ "$READ_ONLY_SRC" = "0" ]; then - # `core::builder::tests::ci_rustc_if_unchanged_logic` bootstrap test ensures that - # "download-rustc=if-unchanged" logic don't use CI rustc while there are changes on - # compiler and/or library. Here we are adding a dummy commit on compiler and running - # that test to make sure we never download CI rustc with a change on the compiler tree. - echo "" >> ../compiler/rustc/src/main.rs - git config --global user.email "dummy@dummy.com" - git config --global user.name "dummy" - git add ../compiler/rustc/src/main.rs - git commit -m "test commit for rust.download-rustc=if-unchanged logic" - DISABLE_CI_RUSTC_IF_INCOMPATIBLE=0 ../x.py test bootstrap \ - -- core::builder::tests::ci_rustc_if_unchanged_logic - # Revert the dummy commit - git reset --hard HEAD~1 -fi +./add_dummy_commit.sh ../x.py --stage 2 test \ --skip tests \ diff --git a/src/ci/docker/scripts/x86_64-gnu-llvm2.sh b/src/ci/docker/scripts/x86_64-gnu-llvm2.sh index 678b209677712..4fc1e99b5f73b 100755 --- a/src/ci/docker/scripts/x86_64-gnu-llvm2.sh +++ b/src/ci/docker/scripts/x86_64-gnu-llvm2.sh @@ -2,21 +2,9 @@ set -ex -if [ "$READ_ONLY_SRC" = "0" ]; then - # `core::builder::tests::ci_rustc_if_unchanged_logic` bootstrap test ensures that - # "download-rustc=if-unchanged" logic don't use CI rustc while there are changes on - # compiler and/or library. Here we are adding a dummy commit on compiler and running - # that test to make sure we never download CI rustc with a change on the compiler tree. - echo "" >> ../compiler/rustc/src/main.rs - git config --global user.email "dummy@dummy.com" - git config --global user.name "dummy" - git add ../compiler/rustc/src/main.rs - git commit -m "test commit for rust.download-rustc=if-unchanged logic" - DISABLE_CI_RUSTC_IF_INCOMPATIBLE=0 ../x.py test bootstrap \ - -- core::builder::tests::ci_rustc_if_unchanged_logic - # Revert the dummy commit - git reset --hard HEAD~1 -fi +./add_dummy_commit.sh + +##### Test stage 2 ##### ../x.py --stage 2 test \ --skip compiler \ diff --git a/src/ci/docker/scripts/x86_64-gnu-llvm3.sh b/src/ci/docker/scripts/x86_64-gnu-llvm3.sh index 5a9ad7b7412e7..cf4b5a198dd69 100755 --- a/src/ci/docker/scripts/x86_64-gnu-llvm3.sh +++ b/src/ci/docker/scripts/x86_64-gnu-llvm3.sh @@ -2,21 +2,7 @@ set -ex -if [ "$READ_ONLY_SRC" = "0" ]; then - # `core::builder::tests::ci_rustc_if_unchanged_logic` bootstrap test ensures that - # "download-rustc=if-unchanged" logic don't use CI rustc while there are changes on - # compiler and/or library. Here we are adding a dummy commit on compiler and running - # that test to make sure we never download CI rustc with a change on the compiler tree. - echo "" >> ../compiler/rustc/src/main.rs - git config --global user.email "dummy@dummy.com" - git config --global user.name "dummy" - git add ../compiler/rustc/src/main.rs - git commit -m "test commit for rust.download-rustc=if-unchanged logic" - DISABLE_CI_RUSTC_IF_INCOMPATIBLE=0 ../x.py test bootstrap \ - -- core::builder::tests::ci_rustc_if_unchanged_logic - # Revert the dummy commit - git reset --hard HEAD~1 -fi +./add_dummy_commit.sh ##### Test stage 1 ##### From c2f45505f53749548ea89e1a46b7f8c036f23b1f Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Thu, 12 Dec 2024 18:18:23 +0100 Subject: [PATCH 18/21] remove echo --- src/ci/scripts/run-build-from-ci.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/ci/scripts/run-build-from-ci.sh b/src/ci/scripts/run-build-from-ci.sh index 4ce6de8e857f7..55e75800d91c4 100755 --- a/src/ci/scripts/run-build-from-ci.sh +++ b/src/ci/scripts/run-build-from-ci.sh @@ -17,9 +17,7 @@ echo "::add-matcher::src/ci/github-actions/problem_matchers.json" # the environment rustup self uninstall -y || true if [ -z "${IMAGE+x}" ]; then - echo "Running src/ci/run.sh" src/ci/run.sh else - echo "Running src/ci/docker/run.sh with image ${IMAGE}" src/ci/docker/run.sh "${IMAGE}" fi From a67a71da185d566f3bca1f43f2d705f76e9ef1bf Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Thu, 12 Dec 2024 18:34:20 +0100 Subject: [PATCH 19/21] add files --- src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile | 1 + src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile | 1 + 2 files changed, 2 insertions(+) diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile index 403dd2fabbecf..42df58517caf4 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile @@ -60,6 +60,7 @@ COPY host-x86_64/dist-x86_64-linux/build-gccjit.sh /scripts/ RUN /scripts/build-gccjit.sh /scripts ARG SCRIPT_ARG +COPY scripts/add_dummy_commit.sh /tmp/add_dummy_commit.sh COPY scripts/x86_64-gnu-llvm.sh /tmp/x86_64-gnu-llvm.sh COPY scripts/x86_64-gnu-llvm1.sh /tmp/x86_64-gnu-llvm1.sh COPY scripts/x86_64-gnu-llvm2.sh /tmp/x86_64-gnu-llvm2.sh diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile index cd245bed940ab..f2aadbe87cfec 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile @@ -60,6 +60,7 @@ COPY host-x86_64/dist-x86_64-linux/build-gccjit.sh /scripts/ RUN /scripts/build-gccjit.sh /scripts ARG SCRIPT_ARG +COPY scripts/add_dummy_commit.sh /tmp/add_dummy_commit.sh COPY scripts/x86_64-gnu-llvm.sh /tmp/x86_64-gnu-llvm.sh COPY scripts/x86_64-gnu-llvm1.sh /tmp/x86_64-gnu-llvm1.sh COPY scripts/x86_64-gnu-llvm2.sh /tmp/x86_64-gnu-llvm2.sh From 4fa9078b172a7013291b8a5cd3e61881873cae66 Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Thu, 12 Dec 2024 19:19:04 +0100 Subject: [PATCH 20/21] fix path --- src/ci/docker/scripts/x86_64-gnu-llvm.sh | 2 +- src/ci/docker/scripts/x86_64-gnu-llvm1.sh | 2 +- src/ci/docker/scripts/x86_64-gnu-llvm2.sh | 2 +- src/ci/docker/scripts/x86_64-gnu-llvm3.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ci/docker/scripts/x86_64-gnu-llvm.sh b/src/ci/docker/scripts/x86_64-gnu-llvm.sh index fcf3b77d32121..0c7cbcb6e6f50 100755 --- a/src/ci/docker/scripts/x86_64-gnu-llvm.sh +++ b/src/ci/docker/scripts/x86_64-gnu-llvm.sh @@ -2,7 +2,7 @@ set -ex -./add_dummy_commit.sh +${PWD}add_dummy_commit.sh # NOTE: intentionally uses all of `x.py`, `x`, and `x.ps1` to make sure they all work on Linux. ../x.py --stage 2 test --skip src/tools/tidy diff --git a/src/ci/docker/scripts/x86_64-gnu-llvm1.sh b/src/ci/docker/scripts/x86_64-gnu-llvm1.sh index 7e451a8578dd8..a6df891205f56 100755 --- a/src/ci/docker/scripts/x86_64-gnu-llvm1.sh +++ b/src/ci/docker/scripts/x86_64-gnu-llvm1.sh @@ -2,7 +2,7 @@ set -ex -./add_dummy_commit.sh +${PWD}add_dummy_commit.sh ../x.py --stage 2 test \ --skip tests \ diff --git a/src/ci/docker/scripts/x86_64-gnu-llvm2.sh b/src/ci/docker/scripts/x86_64-gnu-llvm2.sh index 4fc1e99b5f73b..6f16808e8c5f4 100755 --- a/src/ci/docker/scripts/x86_64-gnu-llvm2.sh +++ b/src/ci/docker/scripts/x86_64-gnu-llvm2.sh @@ -2,7 +2,7 @@ set -ex -./add_dummy_commit.sh +${PWD}add_dummy_commit.sh ##### Test stage 2 ##### diff --git a/src/ci/docker/scripts/x86_64-gnu-llvm3.sh b/src/ci/docker/scripts/x86_64-gnu-llvm3.sh index cf4b5a198dd69..6f237b09c3f67 100755 --- a/src/ci/docker/scripts/x86_64-gnu-llvm3.sh +++ b/src/ci/docker/scripts/x86_64-gnu-llvm3.sh @@ -2,7 +2,7 @@ set -ex -./add_dummy_commit.sh +${PWD}add_dummy_commit.sh ##### Test stage 1 ##### From ac078a4cccf1ef4294960eecf6bc8b14149d2aa9 Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Thu, 12 Dec 2024 19:34:45 +0100 Subject: [PATCH 21/21] fix path --- src/ci/docker/scripts/x86_64-gnu-llvm.sh | 2 +- src/ci/docker/scripts/x86_64-gnu-llvm1.sh | 2 +- src/ci/docker/scripts/x86_64-gnu-llvm2.sh | 2 +- src/ci/docker/scripts/x86_64-gnu-llvm3.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ci/docker/scripts/x86_64-gnu-llvm.sh b/src/ci/docker/scripts/x86_64-gnu-llvm.sh index 0c7cbcb6e6f50..e7dcc1ddff449 100755 --- a/src/ci/docker/scripts/x86_64-gnu-llvm.sh +++ b/src/ci/docker/scripts/x86_64-gnu-llvm.sh @@ -2,7 +2,7 @@ set -ex -${PWD}add_dummy_commit.sh +/tmp/add_dummy_commit.sh # NOTE: intentionally uses all of `x.py`, `x`, and `x.ps1` to make sure they all work on Linux. ../x.py --stage 2 test --skip src/tools/tidy diff --git a/src/ci/docker/scripts/x86_64-gnu-llvm1.sh b/src/ci/docker/scripts/x86_64-gnu-llvm1.sh index a6df891205f56..56ef39aae1556 100755 --- a/src/ci/docker/scripts/x86_64-gnu-llvm1.sh +++ b/src/ci/docker/scripts/x86_64-gnu-llvm1.sh @@ -2,7 +2,7 @@ set -ex -${PWD}add_dummy_commit.sh +/tmp/add_dummy_commit.sh ../x.py --stage 2 test \ --skip tests \ diff --git a/src/ci/docker/scripts/x86_64-gnu-llvm2.sh b/src/ci/docker/scripts/x86_64-gnu-llvm2.sh index 6f16808e8c5f4..c9f6b98f01f4f 100755 --- a/src/ci/docker/scripts/x86_64-gnu-llvm2.sh +++ b/src/ci/docker/scripts/x86_64-gnu-llvm2.sh @@ -2,7 +2,7 @@ set -ex -${PWD}add_dummy_commit.sh +/tmp/add_dummy_commit.sh ##### Test stage 2 ##### diff --git a/src/ci/docker/scripts/x86_64-gnu-llvm3.sh b/src/ci/docker/scripts/x86_64-gnu-llvm3.sh index 6f237b09c3f67..d1bf2dab1e2d7 100755 --- a/src/ci/docker/scripts/x86_64-gnu-llvm3.sh +++ b/src/ci/docker/scripts/x86_64-gnu-llvm3.sh @@ -2,7 +2,7 @@ set -ex -${PWD}add_dummy_commit.sh +/tmp/add_dummy_commit.sh ##### Test stage 1 #####