Merge pull request #1105 from bjorn3/test_rustc_bootstrapping
Test bootstrapping of rustc using cg_clif
This commit is contained in:
commit
03f01bbe90
3 changed files with 116 additions and 5 deletions
44
.github/workflows/bootstrap_rustc.yml
vendored
Normal file
44
.github/workflows/bootstrap_rustc.yml
vendored
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
name: Bootstrap rustc using cg_clif
|
||||||
|
|
||||||
|
on:
|
||||||
|
- push
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
bootstrap_rustc:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Cache cargo installed crates
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/.cargo/bin
|
||||||
|
key: ${{ runner.os }}-cargo-installed-crates
|
||||||
|
|
||||||
|
- name: Cache cargo registry and index
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cargo/registry
|
||||||
|
~/.cargo/git
|
||||||
|
key: ${{ runner.os }}-cargo-registry-and-index-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
|
- name: Cache cargo target dir
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: target
|
||||||
|
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
|
||||||
|
|
||||||
|
- name: Prepare dependencies
|
||||||
|
run: |
|
||||||
|
git config --global user.email "user@example.com"
|
||||||
|
git config --global user.name "User"
|
||||||
|
./prepare.sh
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: |
|
||||||
|
# Enable backtraces for easier debugging
|
||||||
|
export RUST_BACKTRACE=1
|
||||||
|
|
||||||
|
./scripts/test_bootstrap.sh
|
65
scripts/test_bootstrap.sh
Executable file
65
scripts/test_bootstrap.sh
Executable file
|
@ -0,0 +1,65 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
cd $(dirname "$0")/../
|
||||||
|
|
||||||
|
./build.sh
|
||||||
|
source build/config.sh
|
||||||
|
|
||||||
|
echo "[TEST] Bootstrap of rustc"
|
||||||
|
git clone https://github.com/rust-lang/rust.git || true
|
||||||
|
pushd rust
|
||||||
|
git fetch
|
||||||
|
git checkout -- .
|
||||||
|
git checkout $(rustc -V | cut -d' ' -f3 | tr -d '(')
|
||||||
|
|
||||||
|
git apply - <<EOF
|
||||||
|
diff --git a/.gitmodules b/.gitmodules
|
||||||
|
index 984113151de..c1e9d960d56 100644
|
||||||
|
--- a/.gitmodules
|
||||||
|
+++ b/.gitmodules
|
||||||
|
@@ -34,10 +34,6 @@
|
||||||
|
[submodule "src/doc/edition-guide"]
|
||||||
|
path = src/doc/edition-guide
|
||||||
|
url = https://github.com/rust-lang/edition-guide.git
|
||||||
|
-[submodule "src/llvm-project"]
|
||||||
|
- path = src/llvm-project
|
||||||
|
- url = https://github.com/rust-lang/llvm-project.git
|
||||||
|
- branch = rustc/11.0-2020-10-12
|
||||||
|
[submodule "src/doc/embedded-book"]
|
||||||
|
path = src/doc/embedded-book
|
||||||
|
url = https://github.com/rust-embedded/book.git
|
||||||
|
diff --git a/compiler/rustc_data_structures/Cargo.toml b/compiler/rustc_data_structures/Cargo.toml
|
||||||
|
index 23e689fcae7..5f077b765b6 100644
|
||||||
|
--- a/compiler/rustc_data_structures/Cargo.toml
|
||||||
|
+++ b/compiler/rustc_data_structures/Cargo.toml
|
||||||
|
@@ -32,7 +32,6 @@ tempfile = "3.0.5"
|
||||||
|
|
||||||
|
[dependencies.parking_lot]
|
||||||
|
version = "0.11"
|
||||||
|
-features = ["nightly"]
|
||||||
|
|
||||||
|
[target.'cfg(windows)'.dependencies]
|
||||||
|
winapi = { version = "0.3", features = ["fileapi", "psapi"] }
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat > config.toml <<EOF
|
||||||
|
[llvm]
|
||||||
|
ninja = false
|
||||||
|
|
||||||
|
[build]
|
||||||
|
rustc = "$(pwd)/../build/cg_clif"
|
||||||
|
cargo = "$(rustup which cargo)"
|
||||||
|
full-bootstrap = true
|
||||||
|
local-rebuild = true
|
||||||
|
|
||||||
|
[rust]
|
||||||
|
codegen-backends = ["cranelift"]
|
||||||
|
EOF
|
||||||
|
|
||||||
|
rm -r compiler/rustc_codegen_cranelift/{Cargo.*,src}
|
||||||
|
cp ../Cargo.* compiler/rustc_codegen_cranelift/
|
||||||
|
cp -r ../src compiler/rustc_codegen_cranelift/src
|
||||||
|
|
||||||
|
./x.py build --stage 1 library/std
|
||||||
|
popd
|
|
@ -27,11 +27,13 @@ impl rustc_driver::Callbacks for CraneliftPassesCallbacks {
|
||||||
config.opts.cg.panic = Some(PanicStrategy::Abort);
|
config.opts.cg.panic = Some(PanicStrategy::Abort);
|
||||||
config.opts.debugging_opts.panic_abort_tests = true;
|
config.opts.debugging_opts.panic_abort_tests = true;
|
||||||
config.opts.maybe_sysroot = Some(
|
config.opts.maybe_sysroot = Some(
|
||||||
|
config.opts.maybe_sysroot.clone().unwrap_or(
|
||||||
std::env::current_exe()
|
std::env::current_exe()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.parent()
|
.parent()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.join("sysroot"),
|
.join("sysroot"),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue