about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMarcoIeni <11428655+MarcoIeni@users.noreply.github.com>2024-12-12 18:07:47 +0100
committerMarcoIeni <11428655+MarcoIeni@users.noreply.github.com>2024-12-12 18:07:47 +0100
commit2bf1cec41b457bae459d7f18168e147fb467d898 (patch)
tree7d764a74ef694754f2e371fb4d8d8b9a94e81bbc
parenta1abbaab0db7143e24ca029e6894d85ebb868384 (diff)
downloadrust-2bf1cec41b457bae459d7f18168e147fb467d898.tar.gz
rust-2bf1cec41b457bae459d7f18168e147fb467d898.zip
refactor
-rwxr-xr-xsrc/ci/docker/scripts/add_dummy_commit.sh19
-rwxr-xr-xsrc/ci/docker/scripts/x86_64-gnu-llvm.sh16
-rwxr-xr-xsrc/ci/docker/scripts/x86_64-gnu-llvm1.sh16
-rwxr-xr-xsrc/ci/docker/scripts/x86_64-gnu-llvm2.sh18
-rwxr-xr-xsrc/ci/docker/scripts/x86_64-gnu-llvm3.sh16
5 files changed, 25 insertions, 60 deletions
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 00000000000..029e4ae141f
--- /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 9e9c2095304..fcf3b77d321 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 aab8fcc1f5e..7e451a8578d 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 678b2096777..4fc1e99b5f7 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 5a9ad7b7412..cf4b5a198dd 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 #####